Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] Re: Changing City Variables
Home

[Freeciv-Dev] Re: Changing City Variables

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: YaChu Yang <yyan050@xxxxxxxxxxxxxxxxx>
Cc: Per Inge Mathisen <per@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Changing City Variables
From: Jason Dorje Short <jdorje@xxxxxxxxxxxx>
Date: Thu, 08 Sep 2005 11:50:13 -0400

YaChu Yang wrote:

What I mean is that using say the following:

+  city_list_iterate(game.player_ptr->cities, pcity) {
+    freelog(LOG_NORMAL, "Original food stock is: %d", pcity->food_stock);
+    pcity->food_stock = 10;
+    freelog(LOG_NORMAL, "New food stock is: %d", pcity->food_stock);
+  } city_list_iterate_end;

The above will get food stock for a particular city and then set food stock to
10. However using the above method, it only updates the local copy of food
stock. Hence in the next turn, my food stock won't be 10 for this particular
city, it'll be the original value plus the amount it's suppose to increase by
per turn.

Freeciv uses a client-server architecture, and the server holds the master copy of all data. If you put the above code in the server it will make the change you want. If you put it in the client it will do nothing.

-jason



[Prev in Thread] Current Thread [Next in Thread]