<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40619 >

> [book - Di 10. Feb 2009, 02:58:11]:
> 
> > [matthias.pfaffer...@mapfa.de - Sun Jan 04 22:03:07 2009]:
> > 
> > The gold upkeep patch (version 2)
> 
> I have made some adjustments to your patch and attached
> it as version 3. The most pertinent changes are:
> 
> - The option is called 'gold_upkeep_style' instead of
>   'economic_system'.
> - I used vectors to randomly select improvements and units
>   to sell.
> - I moved the unit gold upkeep stuff from unittools.[ch] to
>   cityturn.c.
> - Cities are passed to update_city_activity() in a random
>   order.
> 
> The rest is pretty minor style and design stuff which can
> be seen in the patch code if you are interested.

First, thank you for looking at the patch! Some comments:

In my version of the patch the improvements to sell are also selected 
randomly using 'city_improve_list_shuffle'. You did not used 
*_list_shuffle at all, so perhaps this isn't needed and could be 
deleted?

I learned some time ago, that I should _never_ use GOTO in my 
programs. For something like you did - skipping some parts within a 
function without using a lot of if's - it is OK / accepted to use? 

> 
> 
> > The patch was tested with an adapted ruleset (gold upkeep).
> 
> Can you post this ruleset, so I can test it too? Or if you
> find anything wrong with this version of the patch you can
> leave a reply and I will try to fix it.

A patch for the default ruleset is attached. It changes all shield 
upkeep to gold upkeep ...

Would it be possible to let a unit use shield upkeep for one 
government and gold upkeep for another? Perhaps add a third option to 
the 'gold_upkeep_style' which just uses 'uk_shield' for units as gold 
upkeep or which just adds the shield upkeep to the gold upkeep and 
does not needs the shilds. So there would be no need to change the 
rulesets.

This would also open the possibility to have this option as a setting 
for each government ...

Kind regards

Matthias

> 
> 
> -----------------------------------------------------------------------
> 金のように輝くまできれいにしてあげる。
> 

