diff -Nur -Xp2/diff_ignore orig/common/city.c p2/common/city.c --- orig/common/city.c Thu Oct 4 22:34:39 2001 +++ p2/common/city.c Thu Oct 11 22:58:23 2001 @@ -1941,7 +1941,7 @@ struct government *g = get_gov_pcity(pcity); struct city *capital; int dist; - int val; + int val, trade_penalty; if (g->corruption_level == 0) { return 0; @@ -1965,8 +1965,18 @@ city_got_building(pcity, B_PALACE)) val /= 2; val *= g->corruption_level; val /= 100; - if (val > trade) - val = trade; + + assert(game.notradesize < game.fulltradesize); + if (pcity->size <= game.notradesize) + trade_penalty = trade; + else if (pcity->size >= game.fulltradesize) + trade_penalty = 0; + else + trade_penalty = trade * (game.fulltradesize - pcity->size) / + (game.fulltradesize - game.notradesize); + + val = CLIP(trade_penalty, val, trade); + return (val); /* how did y'all let me forget this one? -- Syela */ } diff -Nur -Xp2/diff_ignore orig/common/game.c p2/common/game.c --- orig/common/game.c Sat Oct 6 15:44:49 2001 +++ p2/common/game.c Thu Oct 11 22:58:23 2001 @@ -715,6 +715,8 @@ game.fogofwar = GAME_DEFAULT_FOGOFWAR; game.fogofwar_old= game.fogofwar; game.auto_ai_toggle = GAME_DEFAULT_AUTO_AI_TOGGLE; + game.notradesize = GAME_DEFAULT_NOTRADESIZE; + game.fulltradesize = GAME_DEFAULT_FULLTRADESIZE; game.barbarianrate = GAME_DEFAULT_BARBARIANRATE; game.onsetbarbarian = GAME_DEFAULT_ONSETBARBARIAN; game.nbarbarians = 0; diff -Nur -Xp2/diff_ignore orig/common/game.h p2/common/game.h --- orig/common/game.h Sun Sep 16 22:27:13 2001 +++ p2/common/game.h Thu Oct 11 22:58:23 2001 @@ -75,6 +75,7 @@ int civilwarsize; int min_players, max_players, nplayers; int aifill; + int notradesize, fulltradesize; int barbarianrate; int onsetbarbarian; int nbarbarians; @@ -377,6 +378,14 @@ #define GAME_DEFAULT_PINGTIMEOUT 60 #define GAME_MIN_PINGTIMEOUT 60 #define GAME_MAX_PINGTIMEOUT 1800 + +#define GAME_DEFAULT_NOTRADESIZE 0 +#define GAME_MIN_NOTRADESIZE 0 +#define GAME_MAX_NOTRADESIZE 49 + +#define GAME_DEFAULT_FULLTRADESIZE 1 +#define GAME_MIN_FULLTRADESIZE 1 +#define GAME_MAX_FULLTRADESIZE 50 #define GAME_DEFAULT_BARBARIANRATE 2 #define GAME_MIN_BARBARIANRATE 0 diff -Nur -Xp2/diff_ignore orig/server/savegame.c p2/server/savegame.c --- orig/server/savegame.c Wed Oct 3 11:31:06 2001 +++ p2/server/savegame.c Thu Oct 11 22:58:23 2001 @@ -2004,6 +2004,8 @@ game.warminglevel = secfile_lookup_int(file, "game.warminglevel"); game.nuclearwinter = secfile_lookup_int_default(file, 0, "game.nuclearwinter"); game.coolinglevel = secfile_lookup_int_default(file, 8, "game.coolinglevel"); + game.notradesize = secfile_lookup_int_default(file, 0, "game.notradesize"); + game.fulltradesize = secfile_lookup_int_default(file, 1, "game.fulltradesize"); game.unhappysize = secfile_lookup_int(file, "game.unhappysize"); game.angrycitizen = secfile_lookup_int_default(file, 0, "game.angrycitizen"); @@ -2366,6 +2368,8 @@ secfile_insert_int(file, game.warminglevel, "game.warminglevel"); secfile_insert_int(file, game.nuclearwinter, "game.nuclearwinter"); secfile_insert_int(file, game.coolinglevel, "game.coolinglevel"); + secfile_insert_int(file, game.notradesize, "game.notradesize"); + secfile_insert_int(file, game.fulltradesize, "game.fulltradesize"); secfile_insert_int(file, game.unhappysize, "game.unhappysize"); secfile_insert_int(file, game.angrycitizen, "game.angrycitizen"); secfile_insert_int(file, game.cityfactor, "game.cityfactor"); diff -Nur -Xp2/diff_ignore orig/server/stdinhand.c p2/server/stdinhand.c --- orig/server/stdinhand.c Sun Sep 16 22:27:55 2001 +++ p2/server/stdinhand.c Thu Oct 11 22:58:23 2001 @@ -140,6 +140,8 @@ the fixed number of arguments and the reject_message - change? - rp *********************************************************************/ +static int valid_notradesize(int value, char **reject_message); +static int valid_fulltradesize(int value, char **reject_message); static int autotoggle(int value, char **reject_message); static int valid_ruleset(char *whichset, char *subdir, char **reject_message) @@ -489,7 +491,26 @@ N_("If a city would expand, but it can't because it needs an Aqueduct " "(or Sewer System), it loses this percentage of its foodbox " "(or half that amount if it has a Granary).") }, - + + { "notradesize", &game.notradesize, valid_notradesize, NULL, + SSET_RULES, SSET_TO_CLIENT, + GAME_MIN_NOTRADESIZE, GAME_MAX_NOTRADESIZE, GAME_DEFAULT_NOTRADESIZE, + N_("Maximum size of a city without trade"), + N_("All the cities of smaller or equal size to this do not produce trade " + "at all. The produced trade increases gradually for cities larger " + "than notradesize and smaller than fulltradesize. " + "This does not apply under Democracy. See also fulltradesize.") }, + + { "fulltradesize", &game.fulltradesize, valid_fulltradesize, NULL, + SSET_RULES, SSET_TO_CLIENT, + GAME_MIN_FULLTRADESIZE, GAME_MAX_FULLTRADESIZE, GAME_DEFAULT_FULLTRADESIZE, + N_("Minimum city size to get full trade"), + N_("There is a trade penalty in all cities smaller than this. " + "The penalty is 100% (no trade at all) for sizes up to " + "notradesize, and decreases gradually to 0% (no penalty except the " + "normal corruption) for size=fulltradesize. This does not apply under " + "Democracy. See also notradesize.") }, + { "unhappysize", &game.unhappysize, NULL, NULL, SSET_RULES, SSET_TO_CLIENT, GAME_MIN_UNHAPPYSIZE, GAME_MAX_UNHAPPYSIZE, GAME_DEFAULT_UNHAPPYSIZE, @@ -3326,6 +3347,32 @@ conn_list_iterate_end; } cmd_reply(CMD_LIST, caller, C_COMMENT, horiz_line); +} + +/************************************************************************** + Verify that notradesize is always smaller than fulltradesize +**************************************************************************/ +static int valid_notradesize(int value, char **reject_message) +{ + if (value < game.fulltradesize) + return 1; + + *reject_message = _("notradesize must be always smaller than " + "fulltradesize, keeping old value."); + return 0; +} + +/************************************************************************** + Verify that fulltradesize is always bigger than notradesize +**************************************************************************/ +static int valid_fulltradesize(int value, char **reject_message) +{ + if (value > game.notradesize) + return 1; + + *reject_message = _("fulltradesize must be always bigger than " + "notradesize, keeping old value."); + return 0; } static int autotoggle(int value, char **reject_message)