Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2001:
[Freeciv-Dev] Re: server/cityturn.c - surplus food when settlers (units
Home

[Freeciv-Dev] Re: server/cityturn.c - surplus food when settlers (units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: michaelz@xxxxxxxxxxxxxxx (Michael Zinn), freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: server/cityturn.c - surplus food when settlers (units with F_CITIES) are built (PR#811)
From: Thue <thue@xxxxxxx>
Date: Sat, 23 Jun 2001 14:31:21 +0200

On Saturday 23 June 2001 07:05, Michael Zinn wrote:
> The problem: when settlers are built, the city they are built in consumes
> needs the food for both the settler *and* the extra head of population for
> that turn
>
> More details are in the inserted `patch' below, which isn't really a patch
> but rather an opportunity to put the problem in context and describe it in
> more detail :P
>
> Attached is also a "patch" which `ought' to work, but seems a little too
> obvious, again, as discussed in the comment below.

+      /* Here's where I suspect the fix would be...
+       * what happens is, create_unit does the whole refresh_city thing, 
which
+       * includes a set_food_trade_shields and a city_support which together
+       * set the pcity->food_surplus.
+       * The problem with this is, that for this turns food surplus purposes,
+       * the player is paying for *both* the extra head of population *and*
+       * the settler (ie an F_CITIES unit), which is not really what should
+       * happend.

What really is the problem is that we do not call city_refresh() again after 
removing the citizen. So the city fields are out of sync with reality.
Your fix works too, but adding the refresh to to city_auto_remove_worker() is 
nicer because it makes the function safe for everybody.

There isn't anything obvious you have missed. I recently added the 
city_refresh to create_unit(), which then caused this bug.

-Thue


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