Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] (PR#6973) civ3foodbox
Home

[Freeciv-Dev] (PR#6973) civ3foodbox

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: i-freeciv-lists@xxxxxxxxxxxxx
Cc: use_less@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#6973) civ3foodbox
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Feb 2004 16:56:46 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6973 >

> [use_less - Mon Dec 08 21:20:24 2003]:
> 
> So then I thought to myself, self, why did you break compatibility with 
> existing rulesets when you could've written your patch to use the
> existing ruleset variables?  And thus, I wrote this patch, 
> flexfoodbox-compat.diff.  Format is the same as the old rulesets, in
> game.ruleset:
> 
> ; Parameters used to generalize the calculation of city granary size:
> ;   city_granary_size = (granary_food_ini * foodbox) +
> ;                       (granary_food_inc * city_size) * foodbox / 100
> granary_food_ini      = 1
> granary_food_inc      = 100
> 
> And to implement civ 3 style foodbox:
> 
> ; Parameters used to generalize the calculation of city granary size:
> ;   city_granary_size = (granary_food_ini * foodbox) +
> ;                       (granary_food_inc * city_size) * foodbox / 100
> granary_food_ini      = 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 6
> granary_food_inc      = 0
> 
> Amazing what a good night of sleep will get you. :)

Hmm, looks like this patch has been ignored for a while.

- My first question is, why is granary_food_inc 100 instead of 1?  This
is ridiculous, right?  But anyway, you didn't add this so...

- Don't count on MAX_CITY_SIZE.  I don't think this value is to be
trusted, and there's no reason we have to use it here.  You can use a
dynamic or fix-sized array to hold the ini granary values.

- Don't index the granary_ini array from city_granary_size.  Instead do
something like

  if (city_size > game.rgame.num_ini_fields) {
    return game.rgame.granary_food_ini[game.rgame.num_ini_fields - 1]
      + (game.rgame.granary_food_inc * city_size * game.foodbox) / 100;
  } else {
    return game.rgame.granary_food_ini[city_size - 1];
  }

thus the inc only applies after the ini_fields run out.

- Now game.rgame.num_ini_fields must be passed through the network.

- Of course num_ini_fields is a bad name.  I guess there should be a
"granary" in there somewhere!

- Call city_granary_size so the above calculation isn't duplicated
(citytools.c).

- Clean up the ruleset loading.  It should be easy after the above.

jason



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