diff -ur freeciv.org//data/default/units.ruleset freeciv/data/default/units.ruleset
--- freeciv.org//data/default/units.ruleset	2009-01-05 11:55:06.000000000 +0100
+++ freeciv/data/default/units.ruleset	2009-02-10 22:29:17.000000000 +0100
@@ -291,9 +291,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 0
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 1
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Settlers", "NonMil", "AddToCity", "Cities", "NoVeteran"
 roles         = "Cities"
 helptext      = _("\
@@ -335,9 +335,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 0
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Settlers", "NonMil", "Airbase", "NoVeteran"
 roles         = "Settlers"
 helptext      = _("\
@@ -376,9 +376,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 0
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Settlers", "NonMil", "Transform", "Airbase", "NoVeteran"
 roles         = "Settlers"
 helptext      = _("\
@@ -417,9 +417,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "DefendOk", "FirstBuild"
 helptext      = _("\
@@ -449,9 +449,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "DefendGood", "FirstBuild"
 helptext      = _("\
@@ -480,9 +480,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "DefendOk"
 helptext      = _("\
@@ -512,9 +512,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "DefendOk", "Hut", "BarbarianBuild", "BarbarianSea"
 helptext      = _("\
@@ -544,9 +544,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Pikemen"
 roles         = "DefendGood", "FirstBuild"
 helptext      = _("\
@@ -576,9 +576,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "DefendGood", "FirstBuild", "HutTech",
                 "BarbarianTech", "BarbarianBuildTech", "BarbarianSeaTech"
@@ -610,9 +610,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "IgTer", "IgZOC"
 roles         = "DefendGood", "Partisan", "BarbarianTech"
 helptext      = _("\
@@ -653,9 +653,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "IgTer"
 roles         = "DefendGood"
 helptext      = _("\
@@ -685,9 +685,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "DefendGood", "FirstBuild"
 helptext      = _("\
@@ -717,9 +717,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Marines"
 roles         = "DefendOk", "BarbarianSeaTech"
 helptext      = _("\
@@ -748,9 +748,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Paratroopers"
 roles         = "DefendOk"
 helptext      = _("\
@@ -783,9 +783,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "DefendGood"
 helptext      = _("\
@@ -816,9 +816,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Horse"
 roles         = "AttackFast", "Hut", "Barbarian", "Hunter"
 helptext      = _("\
@@ -849,9 +849,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Horse"
 roles         = "AttackFast", "Hut", "Hunter"
 helptext      = _("\
@@ -881,9 +881,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Horse"
 roles         = "AttackFast", "HutTech", "BarbarianTech",
                 "BarbarianBuildTech", "BarbarianSeaTech", "Hunter"
@@ -913,9 +913,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Horse"
 roles         = "AttackFast", "BarbarianBuildTech", "BarbarianSeaTech",
                 "Hunter"
@@ -945,9 +945,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "AttackFast", "Hunter"
 helptext      = _("\
@@ -976,9 +976,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "AttackFast", "Hunter"
 helptext      = _("\
@@ -1009,9 +1009,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "AttackStrong"
 helptext      = _("\
@@ -1042,9 +1042,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "AttackStrong", "BarbarianTech", "BarbarianBuildTech"
 helptext      = _("\
@@ -1076,9 +1076,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = ""
 roles         = "AttackStrong"
 helptext      = _("\
@@ -1109,9 +1109,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "IgWall"
 roles         = "AttackStrong"
 helptext      = _("\
@@ -1141,9 +1141,9 @@
 transport_cap = 0
 fuel          = 1
 uk_happy      = 0
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 targets       = "Air", "Missile" 
 flags         = "AirUnit", "Fighter"
 roles         = ""
@@ -1174,9 +1174,9 @@
 transport_cap = 0
 fuel          = 2
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 helptext      = _("\
@@ -1207,9 +1207,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "FieldUnit", "OneAttack", "Helicopter", "AirUnit"
 roles         = ""
 helptext      = _("\
@@ -1241,9 +1241,9 @@
 transport_cap = 0
 fuel          = 1
 uk_happy      = 0
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 targets       = "Air", "Missile"
 flags         = "Partial_Invis", "AirUnit", "Fighter"
 roles         = ""
@@ -1274,9 +1274,9 @@
 transport_cap = 0
 fuel          = 2
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "Partial_Invis", "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 helptext      = _("\
@@ -1306,9 +1306,9 @@
 transport_cap = 2
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 cargo         = "Land"
 flags         = "BadCityDefender", "No_Land_Attack"
 roles         = "Ferryboat"
@@ -1340,9 +1340,9 @@
 transport_cap = 3
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
@@ -1373,9 +1373,9 @@
 transport_cap = 4
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat", "BarbarianBoat"
@@ -1407,9 +1407,9 @@
 transport_cap = 2
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Hunter"
@@ -1441,9 +1441,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "BadCityDefender"
 roles         = "Hunter"
 helptext      = _("\
@@ -1474,9 +1474,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "BadCityDefender"
 roles         = "Hunter"
 helptext      = _("\
@@ -1508,9 +1508,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "BadCityDefender"
 roles         = "DefendGood"
 helptext      = _("\
@@ -1539,9 +1539,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "AEGIS", "BadCityDefender"
 roles         = "DefendGood"
 helptext      = _("\
@@ -1571,9 +1571,9 @@
 transport_cap = 0
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "BadCityDefender"
 roles         = ""
 helptext      = _("\
@@ -1603,9 +1603,9 @@
 transport_cap = 8
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 cargo         = "Missile"
 flags         = "Partial_Invis", "BadCityDefender",
 	        "No_Land_Attack"
@@ -1638,9 +1638,9 @@
 transport_cap = 8
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 cargo         = "Air", "Missile", "Helicopter"
 flags         = "BadCityDefender", "No_Land_Attack"
 roles         = ""
@@ -1675,9 +1675,9 @@
 transport_cap = 8
 fuel          = 0
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 cargo         = "Land"
 flags         = "BadCityDefender"
 roles         = "Ferryboat"
@@ -1708,9 +1708,9 @@
 transport_cap = 0
 fuel          = 1
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 helptext      = _("\
@@ -1743,9 +1743,9 @@
 transport_cap = 0
 fuel          = 1
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "FieldUnit", "OneAttack", "Nuclear", "AirUnit"
 roles         = ""
 helptext      = _("\
@@ -2055,9 +2055,9 @@
 transport_cap = 0
 fuel          = 2
 uk_happy      = 1
-uk_shield     = 1
+uk_shield     = 0
 uk_food       = 0
-uk_gold       = 0
+uk_gold       = 1
 flags         = "AirUnit"
 roles         = ""
 helptext      = _("\
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to