[Freeciv-Dev] Accessing City Variables
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
I'm currently looking at the FreeCiv game code. I'm a real novice in C/C++, and
am very confused as to why the following code won't work:
struct city *pTestCity;
int counter;
for (counter = 0; counter < B_LAST; counter++) {
pTestCity = player_find_city_by_id(game.player_ptr,
game.global_wonders[counter]);
if (pTestCity != NULL) {
fc_fprintf(stderr, _("Not null... \n"));
break;
}
else
fc_fprintf(stderr, _("Still NULL... \n"));
}
fc_fprintf(stderr, _("Test HERE \n"));
if (pTestCity == NULL)
fc_fprintf(stderr, _("It is NULL \n"));
else
printf(pTestCity->food_stock);
Basically I want to access the players city (all cities, not including the AI
player cities) values e.g. gold, food, production, trade etc. for the current
player in the client mode. And the above code seems to always be returning NULL
to pTestCity, even though in the game I have created multiple cities.
I was wondering if you might have any pointers as to how I can access the player
cities values. Any help would be greatly appreciated, thanks.
--
Cheers
YaChu
P.S. The above code is in the send_turn_done(void) method which is in the
civclient.c file.
- [Freeciv-Dev] Accessing City Variables,
YaChu Yang <=
|
|