[Freeciv-Dev] (PR#12706) Events framework
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12706 >
> [vasc - Fri Apr 29 20:30:36 2005]:
>
> This patch:
>
> * Renames scripts/ to scripting/.
> * Drops the store module, auto-saves variables of type Number, Boolean,
> String or the api Userdata types (e.g. Player, City).
> * Allows for embedding lua code in a savedgame (for scenarios).
> * i18n works (it worked on the last patch as well, but was untested).
Well, the patch is outdated again, sadly. Here's an updated version.
But it still doesn't compile.
One of the bits that didn't apply cleanly was in aidiplomat. This piece
of code looked really really wrong. So I changed it to
- || tile_get_city(pos.tile)
- || government_has_flag(get_gov_pplayer(unit_owner(pvictim)),
- G_UNBRIBABLE)) {
+ || (ptile->city && get_city_bonus(ptile->city, EFT_NO_INCITE) > 0)
+ || get_player_bonus(unit_owner(pvictim), EFT_NO_INCITE) > 0) {
the previous code you had there did a continue if EFT_NO_INCITE was 0
(!) or if there was not a city (!).
As I said I can't possible audit all the changes you've made to the AI.
A bug like this could go unseen for a long time. So I'd suggest you
reread all the AI bits before we commit this.
-jason
Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.130
diff -u -r1.130 advdomestic.c
--- ai/advdomestic.c 23 Apr 2005 17:40:21 -0000 1.130
+++ ai/advdomestic.c 29 Apr 2005 22:43:00 -0000
@@ -149,7 +149,7 @@
&& (pcity->id != ai->wonder_city
|| get_unit_type(unit_type)->pop_cost == 0)
&& pcity->surplus[O_FOOD] > utype_upkeep_cost(get_unit_type(unit_type),
- gov, O_FOOD)) {
+ pplayer, gov, O_FOOD)) {
/* The settler want is calculated in settlers.c called from
* ai_manage_cities. The expand value is the % that the AI should
* value expansion (basically to handicap easier difficutly levels)
@@ -181,7 +181,7 @@
&& (pcity->id != ai->wonder_city
|| get_unit_type(unit_type)->pop_cost == 0)
&& pcity->surplus[O_FOOD] >= utype_upkeep_cost(get_unit_type(unit_type),
- gov, O_FOOD)) {
+ pplayer, gov, O_FOOD)) {
/* founder_want calculated in settlers.c, called from ai_manage_cities().
*/
int want = pcity->ai.founder_want;
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.214
diff -u -r1.214 aicity.c
--- ai/aicity.c 29 Apr 2005 01:52:09 -0000 1.214
+++ ai/aicity.c 29 Apr 2005 22:43:01 -0000
@@ -346,7 +346,7 @@
case EFT_MAKE_HAPPY:
v += (get_entertainers(pcity) + pcity->ppl_unhappy[4]) * 5 * amount;
if (city_list_size(pplayer->cities)
- > game.cityfactor + gov->empire_size_mod) {
+ > game.cityfactor + get_player_bonus(pplayer,
EFT_EMPIRE_SIZE_MOD)) {
v += c * amount; /* offset large empire size */
}
v += c * amount;
@@ -359,16 +359,17 @@
break;
case EFT_FORCE_CONTENT:
case EFT_MAKE_CONTENT:
- if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
+ if (get_city_bonus(pcity, EFT_NO_UNHAPPY) <= 0) {
int factor = 2;
v += MIN(amount, pcity->ppl_unhappy[4] + get_entertainers(pcity)) *
35;
/* Try to build wonders to offset empire size unhappiness */
if (city_list_size(pplayer->cities)
- > game.cityfactor + gov->empire_size_mod) {
- if (gov->empire_size_mod > 0) {
- factor += city_list_size(pplayer->cities) /
gov->empire_size_inc;
+ > game.cityfactor + get_player_bonus(pplayer,
EFT_EMPIRE_SIZE_MOD)) {
+ if (get_player_bonus(pplayer, EFT_EMPIRE_SIZE_MOD) > 0) {
+ factor += city_list_size(pplayer->cities)
+ / get_player_bonus(pplayer, EFT_EMPIRE_SIZE_STEP);
}
factor += 2;
}
@@ -376,14 +377,14 @@
}
break;
case EFT_MAKE_CONTENT_MIL_PER:
- if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
+ if (get_city_bonus(pcity, EFT_NO_UNHAPPY) <= 0) {
v += MIN(pcity->ppl_unhappy[4] + get_entertainers(pcity),
amount) * 25;
v += MIN(amount, 5) * c;
}
break;
case EFT_MAKE_CONTENT_MIL:
- if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
+ if (get_city_bonus(pcity, EFT_NO_UNHAPPY) <= 0) {
v += pcity->ppl_unhappy[4] * amount
* MAX(unit_list_size(pcity->units_supported)
- gov->free_happy, 0) * 2;
@@ -564,7 +565,7 @@
v += (1 + ai->threats.invasions + !ai->threats.igwall) * c;
break;
case EFT_NO_INCITE:
- if (!government_has_flag(gov, G_UNBRIBABLE)) {
+ if (get_city_bonus(pcity, EFT_NO_INCITE) <= 0) {
v += MAX((game.diplchance * 2 - game.incite_cost.total_factor) / 2
- game.incite_cost.improvement_factor * 5
- game.incite_cost.unit_factor * 5, 0);
@@ -586,6 +587,22 @@
}
} players_iterate_end;
break;
+ /* Currently not supported for building AI - wait for modpack users */
+ case EFT_CIVIL_WAR_CHANCE:
+ case EFT_EMPIRE_SIZE_MOD:
+ case EFT_EMPIRE_SIZE_STEP:
+ case EFT_MAX_RATES:
+ case EFT_MARTIAL_LAW_EACH:
+ case EFT_MARTIAL_LAW_MAX:
+ case EFT_RAPTURE_GROW:
+ case EFT_UNBRIBABLE_UNITS:
+ case EFT_VETERAN_DIPLOMATS:
+ case EFT_REVOLUTION_WHEN_UNHAPPY:
+ case EFT_HAS_SENATE:
+ case EFT_INSPIRE_PARTISANS:
+ case EFT_HAPPINESS_TO_GOLD:
+ case EFT_FANATICS:
+ break;
case EFT_LAST:
freelog(LOG_ERROR, "Bad effect type.");
break;
Index: ai/aidiplomat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidiplomat.c,v
retrieving revision 1.49
diff -u -r1.49 aidiplomat.c
--- ai/aidiplomat.c 23 Apr 2005 17:40:21 -0000 1.49
+++ ai/aidiplomat.c 29 Apr 2005 22:43:01 -0000
@@ -459,9 +459,8 @@
if (!pvictim
|| !HOSTILE_PLAYER(pplayer, ai, unit_owner(pvictim))
|| unit_list_size(ptile->units) > 1
- || tile_get_city(pos.tile)
- || government_has_flag(get_gov_pplayer(unit_owner(pvictim)),
- G_UNBRIBABLE)) {
+ || (ptile->city && get_city_bonus(ptile->city, EFT_NO_INCITE) > 0)
+ || get_player_bonus(unit_owner(pvictim), EFT_NO_INCITE) > 0) {
continue;
}
Index: ai/aihand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aihand.c,v
retrieving revision 1.111
diff -u -r1.111 aihand.c
--- ai/aihand.c 12 Apr 2005 14:44:35 -0000 1.111
+++ ai/aihand.c 29 Apr 2005 22:43:01 -0000
@@ -96,10 +96,9 @@
static void ai_manage_taxes(struct player *pplayer)
{
int maxrate = (ai_handicap(pplayer, H_RATES)
- ? get_government_max_rate(pplayer->government) : 100);
+ ? get_player_bonus(pplayer, EFT_MAX_RATES) : 100);
bool celebrate = TRUE;
int can_celebrate = 0, total_cities = 0;
- struct government *g = get_gov_pplayer(pplayer);
int trade = 0; /* total amount of trade generated */
int expenses = 0; /* total amount of gold upkeep */
@@ -169,7 +168,8 @@
/* TODO: In the future, we should check if we should
* celebrate for other reasons than growth. Currently
* this is ignored. Maybe we need ruleset AI hints. */
- if (government_has_flag(g, G_RAPTURE_CITY_GROWTH)) {
+ /* TODO: Allow celebrate individual cities? No modpacks use this yet. */
+ if (get_player_bonus(pplayer, EFT_RAPTURE_GROW) > 0) {
int luxrate = pplayer->economic.luxury;
int scirate = pplayer->economic.science;
struct cm_parameter cmp;
@@ -196,7 +196,7 @@
if (cmr.found_a_valid
&& pcity->surplus[O_FOOD] > 0
- && pcity->size >= g->rapture_size
+ && pcity->size >= game.celebratesize
&& city_can_grow_to(pcity, pcity->size + 1)) {
pcity->ai.celebrate = TRUE;
can_celebrate++;
@@ -311,25 +311,13 @@
/* Bonuses for non-economic abilities. We increase val by
* a very small amount here to choose govt in cases where
* we have no cities yet. */
- if (government_has_flag(gov, G_BUILD_VETERAN_DIPLOMAT)) {
- bonus += 3; /* WAG */
- }
- if (government_has_flag(gov, G_REVOLUTION_WHEN_UNHAPPY)) {
- bonus -= 3; /* Not really a problem for us */ /* WAG */
- }
- if (government_has_flag(gov, G_UNBRIBABLE)) {
- bonus += 5; /* WAG */
- }
- if (government_has_flag(gov, G_INSPIRES_PARTISANS)) {
- bonus += 3; /* WAG */
- }
- if (government_has_flag(gov, G_RAPTURE_CITY_GROWTH)) {
- bonus += 5; /* WAG */
- val += 1;
- }
- if (government_has_flag(gov, G_FANATIC_TROOPS)) {
- bonus += 3; /* WAG */
- }
+ bonus += get_player_bonus(pplayer, EFT_VETERAN_DIPLOMATS) ? 3 : 0;
+ bonus -= get_player_bonus(pplayer, EFT_REVOLUTION_WHEN_UNHAPPY) ? 3 : 0;
+ bonus += get_player_bonus(pplayer, EFT_NO_INCITE) ? 4 : 0;
+ bonus += get_player_bonus(pplayer, EFT_UNBRIBABLE_UNITS) ? 2 : 0;
+ bonus += get_player_bonus(pplayer, EFT_INSPIRE_PARTISANS) ? 3 : 0;
+ bonus += get_player_bonus(pplayer, EFT_RAPTURE_GROW) ? 2 : 0;
+ bonus += get_player_bonus(pplayer, EFT_FANATICS) ? 3 : 0;
output_type_iterate(o) {
val += gov->output_inc_tile[o];
} output_type_iterate_end;
Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.106
diff -u -r1.106 helpdata.c
--- client/helpdata.c 23 Apr 2005 04:27:30 -0000 1.106
+++ client/helpdata.c 29 Apr 2005 22:43:01 -0000
@@ -1263,6 +1263,7 @@
for (j = 0; j < MAX_NUM_REQS; j++) {
insert_requirement(gov->req + j, buf, bufsz);
}
+#if 0
if (gov->max_rate < 100 && game.rgame.changable_tax) {
sprintf(buf + strlen(buf),
_("The maximum rate you can set for science, "
@@ -1313,6 +1314,7 @@
gov->free_happy);
}
}
+#endif
output_type_iterate(ot) {
if (gov->free_upkeep[ot] == G_CITY_SIZE_FREE) {
sprintf(buf + strlen(buf),
@@ -1406,6 +1408,7 @@
"waste.\n"), get_output_name(ot));
}
} output_type_iterate_end;
+#if 0
if (government_has_flag(gov, G_RAPTURE_CITY_GROWTH)) {
sprintf(buf + strlen(buf),
_("* You may grow your cities by "
@@ -1465,6 +1468,7 @@
_("* Buildings that normally confer "
"bonuses against unhappiness will instead give gold.\n"));
}
+#endif
unit_type_iterate(ut) {
struct unit_type *utype = get_unit_type(ut);
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.495
diff -u -r1.495 packhand.c
--- client/packhand.c 23 Apr 2005 17:40:23 -0000 1.495
+++ client/packhand.c 29 Apr 2005 22:43:02 -0000
@@ -2084,11 +2084,6 @@
game.notradesize = packet->notradesize;
game.fulltradesize = packet->fulltradesize;
- for(i=0; i<MAX_NUM_TECH_LIST; i++) {
- game.rtech.partisan_req[i] = packet->rtech_partisan_req[i];
- freelog(LOG_DEBUG, "techl %d: %d", i, game.rtech.partisan_req[i]);
- }
-
game.government_when_anarchy = packet->government_when_anarchy;
game.default_government = packet->default_government;
@@ -2286,14 +2281,6 @@
p->req_survives[j], p->req_value[j]);
}
- gov->max_rate = p->max_rate;
- gov->civil_war = p->civil_war;
- gov->martial_law_max = p->martial_law_max;
- gov->martial_law_per = p->martial_law_per;
- gov->empire_size_mod = p->empire_size_mod;
- gov->empire_size_inc = p->empire_size_inc;
- gov->rapture_size = p->rapture_size;
-
gov->unit_happy_cost_factor = p->unit_happy_cost_factor;
gov->free_happy = p->free_happy;
@@ -2313,7 +2300,6 @@
gov->waste[o].max_distance_cap = p->waste_max_distance_cap[o];
} output_type_iterate_end;
- gov->flags = p->flags;
gov->num_ruler_titles = p->num_ruler_titles;
sz_strlcpy(gov->name_orig, p->name);
@@ -2511,6 +2497,8 @@
{
int i;
+ game.rapturedelay = packet->rapturedelay;
+ game.celebratesize = packet->celebratesize;
/* Must set num_specialist_types before iterating over them. */
game.rgame.num_specialist_types = packet->num_specialist_types;
game.rgame.default_specialist = packet->default_specialist;
Index: client/repodlgs_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/repodlgs_common.c,v
retrieving revision 1.22
diff -u -r1.22 repodlgs_common.c
--- client/repodlgs_common.c 23 Apr 2005 17:40:23 -0000 1.22
+++ client/repodlgs_common.c 29 Apr 2005 22:43:02 -0000
@@ -99,8 +99,8 @@
unit_type_iterate(utype) {
unittype = get_unit_type(utype);
- cost = utype_upkeep_cost(unittype, get_gov_pplayer(game.player_ptr),
- O_GOLD);
+ cost = utype_upkeep_cost(unittype, game.player_ptr,
+ get_gov_pplayer(game.player_ptr), O_GOLD);
if (cost == 0) {
/* Short-circuit all of the following checks. */
Index: client/gui-gtk-2.0/gamedlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gamedlgs.c,v
retrieving revision 1.29
diff -u -r1.29 gamedlgs.c
--- client/gui-gtk-2.0/gamedlgs.c 8 Feb 2005 10:01:08 -0000 1.29
+++ client/gui-gtk-2.0/gamedlgs.c 29 Apr 2005 22:43:02 -0000
@@ -73,7 +73,7 @@
lux_lock = GTK_TOGGLE_BUTTON(rates_lux_toggle)->active;
sci_lock = GTK_TOGGLE_BUTTON(rates_sci_toggle)->active;
- maxrate=get_government_max_rate(game.player_ptr->government);
+ maxrate = get_player_bonus(game.player_ptr, EFT_MAX_RATES);
/* This's quite a simple-minded "double check".. */
tax=MIN(tax, maxrate);
lux=MIN(lux, maxrate);
@@ -335,7 +335,7 @@
my_snprintf(buf, sizeof(buf), _("%s max rate: %d%%"),
get_government_name(game.player_ptr->government),
- get_government_max_rate(game.player_ptr->government));
+ get_player_bonus(game.player_ptr, EFT_MAX_RATES));
gtk_label_set_text(GTK_LABEL(rates_gov_label), buf);
gtk_window_present(GTK_WINDOW(rates_dialog_shell));
Index: client/gui-gtk-2.0/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/happiness.c,v
retrieving revision 1.20
diff -u -r1.20 happiness.c
--- client/gui-gtk-2.0/happiness.c 28 Mar 2005 16:48:40 -0000 1.20
+++ client/gui-gtk-2.0/happiness.c 29 Apr 2005 22:43:02 -0000
@@ -221,11 +221,11 @@
struct city *pcity = pdialog->pcity;
struct player *pplayer = &game.players[pcity->owner];
- struct government *g = get_gov_pcity(pcity);
int cities = city_list_size(pplayer->cities);
int content = game.unhappysize;
- int basis = game.cityfactor + g->empire_size_mod;
- int step = g->empire_size_inc;
+ int basis = game.cityfactor
+ + get_player_bonus(game.player_ptr, EFT_EMPIRE_SIZE_MOD);
+ int step = get_player_bonus(game.player_ptr, EFT_EMPIRE_SIZE_STEP);
int excess = cities - basis;
int penalty = 0;
@@ -287,7 +287,7 @@
int nleft = sizeof(buf);
struct city *pcity = pdialog->pcity;
struct government *g = get_gov_pcity(pcity);
- int mlmax = g->martial_law_max;
+ int mlmax = get_city_bonus(pcity, EFT_MARTIAL_LAW_MAX);
int uhcfac = g->unit_happy_cost_factor;
my_snprintf(bptr, nleft, _("Units: "));
@@ -304,7 +304,8 @@
"%d units maximum, ", mlmax), mlmax);
bptr = end_of_strn(bptr, &nleft);
- my_snprintf(bptr, nleft, _("%d per unit). "), g->martial_law_per);
+ my_snprintf(bptr, nleft, _("%d per unit). "),
+ get_city_bonus(pcity, EFT_MARTIAL_LAW_EACH));
}
else if (uhcfac > 0) {
my_snprintf(bptr, nleft,
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.334
diff -u -r1.334 city.c
--- common/city.c 29 Apr 2005 01:52:09 -0000 1.334
+++ common/city.c 29 Apr 2005 22:43:03 -0000
@@ -1140,8 +1140,7 @@
**************************************************************************/
bool base_city_celebrating(const struct city *pcity)
{
- return (pcity->size >= get_gov_pcity(pcity)->rapture_size
- && pcity->was_happy);
+ return (pcity->size >= game.celebratesize && pcity->was_happy);
}
/**************************************************************************
@@ -1158,11 +1157,9 @@
**************************************************************************/
bool city_rapture_grow(const struct city *pcity)
{
- struct government *g = get_gov_pcity(pcity);
-
return (pcity->rapture > 0 && pcity->surplus[O_FOOD] > 0
&& (pcity->rapture % game.rapturedelay) == 0
- && government_has_flag(g, G_RAPTURE_CITY_GROWTH));
+ && get_city_bonus(pcity, EFT_RAPTURE_GROW) > 0);
}
/**************************************************************************
@@ -1574,8 +1571,8 @@
{
int cities = city_list_size(pplayer->cities);
int content = game.unhappysize;
- int basis = game.cityfactor + get_gov_pplayer(pplayer)->empire_size_mod;
- int step = get_gov_pplayer(pplayer)->empire_size_inc;
+ int basis = game.cityfactor + get_player_bonus(pplayer, EFT_EMPIRE_SIZE_MOD);
+ int step = get_player_bonus(pplayer, EFT_EMPIRE_SIZE_STEP);
if (cities > basis) {
content--;
@@ -1614,8 +1611,7 @@
{
int tithes_bonus = 0;
- if (!government_has_flag(get_gov_pcity(pcity),
- G_CONVERT_TITHES_TO_MONEY)) {
+ if (!get_city_bonus(pcity, EFT_HAPPINESS_TO_GOLD)) {
return 0;
}
@@ -1961,8 +1957,7 @@
}
/* The rest falls through and lets unhappy people become content. */
- if (get_city_bonus(pcity, EFT_NO_UNHAPPY) > 0
- || government_has_flag(get_gov_pcity(pcity), G_NO_UNHAPPY_CITIZENS)) {
+ if (get_city_bonus(pcity, EFT_NO_UNHAPPY) > 0) {
*content += *unhappy + *angry;
*unhappy = 0;
*angry = 0;
@@ -2118,6 +2113,7 @@
void (*send_unit_info) (struct player *pplayer,
struct unit *punit))
{
+ struct player *plr = city_owner(pcity);
struct government *g = get_gov_pcity(pcity);
int free_happy = citygov_free_happy(pcity, g);
@@ -2151,15 +2147,15 @@
/* military units in this city (need _not_ be home city) can make
unhappy citizens content
*/
- if (g->martial_law_max > 0) {
+ if (get_city_bonus(pcity, EFT_MARTIAL_LAW_MAX) > 0) {
unit_list_iterate(pcity->tile->units, punit) {
- if (pcity->martial_law < g->martial_law_max
+ if (pcity->martial_law < get_city_bonus(pcity, EFT_MARTIAL_LAW_MAX)
&& is_military_unit(punit)
&& punit->owner == pcity->owner) {
pcity->martial_law++;
}
} unit_list_iterate_end;
- pcity->martial_law *= g->martial_law_per;
+ pcity->martial_law *= get_city_bonus(pcity, EFT_MARTIAL_LAW_EACH);
}
/* loop over units, subtracting appropriate amounts of food, shields,
@@ -2174,7 +2170,7 @@
int old_unhappiness = this_unit->unhappiness;
output_type_iterate(o) {
- upkeep_cost[o] = utype_upkeep_cost(ut, g, o);
+ upkeep_cost[o] = utype_upkeep_cost(ut, plr, g, o);
old_upkeep[o] = this_unit->upkeep[o];
} output_type_iterate_end;
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.32
diff -u -r1.32 effects.c
--- common/effects.c 29 Apr 2005 01:52:09 -0000 1.32
+++ common/effects.c 29 Apr 2005 22:43:03 -0000
@@ -124,9 +124,25 @@
"No_Incite",
"Regen_Reputation",
"Gain_AI_Love",
- "Slow_Down_Timeline"
+ "Slow_Down_Timeline",
+ "Civil_War_Chance",
+ "Empire_Size_Mod",
+ "Empire_Size_Step",
+ "Max_Rates",
+ "Martial_Law_Each",
+ "Martial_Law_Max",
+ "Rapture_Grow",
+ "Unbribable_Units",
+ "Veteran_Diplomats",
+ "Revolution_When_Unhappy",
+ "Has_Senate",
+ "Inspire_Partisans",
+ "Happiness_To_Gold",
+ "Fanatics"
};
+static bool initialized = FALSE;
+
/**************************************************************************
Convert effect type names to enum; case insensitive;
returns EFT_LAST if can't match.
@@ -346,6 +362,8 @@
{
int i;
+ initialized = TRUE;
+
ruleset_cache.tracker = effect_list_new();
for (i = 0; i < ARRAY_SIZE(ruleset_cache.effects); i++) {
@@ -719,6 +737,10 @@
**************************************************************************/
int get_world_bonus(enum effect_type effect_type)
{
+ if (!initialized) {
+ return 0;
+ }
+
return get_target_bonus_effects(NULL,
NULL, NULL, NULL, NULL, effect_type);
}
@@ -729,7 +751,10 @@
int get_player_bonus(const struct player *pplayer,
enum effect_type effect_type)
{
- assert(pplayer != NULL);
+ if (!initialized) {
+ return 0;
+ }
+
return get_target_bonus_effects(NULL,
pplayer, NULL, NULL, NULL,
effect_type);
@@ -740,7 +765,10 @@
**************************************************************************/
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
{
- assert(pcity != NULL);
+ if (!initialized) {
+ return 0;
+ }
+
return get_target_bonus_effects(NULL,
city_owner(pcity), pcity, NULL, NULL,
effect_type);
Index: common/effects.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.h,v
retrieving revision 1.19
diff -u -r1.19 effects.h
--- common/effects.h 29 Apr 2005 01:52:09 -0000 1.19
+++ common/effects.h 29 Apr 2005 22:43:03 -0000
@@ -112,6 +112,20 @@
EFT_REGEN_REPUTATION,
EFT_GAIN_AI_LOVE,
EFT_SLOW_DOWN_TIMELINE,
+ EFT_CIVIL_WAR_CHANCE,
+ EFT_EMPIRE_SIZE_MOD,
+ EFT_EMPIRE_SIZE_STEP,
+ EFT_MAX_RATES,
+ EFT_MARTIAL_LAW_EACH,
+ EFT_MARTIAL_LAW_MAX,
+ EFT_RAPTURE_GROW,
+ EFT_UNBRIBABLE_UNITS,
+ EFT_VETERAN_DIPLOMATS,
+ EFT_REVOLUTION_WHEN_UNHAPPY,
+ EFT_HAS_SENATE,
+ EFT_INSPIRE_PARTISANS,
+ EFT_HAPPINESS_TO_GOLD,
+ EFT_FANATICS, /* stupid special case, we hatess it */
EFT_LAST /* keep this last */
};
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.207
diff -u -r1.207 game.c
--- common/game.c 27 Apr 2005 16:31:46 -0000 1.207
+++ common/game.c 29 Apr 2005 22:43:03 -0000
@@ -214,6 +214,7 @@
game.civilwarsize= GAME_DEFAULT_CIVILWARSIZE;
game.contactturns= GAME_DEFAULT_CONTACTTURNS;
game.rapturedelay= GAME_DEFAULT_RAPTUREDELAY;
+ game.celebratesize= GAME_DEFAULT_CELEBRATESIZE;
game.savepalace = GAME_DEFAULT_SAVEPALACE;
game.natural_city_names = GAME_DEFAULT_NATURALCITYNAMES;
game.unhappysize = GAME_DEFAULT_UNHAPPYSIZE;
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.181
diff -u -r1.181 game.h
--- common/game.h 21 Apr 2005 00:28:27 -0000 1.181
+++ common/game.h 29 Apr 2005 22:43:03 -0000
@@ -95,6 +95,7 @@
int civilwarsize;
int contactturns;
int rapturedelay;
+ int celebratesize; /* size limit for cities before they can celebrate */
int min_players, max_players, nplayers;
int aifill;
int notradesize, fulltradesize;
@@ -177,17 +178,6 @@
Impr_Type_id palace_building;
Impr_Type_id land_defend_building;
- struct {
- int u_partisan; /* convenience: tech_req for first
- Partisan unit */
- /* Following tech list is A_LAST terminated if shorter than
- max len, and the techs listed are guaranteed to exist;
- this could be better implemented as a new field in the
- units.ruleset
- */
- int partisan_req[MAX_NUM_TECH_LIST]; /* all required for uprisings */
- } rtech;
-
/* values from game.ruleset */
struct {
int num_specialist_types;
@@ -390,6 +380,8 @@
#define GAME_MIN_CONTACTTURNS 0
#define GAME_MAX_CONTACTTURNS 100
+#define GAME_DEFAULT_CELEBRATESIZE 3
+
#define GAME_DEFAULT_RAPTUREDELAY 1
#define GAME_MIN_RAPTUREDELAY 1
#define GAME_MAX_RAPTUREDELAY 99 /* 99 practicaly disables rapturing */
Index: common/government.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.c,v
retrieving revision 1.53
diff -u -r1.53 government.c
--- common/government.c 29 Apr 2005 01:52:09 -0000 1.53
+++ common/government.c 29 Apr 2005 22:43:03 -0000
@@ -29,40 +29,6 @@
struct government *governments = NULL;
-static const char *flag_names[] = {
- "Build_Veteran_Diplomats", "Revolution_When_Unhappy", "Has_Senate",
- "Unbribable", "Inspires_Partisans", "Rapture_City_Growth",
- "Fanatic_Troops", "No_Unhappy_Citizens", "Convert_Tithes_To_Money"
-};
-
-/***************************************************************
- Convert flag names to enum; case insensitive;
- returns G_LAST_FLAG if can't match.
-***************************************************************/
-enum government_flag_id government_flag_from_str(const char *s)
-{
- enum government_flag_id i;
-
- assert(ARRAY_SIZE(flag_names) == G_LAST_FLAG);
-
- for(i=G_FIRST_FLAG; i<G_LAST_FLAG; i++) {
- if (mystrcasecmp(flag_names[i], s)==0) {
- return i;
- }
- }
- return G_LAST_FLAG;
-}
-
-/****************************************************************************
- Returns TRUE iff the given government has the given flag.
-****************************************************************************/
-bool government_has_flag(const struct government *gov,
- enum government_flag_id flag)
-{
- assert(flag>=G_FIRST_FLAG && flag<G_LAST_FLAG);
- return TEST_BIT(gov->flags, flag);
-}
-
/****************************************************************************
Does a linear search of the governments to find the one that matches the
given (translated) name. Returns NULL if none match.
@@ -155,28 +121,6 @@
/***************************************************************
...
***************************************************************/
-int get_government_max_rate(int type)
-{
- if(type == G_MAGIC)
- return 100;
- if(type >= 0 && type < game.government_count)
- return governments[type].max_rate;
- return 50;
-}
-
-/***************************************************************
-Added for civil war probability computation - Kris Bubendorfer
-***************************************************************/
-int get_government_civil_war_prob(int type)
-{
- if(type >= 0 && type < game.government_count)
- return governments[type].civil_war;
- return 0;
-}
-
-/***************************************************************
-...
-***************************************************************/
const char *get_government_name(int type)
{
if(type >= 0 && type < game.government_count)
Index: common/government.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/government.h,v
retrieving revision 1.43
diff -u -r1.43 government.h
--- common/government.h 21 Apr 2005 21:37:34 -0000 1.43
+++ common/government.h 29 Apr 2005 22:43:03 -0000
@@ -18,27 +18,11 @@
#include "fc_types.h"
#include "requirements.h"
-#define G_MAGIC (127) /* magic constant, used as flag value */
+#define G_MAGIC (127) /* magic constant */
/* special values for free_* fields -- SKi */
#define G_CITY_SIZE_FREE G_MAGIC
-/* Changing these will break network compatibility. */
-enum government_flag_id {
- G_BUILD_VETERAN_DIPLOMAT=0, /* and Spies (in general: all F_DIPLOMAT) */
- G_REVOLUTION_WHEN_UNHAPPY,
- G_HAS_SENATE, /* not implemented */
- G_UNBRIBABLE,
- G_INSPIRES_PARTISANS,
- G_RAPTURE_CITY_GROWTH, /* allows city to grow by celebrating */
- G_FANATIC_TROOPS, /* for building troops with F_FANATIC flag */
- G_NO_UNHAPPY_CITIZENS, /* no unhappy citizen, needed by
- fundamentism */
- G_CONVERT_TITHES_TO_MONEY, /* tithes to money, needed by fundamentalism */
- G_LAST_FLAG
-};
-#define G_FIRST_FLAG G_BUILD_VETERAN_DIPLOMAT
-
/* each government has a list of ruler titles, where at least
* one entry should have nation=DEFAULT_TITLE.
*/
@@ -72,22 +56,6 @@
struct ruler_title *ruler_titles;
int num_ruler_titles;
- int max_rate; /* max individual Tax/Lux/Sci rate */
- int civil_war; /* chance (from 100) of civil war in
- right conditions */
- int martial_law_max; /* maximum number of units which can
- enforce martial law */
- int martial_law_per; /* number of unhappy citizens made
- content by each enforcer unit */
- int empire_size_mod; /* (signed) offset to game.cityfactor to
- give city count when number of naturally
- content citizens is decreased */
- int empire_size_inc; /* if non-zero, reduce one content citizen for
- every empire_size_inc cities once #cities
- exceeds game.cityfactor + empire_size_mod */
- int rapture_size; /* minimum city size for rapture; if 255,
- rapture is (practically) impossible */
-
/* unit cost modifiers */
int unit_happy_cost_factor;
int unit_upkeep_factor[O_MAX];
@@ -116,10 +84,6 @@
int max_distance_cap;
} waste[O_MAX];
- /* other flags: bits in enum government_flag_id order,
- use government_has_flag() to access */
- int flags;
-
char *helptext;
};
@@ -132,12 +96,6 @@
struct government *find_government_by_name(const char *name);
struct government *find_government_by_name_orig(const char *name);
-enum government_flag_id government_flag_from_str(const char *s);
-bool government_has_flag(const struct government *gov,
- enum government_flag_id flag);
-
-int get_government_max_rate(int type);
-int get_government_civil_war_prob(int type);
const char *get_government_name(int type);
const char *get_ruler_title(int gov, bool male, int nation);
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.108
diff -u -r1.108 packets.def
--- common/packets.def 23 Apr 2005 04:26:57 -0000 1.108
+++ common/packets.def 29 Apr 2005 22:43:03 -0000
@@ -1013,6 +1013,8 @@
YEAR tech_cost_double_year;
UINT8 tech_leakage;
TECH_LIST global_init_techs[MAX_NUM_TECH_LIST];
+ UINT8 rapturedelay;
+ UINT8 celebratesize;
UINT8 autoupgrade_veteran_loss;
BOOL killstack;
@@ -1049,14 +1051,6 @@
UINT32 req_value[MAX_NUM_REQS];
BOOL req_survives[MAX_NUM_REQS];
- UINT8 max_rate;
- UINT8 civil_war;
- UINT8 martial_law_max;
- UINT8 martial_law_per;
- SINT8 empire_size_mod;
- UINT8 empire_size_inc;
- UINT8 rapture_size;
-
UINT8 unit_happy_cost_factor;
UINT8 unit_upkeep_factor[O_MAX];
@@ -1074,8 +1068,6 @@
UINT8 extra_waste_distance[O_MAX];
UINT8 waste_max_distance_cap[O_MAX];
- UINT16 flags;
-
UINT8 num_ruler_titles;
STRING name[MAX_LEN_NAME];
@@ -1220,7 +1212,6 @@
UINT8 num_unit_types;
UINT8 num_impr_types;
UINT8 num_tech_types;
- TECH_LIST rtech_partisan_req[MAX_NUM_TECH_LIST];
UINT8 government_when_anarchy;
UINT8 default_government;
UINT8 government_count;
Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.174
diff -u -r1.174 player.c
--- common/player.c 23 Apr 2005 17:40:27 -0000 1.174
+++ common/player.c 29 Apr 2005 22:43:03 -0000
@@ -439,7 +439,10 @@
return;
}
- maxrate = get_government_max_rate(pplayer->government);
+ maxrate = get_player_bonus(pplayer, EFT_MAX_RATES);
+ if (maxrate == 0) {
+ maxrate = 100; /* effects not initialized yet */
+ }
surplus = 0;
if (pplayer->economic.luxury > maxrate) {
surplus += pplayer->economic.luxury - maxrate;
Index: common/unittype.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.c,v
retrieving revision 1.54
diff -u -r1.54 unittype.c
--- common/unittype.c 16 Apr 2005 04:44:36 -0000 1.54
+++ common/unittype.c 29 Apr 2005 22:43:03 -0000
@@ -85,11 +85,11 @@
/**************************************************************************
Returns the upkeep of a unit of this type under the given government.
**************************************************************************/
-int utype_upkeep_cost(const struct unit_type *ut,
+int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer,
const struct government *g, Output_type_id otype)
{
- if (government_has_flag(g, G_FANATIC_TROOPS) &&
- BV_ISSET(ut->flags, F_FANATIC)) {
+ if (get_player_bonus(pplayer, EFT_FANATICS)
+ && BV_ISSET(ut->flags, F_FANATIC)) {
/* Special case: fanatics have no upkeep under fanaticism. */
return 0;
}
@@ -410,10 +410,6 @@
&& unit_types[id].gov_requirement != p->government) {
return FALSE;
}
- if (unit_type_flag(id, F_FANATIC)
- && !government_has_flag(get_gov_pplayer(p), G_FANATIC_TROOPS)) {
- return FALSE;
- }
if (get_invention(p,unit_types[id].tech_requirement) != TECH_KNOWN) {
return FALSE;
}
Index: common/unittype.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.h,v
retrieving revision 1.45
diff -u -r1.45 unittype.h
--- common/unittype.h 13 Apr 2005 02:13:49 -0000 1.45
+++ common/unittype.h 29 Apr 2005 22:43:03 -0000
@@ -237,8 +237,8 @@
const char *get_unit_name(Unit_Type_id id);
const char *get_units_with_flag_string(int flag);
-int utype_upkeep_cost(const struct unit_type *ut,
- const struct government *gov, Output_type_id otype);
+int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer,
+ const struct government *g, Output_type_id otype);
int utype_happy_cost(const struct unit_type *ut, const struct government *g);
int can_upgrade_unittype(const struct player *pplayer, Unit_Type_id id);
Index: data/civ1/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/effects.ruleset,v
retrieving revision 1.4
diff -u -r1.4 effects.ruleset
--- data/civ1/effects.ruleset 14 Apr 2005 04:49:14 -0000 1.4
+++ data/civ1/effects.ruleset 29 Apr 2005 22:43:04 -0000
@@ -16,6 +16,272 @@
; /* <-- avoid gettext warnings
; */ <-- avoid gettext warnings
+[effect_civil_war_0]
+name = "Civil_War_Chance"
+value = 90
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_civil_war_1]
+name = "Civil_War_Chance"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_civil_war_2]
+name = "Civil_War_Chance"
+value = 70
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_civil_war_3]
+name = "Civil_War_Chance"
+value = 50
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_civil_war_4]
+name = "Civil_War_Chance"
+value = 40
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_civil_war_5]
+name = "Civil_War_Chance"
+value = 30
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_empire_size_mod_0]
+; base value
+name = "Empire_Size_Mod"
+value = -5
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_empire_size_mod_1]
+name = "Empire_Size_Mod"
+value = -4
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_empire_size_mod_2]
+name = "Empire_Size_Mod"
+value = -3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_empire_size_mod_3]
+name = "Empire_Size_Mod"
+value = -2
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_empire_size_mod_4]
+name = "Empire_Size_Mod"
+value = -1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_max_rates_0]
+name = "Max_Rates"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_max_rates_1]
+name = "Max_Rates"
+value = 60
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_max_rates_2]
+name = "Max_Rates"
+value = 70
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_max_rates_3]
+name = "Max_Rates"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_max_rates_4]
+name = "Max_Rates"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_max_rates_5]
+name = "Max_Rates"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_martial_law_each_0]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_martial_law_each_1]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_martial_law_each_2]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_martial_law_each_3]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_martial_law_max_0]
+name = "Martial_Law_Max"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_martial_law_max_1]
+name = "Martial_Law_Max"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_martial_law_max_2]
+name = "Martial_Law_Max"
+value = 3
+reqs =
+
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_martial_law_max_3]
+name = "Martial_Law_Max"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_rapture_grow_0]
+name = "Rapture_Grow"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_rapture_grow_1]
+name = "Rapture_Grow"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_democracy_0]
+name = "Unbribable_Units"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_democracy_1]
+name = "No_Incite"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_communism_0]
+name = "Veteran_Diplomats"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_revolution_0]
+name = "Revolution_When_Unhappy"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_senate_0]
+name = "Has_Senate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_senate_1]
+name = "Has_Senate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
; Base max city size of 10
[effect_aqueduct_size]
name = "Size_Adj"
Index: data/civ1/governments.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/governments.ruleset,v
retrieving revision 1.24
diff -u -r1.24 governments.ruleset
--- data/civ1/governments.ruleset 28 Mar 2005 17:14:58 -0000 1.24
+++ data/civ1/governments.ruleset 29 Apr 2005 22:43:04 -0000
@@ -38,23 +38,6 @@
; graphic_alt = alternate graphics tag if preferred is not found;
; should be a standard tag if preferred is not;
; otherwise may be "-"
-; flags = special effects; see government.c for strings
-
-; martial_law_max = maximum number of units which can enforce martial law
-; in the city
-; martial_law_per = number of unhappy citizens made content by each
-; enforcer unit
-; max_single_rate = maximum which can be allocated to single one of
-; taxation/luxuries/science
-; empire_size_mod = signed modifier added to cityfactor to determine
-; empire size when base unhappiness is increased
-; empire_size_inc = if non-zero, reduce one content citizen for
-; every empire_size_inc cities once #cities
-; exceeds (cityfactor + empire_size_mod)
-; civil_war_chance = percentage change of civil war when capital is captured
-; (and player has enough cities etc)
-; rapture_size = a happy city will celebrate when its size is
-; this value or larger
; unit_*_factor = factor applied to individual unit upkeep for different
; upkeep forms
@@ -103,16 +86,6 @@
; No reqs
graphic = "gov.anarchy"
graphic_alt = "-"
-flags = "-"
-
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 100 ; rates are irrelevant under Anarchy; use 100
- ; to avoid unnecessary changes during revolution
-civil_war_chance = 90
-empire_size_mod = -5
-empire_size_inc = 0
-rapture_size = 3
unit_unhappy_factor = 0
unit_shield_factor = 1
@@ -178,17 +151,8 @@
; No reqs
graphic = "gov.despotism"
graphic_alt = "-"
-flags = "-"
ai_better = "Monarchy"
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 100
-civil_war_chance = 80
-empire_size_mod = -4
-empire_size_inc = 0
-rapture_size = 3
-
unit_unhappy_factor = 0
unit_shield_factor = 1
unit_food_factor = 1
@@ -254,17 +218,8 @@
}
graphic = "gov.monarchy"
graphic_alt = "-"
-flags = "-"
ai_better = "Communism"
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 100
-civil_war_chance = 70
-empire_size_mod = -3
-empire_size_inc = 0
-rapture_size = 3
-
unit_unhappy_factor = 0
unit_shield_factor = 1
unit_food_factor = 1
@@ -328,15 +283,6 @@
}
graphic = "gov.communism"
graphic_alt = "-"
-flags = "Build_Veteran_Diplomats"
-
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 100
-civil_war_chance = 50
-empire_size_mod = -2
-empire_size_inc = 0
-rapture_size = 3
unit_unhappy_factor = 0
unit_shield_factor = 1
@@ -409,15 +355,6 @@
}
graphic = "gov.republic"
graphic_alt = "-"
-flags = "Has_Senate", "Rapture_City_Growth"
-
-martial_law_max = 0
-martial_law_per = 0
-max_single_rate = 100
-civil_war_chance = 40
-empire_size_mod = -1
-empire_size_inc = 0
-rapture_size = 3
unit_unhappy_factor = 1
unit_shield_factor = 1
@@ -493,15 +430,6 @@
}
graphic = "gov.democracy"
graphic_alt = "-"
-flags = "Has_Senate", "Revolution_When_Unhappy", "Rapture_City_Growth"
-
-martial_law_max = 0
-martial_law_per = 0
-max_single_rate = 100
-civil_war_chance = 30
-empire_size_mod = 0
-empire_size_inc = 0
-rapture_size = 3
unit_unhappy_factor = 2
unit_shield_factor = 1
Index: data/civ2/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/effects.ruleset,v
retrieving revision 1.6
diff -u -r1.6 effects.ruleset
--- data/civ2/effects.ruleset 21 Apr 2005 22:53:13 -0000 1.6
+++ data/civ2/effects.ruleset 29 Apr 2005 22:43:04 -0000
@@ -16,6 +16,331 @@
; /* <-- avoid gettext warnings
; */ <-- avoid gettext warnings
+[effect_civil_war_0]
+name = "Civil_War_Chance"
+value = 90
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_civil_war_1]
+name = "Civil_War_Chance"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_civil_war_2]
+name = "Civil_War_Chance"
+value = 70
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_civil_war_3]
+name = "Civil_War_Chance"
+value = 50
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_civil_war_4]
+name = "Civil_War_Chance"
+value = 40
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_civil_war_5]
+name = "Civil_War_Chance"
+value = 30
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_empire_size_mod_0]
+; base value
+name = "Empire_Size_Mod"
+value = -6
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_empire_size_mod_1]
+name = "Empire_Size_Mod"
+value = -6
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_empire_size_mod_2]
+name = "Empire_Size_Mod"
+value = -3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_empire_size_mod_3]
+name = "Empire_Size_Mod"
+value = 127 ; unlimited
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_empire_size_mod_4]
+name = "Empire_Size_Mod"
+value = 3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_empire_size_step_0]
+name = "Empire_Size_Step"
+value = 6
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_empire_size_step_1]
+name = "Empire_Size_Step"
+value = 6
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_empire_size_step_2]
+name = "Empire_Size_Step"
+value = 9
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_empire_size_step_3]
+name = "Empire_Size_Step"
+value = 12
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_empire_size_step_4]
+name = "Empire_Size_Step"
+value = 12
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_max_rates_0]
+name = "Max_Rates"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_max_rates_1]
+name = "Max_Rates"
+value = 60
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_max_rates_2]
+name = "Max_Rates"
+value = 70
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_max_rates_3]
+name = "Max_Rates"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_max_rates_4]
+name = "Max_Rates"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_max_rates_5]
+name = "Max_Rates"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_martial_law_each_0]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_martial_law_each_1]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_martial_law_each_2]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_martial_law_each_3]
+name = "Martial_Law_Each"
+value = 2
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_martial_law_max_0]
+name = "Martial_Law_Max"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_martial_law_max_1]
+name = "Martial_Law_Max"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_martial_law_max_2]
+name = "Martial_Law_Max"
+value = 3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_martial_law_max_3]
+name = "Martial_Law_Max"
+value = 3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_rapture_grow_0]
+name = "Rapture_Grow"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_rapture_grow_1]
+name = "Rapture_Grow"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_democracy_0]
+name = "Unbribable_Units"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_democracy_1]
+name = "No_Incite"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_communism_0]
+name = "Veteran_Diplomats"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_revolution_0]
+name = "Revolution_When_Unhappy"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_senate_0]
+name = "Has_Senate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_senate_1]
+name = "Has_Senate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_partisan_0]
+name = "Inspire_Partisans"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ "Tech", "Communism", "Player"
+ "Tech", "Gunpowder", "Player"
+ }
+
+[effect_partisan_1]
+name = "Inspire_Partisans"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ "Tech", "Communism", "Player"
+ "Tech", "Gunpowder", "Player"
+ }
+
[effect_fundamentalism]
name = "Science_Bonus_2"
value = -50
Index: data/civ2/governments.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/governments.ruleset,v
retrieving revision 1.33
diff -u -r1.33 governments.ruleset
--- data/civ2/governments.ruleset 21 Apr 2005 21:37:34 -0000 1.33
+++ data/civ2/governments.ruleset 29 Apr 2005 22:43:04 -0000
@@ -36,23 +36,6 @@
; graphic_alt = alternate graphics tag if preferred is not found;
; should be a standard tag if preferred is not;
; otherwise may be "-"
-; flags = special effects; see government.c for strings
-
-; martial_law_max = maximum number of units which can enforce martial law
-; in the city
-; martial_law_per = number of unhappy citizens made content by each
-; enforcer unit
-; max_single_rate = maximum which can be allocated to single one of
-; taxation/luxuries/science
-; empire_size_mod = signed modifier added to cityfactor to determine
-; empire size when base unhappiness is increased
-; empire_size_inc = if non-zero, reduce one content citizen for
-; every empire_size_inc cities once #cities
-; exceeds (cityfactor + empire_size_mod)
-; civil_war_chance = percentage change of civil war when capital is captured
-; (and player has enough cities etc)
-; rapture_size = a happy city will celebrate when its size is
-; this value or larger
; unit_*_factor = factor applied to individual unit upkeep for different
; upkeep forms
@@ -100,16 +83,6 @@
; No reqs
graphic = "gov.anarchy"
graphic_alt = "-"
-flags = "-"
-
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 100 ; rates are irrelevant under Anarchy; use 100
- ; to avoid unnecessary changes during revolution
-civil_war_chance = 90
-empire_size_mod = -6
-empire_size_inc = 6
-rapture_size = 3
unit_unhappy_factor = 0
unit_shield_factor = 1
@@ -175,17 +148,8 @@
; No reqs
graphic = "gov.despotism"
graphic_alt = "-"
-flags = "-"
ai_better = "Monarchy"
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 60
-civil_war_chance = 80
-empire_size_mod = -6
-empire_size_inc = 6
-rapture_size = 3
-
unit_unhappy_factor = 0
unit_shield_factor = 1
unit_food_factor = 1
@@ -253,17 +217,8 @@
}
graphic = "gov.monarchy"
graphic_alt = "-"
-flags = "-"
ai_better = "Communism"
-martial_law_max = 3
-martial_law_per = 1
-max_single_rate = 70
-civil_war_chance = 70
-empire_size_mod = -3
-empire_size_inc = 9
-rapture_size = 3
-
unit_unhappy_factor = 0
unit_shield_factor = 1
unit_food_factor = 1
@@ -330,15 +285,6 @@
}
graphic = "gov.communism"
graphic_alt = "-"
-flags = "Build_Veteran_Diplomats", "Inspires_Partisans"
-
-martial_law_max = 3
-martial_law_per = 2
-max_single_rate = 80
-civil_war_chance = 50
-empire_size_mod = 127 ; unlimited
-empire_size_inc = 0
-rapture_size = 3
unit_unhappy_factor = 0
unit_shield_factor = 1
@@ -411,16 +357,6 @@
tech_req = "Fundamentalism"
graphic = "gov.fundamentalism"
graphic_alt = "-"
-flags = "No_Unhappy_Citizens", "Convert_Tithes_To_Money",
- "Fanatic_Troops"
-
-martial_law_max = 0
-martial_law_per = 0
-max_single_rate = 80
-civil_war_chance = 60
-empire_size_mod = 0
-empire_size_inc = 12
-rapture_size = 3
unit_unhappy_factor = 0
unit_shield_factor = 1
@@ -498,15 +434,6 @@
}
graphic = "gov.republic"
graphic_alt = "-"
-flags = "Has_Senate", "Rapture_City_Growth"
-
-martial_law_max = 0
-martial_law_per = 0
-max_single_rate = 80
-civil_war_chance = 40
-empire_size_mod = 0
-empire_size_inc = 12
-rapture_size = 3
unit_unhappy_factor = 1
unit_shield_factor = 1
@@ -585,16 +512,6 @@
}
graphic = "gov.democracy"
graphic_alt = "-"
-flags = "Has_Senate", "Revolution_When_Unhappy",
- "Inspires_Partisans", "Unbribable", "Rapture_City_Growth"
-
-martial_law_max = 0
-martial_law_per = 0
-max_single_rate = 100
-civil_war_chance = 30
-empire_size_mod = 3
-empire_size_inc = 15
-rapture_size = 3
unit_unhappy_factor = 2
unit_shield_factor = 1
Index: data/default/cities.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/cities.ruleset,v
retrieving revision 1.16
diff -u -r1.16 cities.ruleset
--- data/default/cities.ruleset 21 Apr 2005 00:28:27 -0000 1.16
+++ data/default/cities.ruleset 29 Apr 2005 22:43:04 -0000
@@ -49,6 +49,7 @@
[parameters]
add_to_size_limit = 8 ; cities >= this cannot be added to.
angry_citizens = 1 ; set to zero to disable angry citizens
+celebrate_size_limit = 3 ; cities >= can celebrate
;
; City styles define the way cities are drawn
Index: data/default/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/effects.ruleset,v
retrieving revision 1.6
diff -u -r1.6 effects.ruleset
--- data/default/effects.ruleset 21 Apr 2005 22:53:13 -0000 1.6
+++ data/default/effects.ruleset 29 Apr 2005 22:43:04 -0000
@@ -25,6 +25,331 @@
"Tech", "Nuclear Power", "Player"
}
+[effect_civil_war_0]
+name = "Civil_War_Chance"
+value = 90
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_civil_war_1]
+name = "Civil_War_Chance"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_civil_war_2]
+name = "Civil_War_Chance"
+value = 70
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_civil_war_3]
+name = "Civil_War_Chance"
+value = 50
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_civil_war_4]
+name = "Civil_War_Chance"
+value = 40
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_civil_war_5]
+name = "Civil_War_Chance"
+value = 30
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_empire_size_mod_0]
+; base value
+name = "Empire_Size_Mod"
+value = -5
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_empire_size_mod_1]
+name = "Empire_Size_Mod"
+value = -4
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_empire_size_mod_2]
+name = "Empire_Size_Mod"
+value = -3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_empire_size_mod_3]
+name = "Empire_Size_Mod"
+value = -2
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_empire_size_mod_4]
+name = "Empire_Size_Mod"
+value = -1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_empire_size_step_0]
+name = "Empire_Size_Step"
+value = 6
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_empire_size_step_1]
+name = "Empire_Size_Step"
+value = 10
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_empire_size_step_2]
+name = "Empire_Size_Step"
+value = 12
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_empire_size_step_3]
+name = "Empire_Size_Step"
+value = 14
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_empire_size_step_4]
+name = "Empire_Size_Step"
+value = 16
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_max_rates_0]
+name = "Max_Rates"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_max_rates_1]
+name = "Max_Rates"
+value = 60
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_max_rates_2]
+name = "Max_Rates"
+value = 70
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_max_rates_3]
+name = "Max_Rates"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_max_rates_4]
+name = "Max_Rates"
+value = 80
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_max_rates_5]
+name = "Max_Rates"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_martial_law_each_0]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_martial_law_each_1]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_martial_law_each_2]
+name = "Martial_Law_Each"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_martial_law_each_3]
+name = "Martial_Law_Each"
+value = 2
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_martial_law_max_0]
+name = "Martial_Law_Max"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Anarchy", "Player"
+ }
+
+[effect_martial_law_max_1]
+name = "Martial_Law_Max"
+value = 100
+reqs =
+ { "type", "name", "range"
+ "Gov", "Despotism", "Player"
+ }
+
+[effect_martial_law_max_2]
+name = "Martial_Law_Max"
+value = 3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Monarchy", "Player"
+ }
+
+[effect_martial_law_max_3]
+name = "Martial_Law_Max"
+value = 3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_rapture_grow_0]
+name = "Rapture_Grow"
+value = 3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_rapture_grow_1]
+name = "Rapture_Grow"
+value = 3
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_democracy_0]
+name = "Unbribable_Units"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_democracy_1]
+name = "No_Incite"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_communism_0]
+name = "Veteran_Diplomats"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ }
+
+[effect_revolution_0]
+name = "Revolution_When_Unhappy"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_senate_0]
+name = "Has_Senate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Republic", "Player"
+ }
+
+[effect_senate_1]
+name = "Has_Senate"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ }
+
+[effect_partisan_0]
+name = "Inspire_Partisans"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Communism", "Player"
+ "Tech", "Communism", "Player"
+ "Tech", "Gunpowder", "Player"
+ }
+
+[effect_partisan_1]
+name = "Inspire_Partisans"
+value = 1
+reqs =
+ { "type", "name", "range"
+ "Gov", "Democracy", "Player"
+ "Tech", "Communism", "Player"
+ "Tech", "Gunpowder", "Player"
+ }
+
[effect_airport]
name = "Air_Veteran"
value = 1
Index: data/default/governments.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/governments.ruleset,v
retrieving revision 1.29
diff -u -r1.29 governments.ruleset
--- data/default/governments.ruleset 28 Mar 2005 17:14:58 -0000 1.29
+++ data/default/governments.ruleset 29 Apr 2005 22:43:04 -0000
@@ -37,26 +37,9 @@
; graphic_alt = alternate graphics tag if preferred is not found;
; should be a standard tag if preferred is not;
; otherwise may be "-"
-; flags = special effects; see government.c for strings
; ai_better = AI will not consider this government for use if the
; government listed here is available
-; martial_law_max = maximum number of units which can enforce martial law
-; in the city
-; martial_law_per = number of unhappy citizens made content by each
-; enforcer unit
-; max_single_rate = maximum which can be allocated to single one of
-; taxation/luxuries/science
-; empire_size_mod = signed modifier added to cityfactor to determine
-; empire size when base unhappiness is increased
-; empire_size_inc = if non-zero, reduce one content citizen for
-; every empire_size_inc cities once #cities
-; exceeds (cityfactor + empire_size_mod)
-; civil_war_chance = percentage change of civil war when capital is captured
-; (and player has enough cities etc)
-; rapture_size = a happy city will celebrate when its size is
-; this value or larger
-
; unit_*_factor = factor applied to individual unit upkeep for different
; upkeep forms
; unit_free_* = base unit upkeep cost which the city gets "free"; only
@@ -103,16 +86,6 @@
; No reqs
graphic = "gov.anarchy"
graphic_alt = "-"
-flags = "-"
-
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 100 ; rates are irrelevant under Anarchy; use 100
- ; to avoid unnecessary changes during revolution
-civil_war_chance = 90
-empire_size_mod = -5
-empire_size_inc = 6
-rapture_size = 3
unit_unhappy_factor = 0
unit_shield_factor = 1
@@ -164,17 +137,8 @@
; No reqs
graphic = "gov.despotism"
graphic_alt = "-"
-flags = "-"
ai_better = "Monarchy"
-martial_law_max = 100 ; unlimited
-martial_law_per = 1
-max_single_rate = 60
-civil_war_chance = 80
-empire_size_mod = -4
-empire_size_inc = 10
-rapture_size = 3
-
unit_unhappy_factor = 0
unit_shield_factor = 1
unit_food_factor = 1
@@ -225,17 +189,8 @@
}
graphic = "gov.monarchy"
graphic_alt = "-"
-flags = "-"
ai_better = "Communism"
-martial_law_max = 3
-martial_law_per = 1
-max_single_rate = 70
-civil_war_chance = 70
-empire_size_mod = -3
-empire_size_inc = 12
-rapture_size = 3
-
unit_unhappy_factor = 0
unit_shield_factor = 1
unit_food_factor = 1
@@ -286,15 +241,6 @@
}
graphic = "gov.communism"
graphic_alt = "-"
-flags = "Build_Veteran_Diplomats", "Inspires_Partisans"
-
-martial_law_max = 3
-martial_law_per = 2
-max_single_rate = 80
-civil_war_chance = 50
-empire_size_mod = -2
-empire_size_inc = 0
-rapture_size = 3
unit_unhappy_factor = 0
unit_shield_factor = 1
@@ -352,15 +298,6 @@
}
graphic = "gov.republic"
graphic_alt = "-"
-flags = "Has_Senate", "Rapture_City_Growth"
-
-martial_law_max = 0
-martial_law_per = 0
-max_single_rate = 80
-civil_war_chance = 40
-empire_size_mod = -1
-empire_size_inc = 14
-rapture_size = 3
unit_unhappy_factor = 1
unit_shield_factor = 1
@@ -415,16 +352,6 @@
}
graphic = "gov.democracy"
graphic_alt = "-"
-flags = "Has_Senate", "Revolution_When_Unhappy",
- "Inspires_Partisans", "Unbribable", "Rapture_City_Growth"
-
-martial_law_max = 0
-martial_law_per = 0
-max_single_rate = 100
-civil_war_chance = 30
-empire_size_mod = 0
-empire_size_inc = 16
-rapture_size = 3
unit_unhappy_factor = 2
unit_shield_factor = 1
Index: data/default/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/units.ruleset,v
retrieving revision 1.67
diff -u -r1.67 units.ruleset
--- data/default/units.ruleset 4 Apr 2005 21:45:49 -0000 1.67
+++ data/default/units.ruleset 29 Apr 2005 22:43:04 -0000
@@ -1835,6 +1835,3 @@
advanced radar that can determine the location of enemy units over a \
wide area.\
")
-
-[u_specials]
-partisan_req = "Gunpowder","Communism"
Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.88
diff -u -r1.88 barbarian.c
--- server/barbarian.c 29 Apr 2005 17:41:17 -0000 1.88
+++ server/barbarian.c 29 Apr 2005 22:43:05 -0000
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
+#include "effects.h"
#include "events.h"
#include "fcintl.h"
#include "game.h"
@@ -379,7 +380,7 @@
if ((int)myrand(UPRISE_CIV_MORE) >
(int)city_list_size(victim->cities) -
UPRISE_CIV_SIZE/(game.barbarianrate-1)
- || myrand(100) > get_gov_pcity(pc)->civil_war) {
+ || myrand(100) > get_player_bonus(victim, EFT_CIVIL_WAR_CHANCE)) {
return;
}
freelog(LOG_DEBUG, "Barbarians are willing to fight");
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.315
diff -u -r1.315 citytools.c
--- server/citytools.c 29 Apr 2005 01:52:10 -0000 1.315
+++ server/citytools.c 29 Apr 2005 22:43:05 -0000
@@ -472,11 +472,8 @@
}
if (unit_type_flag(id, F_DIPLOMAT)) {
- return (government_has_flag(get_gov_pcity(pcity),
- G_BUILD_VETERAN_DIPLOMAT) ? 1 : 0);
- }
-
- if (is_ground_unittype(id)) {
+ return (get_city_bonus(pcity, EFT_VETERAN_DIPLOMATS) ? 1 : 0);
+ } else if (is_ground_unittype(id)) {
return (get_city_bonus(pcity, EFT_LAND_VETERAN) > 0) ? 1 : 0;
} else {
if (is_sailing_unittype(id)) {
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.307
diff -u -r1.307 cityturn.c
--- server/cityturn.c 24 Apr 2005 06:18:28 -0000 1.307
+++ server/cityturn.c 29 Apr 2005 22:43:05 -0000
@@ -939,7 +939,7 @@
if (pcity->surplus[O_SHIELD] < 0) {
unit_list_iterate_safe(pcity->units_supported, punit) {
- if (utype_upkeep_cost(unit_type(punit), g, O_SHIELD) > 0
+ if (utype_upkeep_cost(unit_type(punit), pplayer, g, O_SHIELD) > 0
&& pcity->surplus[O_SHIELD] < 0
&& !unit_flag(punit, F_UNDISBANDABLE)) {
notify_player_ex(pplayer, pcity->tile, E_UNIT_LOST,
@@ -957,7 +957,7 @@
* it! If we make it here all normal units are already disbanded, so only
* undisbandable ones remain. */
unit_list_iterate_safe(pcity->units_supported, punit) {
- int upkeep = utype_upkeep_cost(unit_type(punit), g, O_SHIELD);
+ int upkeep = utype_upkeep_cost(unit_type(punit), pplayer, g, O_SHIELD);
if (upkeep > 0 && pcity->surplus[O_SHIELD] < 0) {
assert(unit_flag(punit, F_UNDISBANDABLE));
@@ -1266,9 +1266,6 @@
struct city *capital;
int dist, size, cost;
- if (government_has_flag(get_gov_pcity(pcity), G_UNBRIBABLE)) {
- return INCITE_IMPOSSIBLE_COST;
- }
if (get_city_bonus(pcity, EFT_NO_INCITE) > 0) {
return INCITE_IMPOSSIBLE_COST;
}
@@ -1450,7 +1447,8 @@
check_pollution(pcity);
send_city_info(NULL, pcity);
- if (pcity->anarchy>2 && government_has_flag(g, G_REVOLUTION_WHEN_UNHAPPY))
{
+ if (pcity->anarchy>2
+ && get_player_bonus(pplayer, EFT_REVOLUTION_WHEN_UNHAPPY) > 0) {
notify_player_ex(pplayer, pcity->tile, E_ANARCHY,
_("The people have overthrown your %s, "
"your country is in turmoil."),
Index: server/diplomats.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v
retrieving revision 1.70
diff -u -r1.70 diplomats.c
--- server/diplomats.c 21 Mar 2005 12:21:28 -0000 1.70
+++ server/diplomats.c 29 Apr 2005 22:43:06 -0000
@@ -420,12 +420,10 @@
}
/* Check for unit from a bribable government. */
- if (government_has_flag(get_gov_pplayer(unit_owner(pvictim)),
- G_UNBRIBABLE)) {
+ if (get_player_bonus(uplayer, EFT_UNBRIBABLE_UNITS)) {
notify_player_ex(pplayer, pdiplomat->tile,
E_MY_DIPLOMAT_FAILED,
_("You can't bribe a unit from this nation."));
- freelog (LOG_DEBUG, "bribe-unit: unit's government is unbribable");
return;
}
@@ -743,14 +741,6 @@
freelog (LOG_DEBUG, "incite: unit: %d", pdiplomat->id);
- /* Check for city from a bribable government. */
- if (government_has_flag (get_gov_pcity (pcity), G_UNBRIBABLE)) {
- notify_player_ex(pplayer, pcity->tile, E_MY_DIPLOMAT_FAILED,
- _("You can't subvert a city from this nation."));
- freelog (LOG_DEBUG, "incite: city's government is unbribable");
- return;
- }
-
/* See if the city is subvertable. */
if (get_city_bonus(pcity, EFT_NO_INCITE) > 0) {
notify_player_ex(pplayer, pcity->tile, E_MY_DIPLOMAT_FAILED,
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.366
diff -u -r1.366 plrhand.c
--- server/plrhand.c 15 Apr 2005 05:22:52 -0000 1.366
+++ server/plrhand.c 29 Apr 2005 22:43:06 -0000
@@ -768,7 +768,7 @@
|| science > 100) {
return;
}
- maxrate = get_government_max_rate (pplayer->government);
+ maxrate = get_player_bonus(pplayer, EFT_MAX_RATES);
if (tax > maxrate || luxury > maxrate || science > maxrate) {
const char *rtype;
@@ -871,7 +871,7 @@
if (!pplayer->ai.control) {
/* Keep luxuries if we have any. Try to max out science. -GJW */
- int max = get_government_max_rate(pplayer->government);
+ int max = get_player_bonus(pplayer, EFT_MAX_RATES);
pplayer->economic.science
= MIN(100 - pplayer->economic.luxury, max);
@@ -1087,7 +1087,7 @@
old_type = pplayer->diplstates[other_player_id].type;
pplayer2 = get_player(other_player_id);
- has_senate = government_has_flag(get_gov_pplayer(pplayer), G_HAS_SENATE);
+ has_senate = (get_player_bonus(pplayer, EFT_HAS_SENATE) > 0);
/* can't break a pact with yourself */
if (pplayer == pplayer2) {
@@ -2050,7 +2050,7 @@
/* Get base probabilities */
int dice = myrand(100); /* Throw the dice */
- int prob = get_government_civil_war_prob(pplayer->government);
+ int prob = get_player_bonus(pplayer, EFT_CIVIL_WAR_CHANCE);
/* Now compute the contribution of the cities. */
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.248
diff -u -r1.248 ruleset.c
--- server/ruleset.c 29 Apr 2005 18:14:40 -0000 1.248
+++ server/ruleset.c 29 Apr 2005 22:43:06 -0000
@@ -1121,9 +1121,6 @@
free(slist);
} unit_type_iterate_end;
- lookup_tech_list(file, "u_specials", "partisan_req",
- game.rtech.partisan_req, filename);
-
/* Some more consistency checking: */
unit_type_iterate(i) {
u = &unit_types[i];
@@ -1187,16 +1184,6 @@
exit(EXIT_FAILURE);
}
- /* pre-calculate game.rtech.u_partisan
- (tech for first partisan unit, or A_LAST */
- if (num_role_units(L_PARTISAN)==0) {
- game.rtech.u_partisan = A_LAST;
- } else {
- j = get_role_unit(L_PARTISAN, 0);
- j = game.rtech.u_partisan = get_unit_type(j)->tech_requirement;
- freelog(LOG_DEBUG, "partisan tech is %s", advances[j].name);
- }
-
update_simple_ai_types();
free(sec);
@@ -1623,8 +1610,8 @@
**************************************************************************/
static void load_ruleset_governments(struct section_file *file)
{
- int j, nval;
- char **sec, **slist;
+ int nval;
+ char **sec;
const char *filename = secfile_filename(file);
(void) check_ruleset_capabilities(file, "+1.9", filename);
@@ -1666,15 +1653,6 @@
sz_strlcpy(g->graphic_alt,
secfile_lookup_str(file, "%s.graphic_alt", sec[i]));
- g->martial_law_max = secfile_lookup_int(file, "%s.martial_law_max",
sec[i]);
- g->martial_law_per = secfile_lookup_int(file, "%s.martial_law_per",
sec[i]);
- g->max_rate = secfile_lookup_int(file, "%s.max_single_rate", sec[i]);
- g->civil_war = secfile_lookup_int(file, "%s.civil_war_chance", sec[i]);
- g->empire_size_mod = secfile_lookup_int(file, "%s.empire_size_mod",
sec[i]);
- g->empire_size_inc =
- secfile_lookup_int_default(file, 0, "%s.empire_size_inc", sec[i]);
- g->rapture_size = secfile_lookup_int(file, "%s.rapture_size", sec[i]);
-
g->free_happy
= lookup_city_cost(file, sec[i], "unit_free_unhappy", filename);
@@ -1734,26 +1712,6 @@
} government_iterate_end;
- /* flags: */
- government_iterate(g) {
- g->flags = 0;
- slist = secfile_lookup_str_vec(file, &nval, "%s.flags", sec[g->index]);
- for(j=0; j<nval; j++) {
- char *sval = slist[j];
- enum government_flag_id flag = government_flag_from_str(sval);
- if (strcmp(sval, "-") == 0) {
- continue;
- }
- if (flag == G_LAST_FLAG) {
- freelog(LOG_FATAL, "government %s has unknown flag %s", g->name, sval);
- exit(EXIT_FAILURE);
- } else {
- g->flags |= (1<<flag);
- }
- }
- free(slist);
- } government_iterate_end;
-
/* titles */
government_iterate(g) {
int i = g->index;
@@ -1790,10 +1748,6 @@
packet.notradesize = game.notradesize;
packet.fulltradesize = game.fulltradesize;
- for(i=0; i<MAX_NUM_TECH_LIST; i++) {
- packet.rtech_partisan_req[i] = game.rtech.partisan_req[i];
- }
-
packet.government_count = game.government_count;
packet.government_when_anarchy = game.government_when_anarchy;
packet.default_government = game.default_government;
@@ -2359,6 +2313,10 @@
game.rgame.num_specialist_types = nval;
free(specialist_names);
+ game.celebratesize =
+ secfile_lookup_int_default(file, GAME_DEFAULT_CELEBRATESIZE,
+ "parameters.celebratesize");
+
game.rgame.changable_tax =
secfile_lookup_bool_default(file, TRUE, "specialist.changable_tax");
game.rgame.forced_science =
@@ -2879,14 +2837,6 @@
&gov.req_survives[j], &gov.req_value[j]);
}
- gov.max_rate = g->max_rate;
- gov.civil_war = g->civil_war;
- gov.martial_law_max = g->martial_law_max;
- gov.martial_law_per = g->martial_law_per;
- gov.empire_size_mod = g->empire_size_mod;
- gov.empire_size_inc = g->empire_size_inc;
- gov.rapture_size = g->rapture_size;
-
gov.unit_happy_cost_factor = g->unit_happy_cost_factor;
gov.free_happy = g->free_happy;
@@ -2906,7 +2856,6 @@
gov.waste_max_distance_cap[o] = g->waste[o].max_distance_cap;
} output_type_iterate_end;
- gov.flags = g->flags;
gov.num_ruler_titles = g->num_ruler_titles;
sz_strlcpy(gov.name, g->name_orig);
@@ -3043,6 +2992,8 @@
&misc_p.specialist_req_value[index]);
}
} specialist_type_iterate_end;
+ misc_p.rapturedelay = game.rapturedelay;
+ misc_p.celebratesize = game.celebratesize;
misc_p.changable_tax = game.rgame.changable_tax;
misc_p.forced_science = game.rgame.forced_science;
misc_p.forced_luxury = game.rgame.forced_luxury;
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.230
diff -u -r1.230 settlers.c
--- server/settlers.c 26 Apr 2005 05:23:59 -0000 1.230
+++ server/settlers.c 29 Apr 2005 22:43:07 -0000
@@ -820,7 +820,7 @@
static int unit_food_upkeep(struct unit *punit)
{
struct player *pplayer = unit_owner(punit);
- int upkeep = utype_upkeep_cost(unit_type(punit),
+ int upkeep = utype_upkeep_cost(unit_type(punit), pplayer,
get_gov_pplayer(pplayer), O_FOOD);
if (punit->id != 0 && punit->homecity == 0)
upkeep = 0; /* thanks, Peter */
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.342
diff -u -r1.342 unittools.c
--- server/unittools.c 29 Apr 2005 17:39:29 -0000 1.342
+++ server/unittools.c 29 Apr 2005 22:43:07 -0000
@@ -1161,25 +1161,12 @@
**************************************************************************/
void make_partisans(struct city *pcity)
{
- struct player *pplayer;
- int i, partisans;
+ int partisans;
- if (num_role_units(L_PARTISAN)==0)
+ if (num_role_units(L_PARTISAN) <= 0
+ || pcity->original != pcity->owner
+ || get_city_bonus(pcity, EFT_INSPIRE_PARTISANS) <= 0) {
return;
- if (!tech_exists(game.rtech.u_partisan)
- || game.global_advances[game.rtech.u_partisan] == 0
- || pcity->original != pcity->owner)
- return;
-
- if (!government_has_flag(get_gov_pcity(pcity), G_INSPIRES_PARTISANS))
- return;
-
- pplayer = city_owner(pcity);
- for(i=0; i<MAX_NUM_TECH_LIST; i++) {
- int tech = game.rtech.partisan_req[i];
- if (tech == A_LAST) break;
- if (get_invention(pplayer, tech) != TECH_KNOWN) return;
- /* Was A_COMMUNISM and A_GUNPOWDER */
}
partisans = myrand(1 + pcity->size/2) + 1;
- [Freeciv-Dev] Re: (PR#12706) Events framework: lua+tolua, Per I. Mathisen, 2005/04/26
- [Freeciv-Dev] Re: (PR#12706) Events framework: lua+tolua, Benoit Hudson, 2005/04/26
- [Freeciv-Dev] (PR#12706) [PATCH] Events framework, Vasco Alexandre da Silva Costa, 2005/04/26
- [Freeciv-Dev] Re: (PR#12706) [PATCH] Events framework, Jason Short, 2005/04/26
- [Freeciv-Dev] Re: (PR#12706) [PATCH] Events framework, Vasco Alexandre da Silva Costa, 2005/04/27
- [Freeciv-Dev] (PR#12706) [PATCH] Events framework: version 2, Vasco Alexandre da Silva Costa, 2005/04/27
- [Freeciv-Dev] (PR#12706) Events framework, Jason Short, 2005/04/28
- [Freeciv-Dev] (PR#12706) Events framework, Jason Short, 2005/04/28
- [Freeciv-Dev] (PR#12706) [PATCH] Events framework: version 3, Vasco Alexandre da Silva Costa, 2005/04/29
- [Freeciv-Dev] (PR#12706) Events framework,
Jason Short <=
- [Freeciv-Dev] (PR#12706) [PATCH] Events framework: version 4, Vasco Alexandre da Silva Costa, 2005/04/30
|
|