Re: [Freeciv-Dev] (PR#37746) [Patch] Upgrade_Price_Pct effect
http://bugs.freeciv.org/Ticket/Display.html?id=37746 > On 3/8/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote: > > On 3/8/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote: > > > > This adds "Upgrade_Price_Pct" effect. > > - Improved documentation - AI effect evaluation - ML diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c --- freeciv/ai/aicity.c 2007-03-08 03:00:00.0 +0200 +++ freeciv/ai/aicity.c 2007-03-09 18:57:59.0 +0200 @@ -618,6 +618,10 @@ } } players_iterate_end; break; + case EFT_UPGRADE_PRICE_PCT: +/* This is based on average base upgrade price of 50. */ +v -= ai->stats.units.upgradeable * amount / 2; +break; /* Currently not supported for building AI - wait for modpack users */ case EFT_CITY_UNHAPPY_SIZE: case EFT_UNHAPPY_FACTOR: diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c --- freeciv/common/effects.c 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/effects.c 2007-03-09 18:46:33.0 +0200 @@ -115,7 +115,8 @@ "Output_Waste_By_Distance", "Output_Penalty_Tile", "Output_Inc_Tile_Celebrate", - "City_Unhappy_Size" + "City_Unhappy_Size", + "Upgrade_Price_Pct" }; static bool initialized = FALSE; diff -Nurd -X.diff_ignore freeciv/common/effects.h freeciv/common/effects.h --- freeciv/common/effects.h 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/effects.h 2007-03-09 18:46:33.0 +0200 @@ -104,6 +104,7 @@ EFT_OUTPUT_PENALTY_TILE, /* -1 penalty to tiles producing more than this */ EFT_OUTPUT_INC_TILE_CELEBRATE, EFT_CITY_UNHAPPY_SIZE, /* all citizens after this are unhappy */ + EFT_UPGRADE_PRICE_PCT, EFT_LAST /* keep this last */ }; diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c --- freeciv/common/unittype.c 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/unittype.c 2007-03-09 18:46:33.0 +0200 @@ -331,7 +331,11 @@ const struct unit_type *from, const struct unit_type *to) { - return unit_buy_gold_cost(to, unit_disband_shields(from)); + int base_cost = unit_buy_gold_cost(to, unit_disband_shields(from)); + + return base_cost +* (100 + get_player_bonus(pplayer, EFT_UPGRADE_PRICE_PCT)) +/ 100; } /** diff -Nurd -X.diff_ignore freeciv/doc/README.effects freeciv/doc/README.effects --- freeciv/doc/README.effects 2007-03-05 21:09:38.0 +0200 +++ freeciv/doc/README.effects 2007-03-09 18:46:33.0 +0200 @@ -287,3 +287,8 @@ Output_Inc_Tile_Celebrate Tiles get amount extra output when city working them is celebrating. + +Upgrade_Price_Pct +Increases unit upgrade cost by amount percent. This effect works at +player level. You cannot adjust upgrade costs for certain unit type or +for units upgraded in certain city. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#37746) [Patch] Upgrade_Price_Pct effect
http://bugs.freeciv.org/Ticket/Display.html?id=37746 > On 3/8/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote: > > This adds "Upgrade_Price_Pct" effect. - Improved documentation - ML diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c --- freeciv/common/effects.c 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/effects.c 2007-03-08 23:25:14.0 +0200 @@ -115,7 +115,8 @@ "Output_Waste_By_Distance", "Output_Penalty_Tile", "Output_Inc_Tile_Celebrate", - "City_Unhappy_Size" + "City_Unhappy_Size", + "Upgrade_Price_Pct" }; static bool initialized = FALSE; diff -Nurd -X.diff_ignore freeciv/common/effects.h freeciv/common/effects.h --- freeciv/common/effects.h 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/effects.h 2007-03-08 23:25:14.0 +0200 @@ -104,6 +104,7 @@ EFT_OUTPUT_PENALTY_TILE, /* -1 penalty to tiles producing more than this */ EFT_OUTPUT_INC_TILE_CELEBRATE, EFT_CITY_UNHAPPY_SIZE, /* all citizens after this are unhappy */ + EFT_UPGRADE_PRICE_PCT, EFT_LAST /* keep this last */ }; diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c --- freeciv/common/unittype.c 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/unittype.c 2007-03-08 23:25:14.0 +0200 @@ -331,7 +331,11 @@ const struct unit_type *from, const struct unit_type *to) { - return unit_buy_gold_cost(to, unit_disband_shields(from)); + int base_cost = unit_buy_gold_cost(to, unit_disband_shields(from)); + + return base_cost +* (100 + get_player_bonus(pplayer, EFT_UPGRADE_PRICE_PCT)) +/ 100; } /** diff -Nurd -X.diff_ignore freeciv/doc/README.effects freeciv/doc/README.effects --- freeciv/doc/README.effects 2007-03-05 21:09:38.0 +0200 +++ freeciv/doc/README.effects 2007-03-08 23:26:13.0 +0200 @@ -287,3 +287,8 @@ Output_Inc_Tile_Celebrate Tiles get amount extra output when city working them is celebrating. + +Upgrade_Price_Pct +Increases unit upgrade cost by amount percent. This effect works at +player level. You cannot adjust upgrade costs for certain unit type or +for units upgraded in certain city. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#37746) [Patch] Upgrade_Price_Pct effect
http://bugs.freeciv.org/Ticket/Display.html?id=37746 > This adds "Upgrade_Price_Pct" effect. - ML diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c --- freeciv/common/effects.c 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/effects.c 2007-03-08 03:54:30.0 +0200 @@ -115,7 +115,8 @@ "Output_Waste_By_Distance", "Output_Penalty_Tile", "Output_Inc_Tile_Celebrate", - "City_Unhappy_Size" + "City_Unhappy_Size", + "Upgrade_Price_Pct" }; static bool initialized = FALSE; diff -Nurd -X.diff_ignore freeciv/common/effects.h freeciv/common/effects.h --- freeciv/common/effects.h 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/effects.h 2007-03-08 03:54:24.0 +0200 @@ -104,6 +104,7 @@ EFT_OUTPUT_PENALTY_TILE, /* -1 penalty to tiles producing more than this */ EFT_OUTPUT_INC_TILE_CELEBRATE, EFT_CITY_UNHAPPY_SIZE, /* all citizens after this are unhappy */ + EFT_UPGRADE_PRICE_PCT, EFT_LAST /* keep this last */ }; diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c --- freeciv/common/unittype.c 2007-03-05 21:11:49.0 +0200 +++ freeciv/common/unittype.c 2007-03-08 03:54:10.0 +0200 @@ -331,7 +331,11 @@ const struct unit_type *from, const struct unit_type *to) { - return unit_buy_gold_cost(to, unit_disband_shields(from)); + int base_cost = unit_buy_gold_cost(to, unit_disband_shields(from)); + + return base_cost +* (100 + get_player_bonus(pplayer, EFT_UPGRADE_PRICE_PCT)) +/ 100; } /** diff -Nurd -X.diff_ignore freeciv/doc/README.effects freeciv/doc/README.effects --- freeciv/doc/README.effects 2007-03-05 21:09:38.0 +0200 +++ freeciv/doc/README.effects 2007-03-08 03:54:54.0 +0200 @@ -287,3 +287,6 @@ Output_Inc_Tile_Celebrate Tiles get amount extra output when city working them is celebrating. + +Upgrade_Price_Pct +Increases unit upgrade cost by amount percent. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev