[Freeciv-Dev] (PR#14760) More govt generalization
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#14760) More govt generalization |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Sat, 3 Dec 2005 12:30:19 -0800 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14760 >
This pushes the last pieces of government special attributes over into
effects, that is production_*_bonus and production_*_penalty, adding two
new effects Output_Penalty_Tile and Output_Inc_Tile_Celebrate. The ability
to set a separate penalty for cities that celebrate is lost - it was never
used either.
I _think_ the results should be correct, and they looked that way on
testing, but please read over the patch and check, or even better,
playtest it for bugs.
- Per
Index: server/ruleset.c
===================================================================
--- server/ruleset.c (revision 11296)
+++ server/ruleset.c (working copy)
@@ -1715,24 +1715,6 @@
}
} output_type_iterate_end;
- output_type_iterate(o) {
- g->output_inc_tile[o]
- = secfile_lookup_int_default(file, 0, "%s.production_%s_bonus",
- sec[i], get_output_identifier(o));
- g->celeb_output_inc_tile[o]
- = secfile_lookup_int_default(file, 0, "%s.production_%s_bonus,1",
- sec[i], get_output_identifier(o));
-
- g->output_before_penalty[o]
- = secfile_lookup_int_default(file, FC_INFINITY,
- "%s.production_%s_penalty", sec[i],
- get_output_identifier(o));
- g->celeb_output_before_penalty[o]
- = secfile_lookup_int_default(file, FC_INFINITY,
- "%s.production_%s_penalty,1", sec[i],
- get_output_identifier(o));
- } output_type_iterate_end;
-
g->helptext = lookup_helptext(file, sec[i]);
} government_iterate_end;
@@ -2853,11 +2835,6 @@
gov.reqs_count = j;
output_type_iterate(o) {
- gov.output_before_penalty[o] = g->output_before_penalty[o];
- gov.celeb_output_before_penalty[o] = g->celeb_output_before_penalty[o];
- gov.output_inc_tile[o] = g->output_inc_tile[o];
- gov.celeb_output_inc_tile[o] = g->celeb_output_inc_tile[o];
-
gov.waste_level[o] = g->waste[o].level;
gov.fixed_waste_distance[o] = g->waste[o].fixed_distance;
gov.waste_distance_factor[o] = g->waste[o].distance_factor;
Index: data/default/effects.ruleset
===================================================================
--- data/default/effects.ruleset (revision 11296)
+++ data/default/effects.ruleset (working copy)
@@ -457,6 +457,58 @@
"UnitFlag", "Diplomat", "Local"
}
+[effect_gov_tile_bonus_0]
+name = "Output_Penalty_Tile"
+value = 2
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_gov_tile_bonus_1]
+name = "Output_Penalty_Tile"
+value = 2
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_gov_tile_bonus_2]
+name = "Output_Inc_Tile_Celebrate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "OutputType", "Trade", "Local"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_gov_tile_bonus_3]
+name = "Output_Inc_Tile_Celebrate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "OutputType", "Trade", "Local"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_gov_tile_bonus_4]
+name = "Output_Inc_Tile"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ "OutputType", "Trade", "Local"
+ }
+
+[effect_gov_tile_bonus_5]
+name = "Output_Inc_Tile"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ "OutputType", "Trade", "Local"
+ }
+
[effect_revolution_0]
name = "Revolution_When_Unhappy"
value = 1
Index: data/default/governments.ruleset
===================================================================
--- data/default/governments.ruleset (revision 11296)
+++ data/default/governments.ruleset (working copy)
@@ -62,11 +62,6 @@
; _max_distance_cap = cap to the max distance from the capital used in
; waste calculation
-; production_*_bonus = added to base production for each worked tile;
-; second value is used instead when city is celebrating
-; production_*_penalty = if non-zero, tile production above this amount is
-; reduced by one; second value used when celebrating
-
; ruler_titles = ruler titles by nation, "-" is default, and non-matched
; nations are ignored
@@ -93,14 +88,6 @@
waste_extra_distance = 0
waste_max_distance_cap = 36
-production_trade_bonus = 0, 0
-production_shield_bonus = 0, 0
-production_food_bonus = 0, 0
-
-production_trade_penalty = 2, 0
-production_shield_penalty = 2, 0
-production_food_penalty = 2, 0
-
ruler_male_title = _("Mr.")
ruler_female_title = _("Ms.")
@@ -135,14 +122,6 @@
waste_extra_distance = 0
waste_max_distance_cap = 36
-production_trade_bonus = 0, 0
-production_shield_bonus = 0, 0
-production_food_bonus = 0, 0
-
-production_trade_penalty = 2, 0
-production_shield_penalty = 2, 0
-production_food_penalty = 2, 0
-
ruler_male_title = _("Emperor")
ruler_female_title = _("Empress")
@@ -177,14 +156,6 @@
waste_extra_distance = 0
waste_max_distance_cap = 36
-production_trade_bonus = 0, 1
-production_shield_bonus = 0, 0
-production_food_bonus = 0, 0
-
-production_trade_penalty = 0, 0
-production_shield_penalty = 0, 0
-production_food_penalty = 0, 0
-
ruler_male_title = _("King")
ruler_female_title = _("Queen")
@@ -218,14 +189,6 @@
waste_extra_distance = 0
waste_max_distance_cap = 36
-production_trade_bonus = 0, 1
-production_shield_bonus = 0, 0
-production_food_bonus = 0, 0
-
-production_trade_penalty = 0, 0
-production_shield_penalty = 0, 0
-production_food_penalty = 0, 0
-
ruler_male_title = _("Comrade")
ruler_female_title = _("Comrade")
@@ -265,14 +228,6 @@
waste_extra_distance = 0
waste_max_distance_cap = 36
-production_trade_bonus = 1, 1
-production_shield_bonus = 0, 0
-production_food_bonus = 0, 0
-
-production_trade_penalty = 0, 0
-production_shield_penalty = 0, 0
-production_food_penalty = 0, 0
-
ruler_male_title = _("Consul")
ruler_female_title = _("Consul")
@@ -309,14 +264,6 @@
waste_extra_distance = 0
waste_max_distance_cap = 36
-production_trade_bonus = 1, 1
-production_shield_bonus = 0, 0
-production_food_bonus = 0, 0
-
-production_trade_penalty = 0, 0
-production_shield_penalty = 0, 0
-production_food_penalty = 0, 0
-
ruler_male_title = _("President")
ruler_female_title = _("President")
Index: common/packets.def
===================================================================
--- common/packets.def (revision 11296)
+++ common/packets.def (working copy)
@@ -1115,11 +1115,6 @@
UINT8 reqs_count;
REQUIREMENT reqs[MAX_NUM_REQS:reqs_count];
- UINT8 output_before_penalty[O_MAX];
- UINT8 celeb_output_before_penalty[O_MAX];
- UINT8 output_inc_tile[O_MAX];
- UINT8 celeb_output_inc_tile[O_MAX];
-
UINT16 waste_level[O_MAX];
UINT8 fixed_waste_distance[O_MAX];
UINT8 waste_distance_factor[O_MAX];
Index: common/city.c
===================================================================
--- common/city.c (revision 11296)
+++ common/city.c (working copy)
@@ -650,29 +650,26 @@
}
if (pcity) {
- struct government *g = get_gov_pcity(pcity);
- int before_penalty = (is_celebrating
- ? g->celeb_output_before_penalty[otype]
- : g->output_before_penalty[otype]);
-
prod += get_city_tile_output_bonus(pcity, ptile, output,
EFT_OUTPUT_ADD_TILE);
-
- /* Government & effect bonus/penalty. */
if (prod > 0) {
- prod += (is_celebrating
- ? g->celeb_output_inc_tile[otype]
- : g->output_inc_tile[otype]);
+ int penalty_limit = get_city_tile_output_bonus(pcity, ptile, output,
+ EFT_OUTPUT_PENALTY_TILE);
+
+ if (is_celebrating) {
+ prod += get_city_tile_output_bonus(pcity, ptile, output,
+ EFT_OUTPUT_INC_TILE_CELEBRATE);
+ }
prod += get_city_tile_output_bonus(pcity, ptile, output,
- EFT_OUTPUT_INC_TILE);
+ EFT_OUTPUT_INC_TILE);
+ prod += (prod
+ * get_city_tile_output_bonus(pcity, ptile, output,
+ EFT_OUTPUT_PER_TILE))
+ / 100;
+ if (!is_celebrating && penalty_limit > 0 && prod > penalty_limit) {
+ prod--;
+ }
}
-
- prod += (prod * get_city_tile_output_bonus(pcity, ptile, output,
- EFT_OUTPUT_PER_TILE)) / 100;
-
- if (before_penalty > 0 && prod > before_penalty) {
- prod--;
- }
}
if (contains_special(tile.special, S_POLLUTION)) {
Index: common/effects.c
===================================================================
--- common/effects.c (revision 11296)
+++ common/effects.c (working copy)
@@ -111,7 +111,9 @@
"Trade_Revenue_Bonus",
"Unhappy_Factor",
"Upkeep_Factor",
- "Unit_Upkeep_Free_Per_City"
+ "Unit_Upkeep_Free_Per_City",
+ "Output_Penalty_Tile",
+ "Output_Inc_Tile_Celebrate"
};
static bool initialized = FALSE;
Index: common/effects.h
===================================================================
--- common/effects.h (revision 11296)
+++ common/effects.h (working copy)
@@ -33,9 +33,9 @@
EFT_SPECIALIST_OUTPUT,
EFT_OUTPUT_BONUS,
EFT_OUTPUT_BONUS_2,
- EFT_OUTPUT_ADD_TILE,
- EFT_OUTPUT_INC_TILE,
- EFT_OUTPUT_PER_TILE,
+ EFT_OUTPUT_ADD_TILE, /* add to each worked tile */
+ EFT_OUTPUT_INC_TILE, /* add to each worked tile that already has output */
+ EFT_OUTPUT_PER_TILE, /* increase tile output by given % */
EFT_OUTPUT_WASTE_PCT,
EFT_FORCE_CONTENT,
/* TODO: EFT_FORCE_CONTENT_PCT, */
@@ -100,6 +100,8 @@
EFT_UNHAPPY_FACTOR, /* multiply unhappy upkeep by this effect */
EFT_UPKEEP_FACTOR, /* multiply upkeep by this effect */
EFT_UNIT_UPKEEP_FREE_PER_CITY, /* this many units are free from upkeep */
+ EFT_OUTPUT_PENALTY_TILE, /* -1 penalty to tiles producing more than this */
+ EFT_OUTPUT_INC_TILE_CELEBRATE,
EFT_LAST /* keep this last */
};
Index: ai/aicity.c
===================================================================
--- ai/aicity.c (revision 11296)
+++ ai/aicity.c (working copy)
@@ -345,7 +345,6 @@
case EFT_OUTPUT_PER_TILE:
case EFT_OUTPUT_WASTE_PCT:
case EFT_SPECIALIST_OUTPUT:
- case EFT_NO_DIPLOMACY:
break;
case EFT_CITY_VISION_RADIUS_SQ:
@@ -641,6 +640,9 @@
case EFT_INSPIRE_PARTISANS:
case EFT_HAPPINESS_TO_GOLD:
case EFT_FANATICS:
+ case EFT_NO_DIPLOMACY:
+ case EFT_OUTPUT_PENALTY_TILE:
+ case EFT_OUTPUT_INC_TILE_CELEBRATE:
case EFT_TRADE_REVENUE_BONUS:
break;
case EFT_LAST:
Index: client/packhand.c
===================================================================
--- client/packhand.c (revision 11296)
+++ client/packhand.c (working copy)
@@ -2259,11 +2259,6 @@
assert(gov->reqs.size == p->reqs_count);
output_type_iterate(o) {
- gov->output_before_penalty[o] = p->output_before_penalty[o];
- gov->celeb_output_before_penalty[o] = p->celeb_output_before_penalty[o];
- gov->output_inc_tile[o] = p->output_inc_tile[o];
- gov->celeb_output_inc_tile[o] = p->celeb_output_inc_tile[o];
-
gov->waste[o].level = p->waste_level[o];
gov->waste[o].fixed_distance = p->fixed_waste_distance[o];
gov->waste[o].distance_factor = p->waste_distance_factor[o];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#14760) More govt generalization,
Per I. Mathisen <=
|
|