[Freeciv-Dev] (PR#20385) [PATCH] Make EFT_EMPIRE_SIZE_STEP optional per-
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#20385) [PATCH] Make EFT_EMPIRE_SIZE_STEP optional per-game |
From: |
"Petr Baudis" <pasky@xxxxxx> |
Date: |
Sun, 3 Sep 2006 06:38:21 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=20385 >
Hi,
this patch makes EFT_EMPIRE_SIZE_STEP optional. The unhappiness
induced by size step is a new addition which wasn't present in 2.0 and
for me personally, it significantly ruins the gameplay - I like to build
empires with many tens of cities and with this, that quickly gets nearly
unplayable without massive luxury rates or spending plenty of money (and
player time!) making sure a temple is built immediately in all new
cities.
One solution would be to clone the ruleset and disable
EFT_EMPIRE_SIZE_STEP there, which is what I originally did, but that's
something non-hacker players can't/won't do, and it is quite painful to
maintain that across freeciv updates or if you want to play over the
network.
Index: server/settings.c
===================================================================
--- server/settings.c (revision 12294)
+++ server/settings.c (working copy)
@@ -787,6 +787,15 @@
"on the surrounding terrain."),
NULL, GAME_DEFAULT_NATURALCITYNAMES)
+ GEN_BOOL("dynamicsizepenalty", game.info.dynamic_size_penalty,
+ SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, SSET_RARE, SSET_TO_CLIENT,
+ N_("Dynamically raise happiness penalty based on empire size"),
+ N_("If enabled, the happiness penalty normally induced when "
+ "empire reaches given size is further raised as the empire "
+ "goes on raising the size. The particular size steps is "
+ "dependent on ruleset definition of your current government."),
+ NULL, GAME_DEFAULT_DYNAMICSIZEPENALTY)
+
/* Meta options: these don't affect the internal rules of the game, but
* do affect players. Also options which only produce extra server
* "output" and don't affect the actual game.
Index: common/packets.def
===================================================================
--- common/packets.def (revision 12294)
+++ common/packets.def (working copy)
@@ -450,6 +450,7 @@
UINT16 base_incite_cost;
UINT8 base_tech_cost;
UINT16 ransom_gold;
+ BOOL dynamic_size_penalty;
UINT8 save_nturns;
UINT8 save_compress_level;
Index: common/city.c
===================================================================
--- common/city.c (revision 12294)
+++ common/city.c (working copy)
@@ -1424,6 +1424,9 @@
int basis = get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE);
int step = get_player_bonus(pplayer, EFT_EMPIRE_SIZE_STEP);
+ if (!game.info.dynamic_size_penalty)
+ step = 0;
+
if (basis + step <= 0) {
return content; /* Value of zero means effect is inactive */
}
Index: common/packets_gen.c
===================================================================
--- common/packets_gen.c (revision 12294)
+++ common/packets_gen.c (working copy)
@@ -3362,7 +3362,7 @@
#define cmp_packet_game_info_100 cmp_const
-BV_DEFINE(packet_game_info_100_fields, 105);
+BV_DEFINE(packet_game_info_100_fields, 106);
static struct packet_game_info *receive_packet_game_info_100(struct connection
*pc, enum packet_type type)
{
@@ -4072,7 +4072,8 @@
real_packet->ransom_gold = readin;
}
}
- if (BV_ISSET(fields, 98)) {
+ real_packet->dynamic_size_penalty = BV_ISSET(fields, 98);
+ if (BV_ISSET(fields, 99)) {
{
int readin;
@@ -4080,7 +4081,7 @@
real_packet->save_nturns = readin;
}
}
- if (BV_ISSET(fields, 99)) {
+ if (BV_ISSET(fields, 100)) {
{
int readin;
@@ -4088,10 +4089,10 @@
real_packet->save_compress_level = readin;
}
}
- if (BV_ISSET(fields, 100)) {
+ if (BV_ISSET(fields, 101)) {
dio_get_string(&din, real_packet->start_units,
sizeof(real_packet->start_units));
}
- if (BV_ISSET(fields, 101)) {
+ if (BV_ISSET(fields, 102)) {
{
int readin;
@@ -4099,7 +4100,7 @@
real_packet->num_teams = readin;
}
}
- if (BV_ISSET(fields, 102)) {
+ if (BV_ISSET(fields, 103)) {
{
int i;
@@ -4113,7 +4114,7 @@
}
}
}
- if (BV_ISSET(fields, 103)) {
+ if (BV_ISSET(fields, 104)) {
for (;;) {
int i;
@@ -4129,7 +4130,7 @@
}
}
}
- if (BV_ISSET(fields, 104)) {
+ if (BV_ISSET(fields, 105)) {
for (;;) {
int i;
@@ -4600,21 +4601,25 @@
if(differ) {different++;}
if(differ) {BV_SET(fields, 97);}
+ differ = (old->dynamic_size_penalty != real_packet->dynamic_size_penalty);
+ if(differ) {different++;}
+ if(packet->dynamic_size_penalty) {BV_SET(fields, 98);}
+
differ = (old->save_nturns != real_packet->save_nturns);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 98);}
+ if(differ) {BV_SET(fields, 99);}
differ = (old->save_compress_level != real_packet->save_compress_level);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 99);}
+ if(differ) {BV_SET(fields, 100);}
differ = (strcmp(old->start_units, real_packet->start_units) != 0);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 100);}
+ if(differ) {BV_SET(fields, 101);}
differ = (old->num_teams != real_packet->num_teams);
if(differ) {different++;}
- if(differ) {BV_SET(fields, 101);}
+ if(differ) {BV_SET(fields, 102);}
{
@@ -4630,7 +4635,7 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 102);}
+ if(differ) {BV_SET(fields, 103);}
{
@@ -4646,7 +4651,7 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 103);}
+ if(differ) {BV_SET(fields, 104);}
{
@@ -4662,7 +4667,7 @@
}
}
if(differ) {different++;}
- if(differ) {BV_SET(fields, 104);}
+ if(differ) {BV_SET(fields, 105);}
if (different == 0 && !force_send_of_unchanged) {
return 0;
@@ -4946,19 +4951,20 @@
if (BV_ISSET(fields, 97)) {
dio_put_uint16(&dout, real_packet->ransom_gold);
}
- if (BV_ISSET(fields, 98)) {
+ /* field 98 is folded into the header */
+ if (BV_ISSET(fields, 99)) {
dio_put_uint8(&dout, real_packet->save_nturns);
}
- if (BV_ISSET(fields, 99)) {
+ if (BV_ISSET(fields, 100)) {
dio_put_uint8(&dout, real_packet->save_compress_level);
}
- if (BV_ISSET(fields, 100)) {
+ if (BV_ISSET(fields, 101)) {
dio_put_string(&dout, real_packet->start_units);
}
- if (BV_ISSET(fields, 101)) {
+ if (BV_ISSET(fields, 102)) {
dio_put_uint8(&dout, real_packet->num_teams);
}
- if (BV_ISSET(fields, 102)) {
+ if (BV_ISSET(fields, 103)) {
{
int i;
@@ -4968,7 +4974,7 @@
}
}
}
- if (BV_ISSET(fields, 103)) {
+ if (BV_ISSET(fields, 104)) {
{
int i;
@@ -4984,7 +4990,7 @@
dio_put_uint8(&dout, 255);
}
}
- if (BV_ISSET(fields, 104)) {
+ if (BV_ISSET(fields, 105)) {
{
int i;
Index: common/packets_gen.h
===================================================================
--- common/packets_gen.h (revision 12294)
+++ common/packets_gen.h (working copy)
@@ -198,6 +198,7 @@
int base_incite_cost;
int base_tech_cost;
int ransom_gold;
+ bool dynamic_size_penalty;
int save_nturns;
int save_compress_level;
char start_units[MAX_LEN_STARTUNIT];
Index: common/game.h
===================================================================
--- common/game.h (revision 12294)
+++ common/game.h (working copy)
@@ -252,6 +252,8 @@
#define GAME_DEFAULT_NATURALCITYNAMES TRUE
+#define GAME_DEFAULT_DYNAMICSIZEPENALTY TRUE
+
#define GAME_DEFAULT_AQUEDUCTLOSS 0
#define GAME_MIN_AQUEDUCTLOSS 0
#define GAME_MAX_AQUEDUCTLOSS 100
Index: ai/aicity.c
===================================================================
--- ai/aicity.c (revision 12294)
+++ ai/aicity.c (working copy)
@@ -358,8 +358,9 @@
if (city_list_size(pplayer->cities)
> get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE)) {
if (get_player_bonus(pplayer, EFT_EMPIRE_SIZE_BASE) > 0) {
- factor += city_list_size(pplayer->cities)
- / MAX(get_player_bonus(pplayer, EFT_EMPIRE_SIZE_STEP), 1);
+ factor += city_list_size(pplayer->cities);
+ if (game.info.dynamic_size_penalty)
+ factor /= MAX(get_player_bonus(pplayer, EFT_EMPIRE_SIZE_STEP), 1);
}
factor += 2;
}
Index: client/gui-gtk-2.0/happiness.c
===================================================================
--- client/gui-gtk-2.0/happiness.c (revision 12294)
+++ client/gui-gtk-2.0/happiness.c (working copy)
@@ -234,7 +234,7 @@
int penalty = 0;
if (excess > 0) {
- if (step > 0)
+ if (step > 0 && game.info.dynamic_size_penalty)
penalty = 1 + (excess - 1) / step;
else
penalty = 1;
@@ -245,7 +245,7 @@
my_snprintf(bptr, nleft,
_("Cities: %d total, %d over threshold of %d cities.\n"),
- cities, excess, basis);
+ cities, excess, basis, game.info.dynamic_size_penalty);
bptr = end_of_strn(bptr, &nleft);
my_snprintf(bptr, nleft, _("%d content before penalty with "), content);
Index: client/gui-win32/happiness.c
===================================================================
--- client/gui-win32/happiness.c (revision 12294)
+++ client/gui-win32/happiness.c (working copy)
@@ -183,7 +183,7 @@
int penalty = 0;
if (excess > 0) {
- if (step > 0)
+ if (step > 0 && game.info.dynamic_size_penalty)
penalty = 1 + (excess - 1) / step;
else
penalty = 1;
Index: client/helpdata.c
===================================================================
--- client/helpdata.c (revision 12294)
+++ client/helpdata.c (working copy)
@@ -1330,9 +1330,10 @@
" cities.\n"), peffect->value);
break;
case EFT_EMPIRE_SIZE_STEP:
- sprintf(buf + strlen(buf), _("* After the first unhappy citizen "
- "due to civilization size, for each %d additional cities, "
- "another unhappy citizen will appear.\n"), peffect->value);
+ if (game.info.dynamic_size_penalty)
+ sprintf(buf + strlen(buf), _("* After the first unhappy citizen "
+ "due to civilization size, for each %d additional cities, "
+ "another unhappy citizen will appear.\n"), peffect->value);
break;
case EFT_MAX_RATES:
if (peffect->value < 100 && game.info.changable_tax) {
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#20385) [PATCH] Make EFT_EMPIRE_SIZE_STEP optional per-game,
Petr Baudis <=
|
|