[Freeciv-Dev] (PR#15396) Make cityfactor and unhappysize into effects
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#15396) Make cityfactor and unhappysize into effects |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Fri, 3 Feb 2006 13:10:14 -0800 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15396 >
This patch makes the server settings 'cityfactor' (when you have this many
cities, all cities get +1 unhappy citizen) and 'unhappysize' (after this
many citizens, all new citizens are unhappy) into effects. This gives much
more mod-ability, at the expense of being able to change these settings
from the server while running. I do not think a lot of people change these
two settings, and I need them as effects for the advanced governments
design.
- Per
Index: ai/aicity.c
===================================================================
--- ai/aicity.c (revision 11543)
+++ ai/aicity.c (working copy)
@@ -336,8 +336,7 @@
case EFT_MAKE_HAPPY:
v += (get_entertainers(pcity) + pcity->ppl_unhappy[4]) * 5 * amount;
if (city_list_size(pplayer->cities)
- > game.info.cityfactor
- + get_player_bonus(pplayer, EFT_EMPIRE_SIZE_MOD)) {
+ > get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE)) {
v += c * amount; /* offset large empire size */
}
v += c * amount;
@@ -357,9 +356,8 @@
/* Try to build wonders to offset empire size unhappiness */
if (city_list_size(pplayer->cities)
- > game.info.cityfactor
- + get_player_bonus(pplayer, EFT_EMPIRE_SIZE_MOD)) {
- if (get_player_bonus(pplayer, EFT_EMPIRE_SIZE_MOD) > 0) {
+ > get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE)) {
+ if (get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE) > 0) {
factor += city_list_size(pplayer->cities)
/ get_player_bonus(pplayer, EFT_EMPIRE_SIZE_STEP);
}
@@ -594,11 +592,12 @@
} players_iterate_end;
break;
/* Currently not supported for building AI - wait for modpack users */
+ case EFT_CITY_UNHAPPY_SIZE:
case EFT_UNHAPPY_FACTOR:
case EFT_UPKEEP_FACTOR:
case EFT_UNIT_UPKEEP_FREE_PER_CITY:
case EFT_CIVIL_WAR_CHANCE:
- case EFT_EMPIRE_SIZE_MOD:
+ case EFT_EMPIRE_SIZE_BASE:
case EFT_EMPIRE_SIZE_STEP:
case EFT_MAX_RATES:
case EFT_MARTIAL_LAW_EACH:
Index: server/settings.c
===================================================================
--- server/settings.c (revision 11543)
+++ server/settings.c (working copy)
@@ -576,25 +576,6 @@
GAME_MIN_NOTRADESIZE, GAME_MAX_NOTRADESIZE,
GAME_DEFAULT_NOTRADESIZE)
- GEN_INT("unhappysize", game.info.unhappysize,
- SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, SSET_TO_CLIENT,
- N_("City size before people become unhappy"),
- N_("Before other adjustments, the first unhappysize citizens in a "
- "city are content, and subsequent citizens are unhappy. "
- "See also cityfactor."), NULL,
- GAME_MIN_UNHAPPYSIZE, GAME_MAX_UNHAPPYSIZE,
- GAME_DEFAULT_UNHAPPYSIZE)
-
- GEN_INT("cityfactor", game.info.cityfactor,
- SSET_RULES, SSET_SOCIOLOGY, SSET_RARE, SSET_TO_CLIENT,
- N_("Number of cities for higher unhappiness"),
- N_("When the number of cities a player owns is greater than "
- "cityfactor, one extra citizen is unhappy before other "
- "adjustments; see also unhappysize. This assumes a "
- "Democracy; for other governments the effect occurs at "
- "smaller numbers of cities."), NULL,
- GAME_MIN_CITYFACTOR, GAME_MAX_CITYFACTOR, GAME_DEFAULT_CITYFACTOR)
-
GEN_INT("citymindist", game.info.citymindist,
SSET_RULES, SSET_SOCIOLOGY, SSET_SITUATIONAL, SSET_TO_CLIENT,
N_("Minimum distance between cities"),
Index: server/savegame.c
===================================================================
--- server/savegame.c (revision 11543)
+++ server/savegame.c (working copy)
@@ -3509,11 +3509,9 @@
game.info.coolinglevel = secfile_lookup_int_default(file, 8,
"game.coolinglevel");
game.info.notradesize = secfile_lookup_int_default(file, 0,
"game.notradesize");
game.info.fulltradesize = secfile_lookup_int_default(file, 1,
"game.fulltradesize");
- game.info.unhappysize = secfile_lookup_int(file, "game.unhappysize");
game.info.angrycitizen = secfile_lookup_bool_default(file, FALSE,
"game.angrycitizen");
if (game.version >= 10100) {
- game.info.cityfactor = secfile_lookup_int(file, "game.cityfactor");
game.info.diplcost = secfile_lookup_int(file, "game.diplcost");
game.info.freecost = secfile_lookup_int(file, "game.freecost");
game.info.conquercost = secfile_lookup_int(file, "game.conquercost");
@@ -4090,9 +4088,7 @@
secfile_insert_int(file, game.info.coolinglevel, "game.coolinglevel");
secfile_insert_int(file, game.info.notradesize, "game.notradesize");
secfile_insert_int(file, game.info.fulltradesize, "game.fulltradesize");
- secfile_insert_int(file, game.info.unhappysize, "game.unhappysize");
secfile_insert_bool(file, game.info.angrycitizen, "game.angrycitizen");
- secfile_insert_int(file, game.info.cityfactor, "game.cityfactor");
secfile_insert_int(file, game.info.citymindist, "game.citymindist");
secfile_insert_int(file, game.info.civilwarsize, "game.civilwarsize");
secfile_insert_int(file, game.info.contactturns, "game.contactturns");
Index: client/gui-gtk-2.0/happiness.c
===================================================================
--- client/gui-gtk-2.0/happiness.c (revision 11543)
+++ client/gui-gtk-2.0/happiness.c (working copy)
@@ -227,9 +227,8 @@
struct city *pcity = pdialog->pcity;
struct player *pplayer = pcity->owner;
int cities = city_list_size(pplayer->cities);
- int content = game.info.unhappysize;
- int basis = game.info.cityfactor
- + get_player_bonus(pcity->owner, EFT_EMPIRE_SIZE_MOD);
+ int content = get_player_bonus(pcity->owner, EFT_CITY_UNHAPPY_SIZE);
+ int basis = get_player_bonus(pcity->owner, EFT_EMPIRE_SIZE_BASE);
int step = get_player_bonus(pcity->owner, EFT_EMPIRE_SIZE_STEP);
int excess = cities - basis;
int penalty = 0;
Index: client/gui-win32/happiness.c
===================================================================
--- client/gui-win32/happiness.c (revision 11543)
+++ client/gui-win32/happiness.c (working copy)
@@ -176,9 +176,8 @@
struct city *pcity = pdialog->pcity;
struct player *pplayer = pcity->owner;
int cities = city_list_size(pplayer->cities);
- int content = game.info.unhappysize;
- int basis = game.info.cityfactor
- + get_player_bonus(game.player_ptr, EFT_EMPIRE_SIZE_MOD);
+ int content = get_player_bonus(pcity->owner, EFT_CITY_UNHAPPY_SIZE);
+ int basis = 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;
Index: client/helpdata.c
===================================================================
--- client/helpdata.c (revision 11543)
+++ client/helpdata.c (working copy)
@@ -1322,10 +1322,10 @@
sprintf(buf + strlen(buf), _("* Chance of civil war is %d%% if you "
"lose your capital.\n"), peffect->value);
break;
- case EFT_EMPIRE_SIZE_MOD:
+ case EFT_EMPIRE_SIZE_BASE:
sprintf(buf + strlen(buf), _("* The first unhappy citizen in each "
"city due to civilization size will appear when you have
%d"
- " cities.\n"), game.info.cityfactor + peffect->value);
+ " cities.\n"), peffect->value);
break;
case EFT_EMPIRE_SIZE_STEP:
sprintf(buf + strlen(buf), _("* After the first unhappy citizen "
Index: common/packets.def
===================================================================
--- common/packets.def (revision 11543)
+++ common/packets.def (working copy)
@@ -374,9 +374,7 @@
UINT32 globalwarming, heating, warminglevel;
UINT32 nuclearwinter, cooling, coolinglevel;
- UINT8 cityfactor;
UINT8 diplcost, freecost, conquercost;
- UINT8 unhappysize;
UINT8 angrycitizen;
UINT8 techpenalty;
UINT32 foodbox;
Index: common/packets.def
===================================================================
--- common/packets.def (revision 11543)
+++ common/packets.def (working copy)
@@ -374,9 +374,7 @@
UINT32 globalwarming, heating, warminglevel;
UINT32 nuclearwinter, cooling, coolinglevel;
- UINT8 cityfactor;
UINT8 diplcost, freecost, conquercost;
- UINT8 unhappysize;
UINT8 angrycitizen;
UINT8 techpenalty;
UINT32 foodbox;
Index: common/city.c
===================================================================
--- common/city.c (revision 11543)
+++ common/city.c (working copy)
@@ -1413,11 +1413,14 @@
static int content_citizens(const struct player *pplayer)
{
int cities = city_list_size(pplayer->cities);
- int content = game.info.unhappysize;
- int basis = game.info.cityfactor + get_player_bonus(pplayer,
- EFT_EMPIRE_SIZE_MOD);
+ int content = get_player_bonus(pplayer, EFT_CITY_UNHAPPY_SIZE);
+ int basis = get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE);
int step = get_player_bonus(pplayer, EFT_EMPIRE_SIZE_STEP);
+ if (basis + step <= 0) {
+ return content; /* Value of zero means effect is inactive */
+ }
+
if (cities > basis) {
content--;
if (step != 0) {
Index: common/effects.c
===================================================================
--- common/effects.c (revision 11543)
+++ common/effects.c (working copy)
@@ -95,7 +95,7 @@
"Gain_AI_Love",
"Slow_Down_Timeline",
"Civil_War_Chance",
- "Empire_Size_Mod",
+ "Empire_Size_Base",
"Empire_Size_Step",
"Max_Rates",
"Martial_Law_Each",
@@ -115,7 +115,8 @@
"Output_Waste",
"Output_Waste_By_Distance",
"Output_Penalty_Tile",
- "Output_Inc_Tile_Celebrate"
+ "Output_Inc_Tile_Celebrate",
+ "City_Unhappy_Size"
};
static bool initialized = FALSE;
Index: common/effects.h
===================================================================
--- common/effects.h (revision 11543)
+++ common/effects.h (working copy)
@@ -83,8 +83,8 @@
EFT_GAIN_AI_LOVE,
EFT_SLOW_DOWN_TIMELINE,
EFT_CIVIL_WAR_CHANCE,
- EFT_EMPIRE_SIZE_MOD,
- EFT_EMPIRE_SIZE_STEP,
+ EFT_EMPIRE_SIZE_BASE, /* +1 unhappy when more than this cities */
+ EFT_EMPIRE_SIZE_STEP, /* adds additional +1 unhappy steps to above */
EFT_MAX_RATES,
EFT_MARTIAL_LAW_EACH,
EFT_MARTIAL_LAW_MAX,
@@ -104,6 +104,7 @@
EFT_OUTPUT_WASTE_BY_DISTANCE,
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_LAST /* keep this last */
};
Index: common/game.c
===================================================================
--- common/game.c (revision 11543)
+++ common/game.c (working copy)
@@ -205,7 +205,6 @@
game.info.freecost = GAME_DEFAULT_FREECOST;
game.info.conquercost = GAME_DEFAULT_CONQUERCOST;
game.info.dispersion = GAME_DEFAULT_DISPERSION;
- game.info.cityfactor = GAME_DEFAULT_CITYFACTOR;
game.info.citymindist = GAME_DEFAULT_CITYMINDIST;
game.info.civilwarsize = GAME_DEFAULT_CIVILWARSIZE;
game.info.contactturns = GAME_DEFAULT_CONTACTTURNS;
@@ -213,7 +212,6 @@
game.info.celebratesize = GAME_DEFAULT_CELEBRATESIZE;
game.info.savepalace = GAME_DEFAULT_SAVEPALACE;
game.info.natural_city_names = GAME_DEFAULT_NATURALCITYNAMES;
- game.info.unhappysize = GAME_DEFAULT_UNHAPPYSIZE;
game.info.angrycitizen = GAME_DEFAULT_ANGRYCITIZEN;
game.info.foodbox = GAME_DEFAULT_FOODBOX;
game.info.shieldbox = GAME_DEFAULT_SHIELDBOX;
Index: common/game.h
===================================================================
--- common/game.h (revision 11543)
+++ common/game.h (working copy)
@@ -169,10 +169,6 @@
#define GAME_MIN_TECHLEVEL 0
#define GAME_MAX_TECHLEVEL 50
-#define GAME_DEFAULT_UNHAPPYSIZE 4
-#define GAME_MIN_UNHAPPYSIZE 1
-#define GAME_MAX_UNHAPPYSIZE 6
-
#define GAME_DEFAULT_ANGRYCITIZEN TRUE
#define GAME_DEFAULT_END_YEAR 5000
@@ -234,10 +230,6 @@
#define GAME_MIN_CONQUERCOST 0
#define GAME_MAX_CONQUERCOST 100
-#define GAME_DEFAULT_CITYFACTOR 14
-#define GAME_MIN_CITYFACTOR 6
-#define GAME_MAX_CITYFACTOR 100
-
#define GAME_DEFAULT_CITYMINDIST 0
#define GAME_MIN_CITYMINDIST 0 /* if 0, ruleset will overwrite this */
#define GAME_MAX_CITYMINDIST 5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#15396) Make cityfactor and unhappysize into effects,
Per I. Mathisen <=
|
|