[Freeciv-Dev] Re: Patch: generalized granary size (PR#635)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Saturday 23 December 2000 19:14, mike_jing@xxxxxxxxx wrote:
> Credit for this idea goes to Andrew McGuinnes. Bugs and mistakes are all
> mine. Please apply after the remove-free-city-center patch. Thank you.
>
> Mike
You didn't change food_weighting() ...
int food_weighting(int n)
{
static int value[56] = { -1, 57, 38, 25, 19, 15, 12, 10, 9, 8, 7,
6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
return(value[n]);
}
Obviously (?) it is a try to take the diminishing value of food as a city
grows into account. So in a city of size 1 food has a value of 57, while in a
city of size 2, whire it takes 50% more to make the city grow, the value of
food is only 2/3*57 = 38. Then you would expect the next value to be 3/4*38 =
28.5, but apperantly the author of this code miscalculated (used 2/3
instead)... The correct (and commented) code would be
int food_weighting(int city_size)
{
int foodbox_width = (city_size+1);
/* Assuming size 4 cities (with foodbox_width 5) to be the norm for which
FOOD_WEIGHTING is balanced */
return (5/foodbox_width) * FOOD_WEIGHTING;
}
which could of course the hardcoded as before, perhaps in a soft way which
created the table the first time it was run.
-Thue
|
|