Index: common/city.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.c,v retrieving revision 1.166 diff -u -r1.166 city.c --- common/city.c 2002/09/19 17:15:04 1.166 +++ common/city.c 2002/09/23 15:59:47 @@ -1661,22 +1661,39 @@ } /************************************************************************** -... + Create content, unhappy and angry citizens. **************************************************************************/ static void citizen_happy_size(struct city *pcity) { - int workers, tmp; + /* Number of specialists in city */ + int specialists = city_specialists(pcity); - workers = pcity->size - city_specialists(pcity); - tmp = content_citizens(city_owner(pcity)); - pcity->ppl_content[0] = MAX(0, MIN(workers, tmp)); - if (game.angrycitizen == 0) + /* This is the number of citizens that may start out content, depending + * on empire size and game's city unhappysize. This may be bigger than + * the size of the city, since this is a potential. */ + int content = content_citizens(city_owner(pcity)); + + /* Create content citizens. Take specialists from their ranks. */ + pcity->ppl_content[0] = MAX(0, MIN(pcity->size, content) - specialists); + + /* Create angry citizens only if we have a negative number of possible + * content citizens. This happens when empires grow really big. */ + if (game.angrycitizen == FALSE) { pcity->ppl_angry[0] = 0; - else - pcity->ppl_angry[0] = MIN(MAX(0, -tmp), workers); - pcity->ppl_unhappy[0] = - workers - pcity->ppl_content[0] - pcity->ppl_angry[0]; - pcity->ppl_happy[0] = 0; /* no one is born happy */ + } else { + pcity->ppl_angry[0] = MIN(MAX(0, -content), pcity->size - specialists); + } + + /* Create unhappy citizens. In the beginning, all who are not content, + * specialists or angry are unhappy. This is changed by luxuries and + * buildings later. */ + pcity->ppl_unhappy[0] = (pcity->size + - specialists + - pcity->ppl_content[0] + - pcity->ppl_angry[0]); + + /* No one is born happy. */ + pcity->ppl_happy[0] = 0; } /************************************************************************** Index: common/game.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/game.h,v retrieving revision 1.112 diff -u -r1.112 game.h --- common/game.h 2002/08/25 11:20:58 1.112 +++ common/game.h 2002/09/23 15:59:47 @@ -89,7 +89,7 @@ int nbarbarians; int occupychance; int unhappysize; - int angrycitizen; + bool angrycitizen; char *startmessage; int conn_id; /* client-only: id client known to server as */ int player_idx; @@ -286,9 +286,7 @@ #define GAME_MIN_UNHAPPYSIZE 1 #define GAME_MAX_UNHAPPYSIZE 6 -#define GAME_DEFAULT_ANGRYCITIZEN 0 -#define GAME_MIN_ANGRYCITIZEN 0 -#define GAME_MAX_ANGRYCITIZEN 1 +#define GAME_DEFAULT_ANGRYCITIZEN TRUE #define GAME_DEFAULT_END_YEAR 2000 #define GAME_MIN_END_YEAR GAME_START_YEAR Index: common/packets.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v retrieving revision 1.216 diff -u -r1.216 packets.c --- common/packets.c 2002/09/19 14:39:38 1.216 +++ common/packets.c 2002/09/23 15:59:47 @@ -993,7 +993,7 @@ dio_put_uint8(&dout, pinfo->freecost); dio_put_uint8(&dout, pinfo->conquercost); dio_put_uint8(&dout, pinfo->unhappysize); - dio_put_uint8(&dout, pinfo->angrycitizen); + dio_put_bool8(&dout, pinfo->angrycitizen); for (i = 0; i < A_LAST /*game.num_tech_types */ ; i++) dio_put_uint8(&dout, pinfo->global_advances[i]); @@ -1041,7 +1041,7 @@ dio_get_uint8(&din, &pinfo->freecost); dio_get_uint8(&din, &pinfo->conquercost); dio_get_uint8(&din, &pinfo->unhappysize); - dio_get_uint8(&din, &pinfo->angrycitizen); + dio_get_bool8(&din, &pinfo->angrycitizen); for (i = 0; i < A_LAST /*game.num_tech_types */ ; i++) dio_get_uint8(&din, &pinfo->global_advances[i]); Index: common/packets.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v retrieving revision 1.124 diff -u -r1.124 packets.h --- common/packets.h 2002/09/19 14:39:38 1.124 +++ common/packets.h 2002/09/23 15:59:47 @@ -823,7 +823,7 @@ int cooling; int cityfactor; int unhappysize; - int angrycitizen; + bool angrycitizen; int diplcost,freecost,conquercost; int global_advances[A_LAST]; int global_wonders[B_LAST]; Index: server/savegame.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v retrieving revision 1.90 diff -u -r1.90 savegame.c --- server/savegame.c 2002/08/25 11:21:02 1.90 +++ server/savegame.c 2002/09/23 15:59:48 @@ -1752,7 +1752,7 @@ 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"); + game.angrycitizen = secfile_lookup_bool_default(file, FALSE, "game.angrycitizen"); if (game.version >= 10100) { game.cityfactor = secfile_lookup_int(file, "game.cityfactor"); @@ -2133,7 +2133,7 @@ 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_bool(file, game.angrycitizen, "game.angrycitizen"); secfile_insert_int(file, game.cityfactor, "game.cityfactor"); secfile_insert_int(file, game.citymindist, "game.citymindist"); secfile_insert_int(file, game.civilwarsize, "game.civilwarsize"); Index: server/stdinhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v retrieving revision 1.247 diff -u -r1.247 stdinhand.c --- server/stdinhand.c 2002/09/19 14:09:31 1.247 +++ server/stdinhand.c 2002/09/23 15:59:48 @@ -451,13 +451,12 @@ GAME_MIN_UNHAPPYSIZE, GAME_MAX_UNHAPPYSIZE, GAME_DEFAULT_UNHAPPYSIZE) - GEN_INT("angrycitizen", game.angrycitizen, SSET_RULES, SSET_TO_CLIENT, + GEN_BOOL("angrycitizen", game.angrycitizen, SSET_RULES, SSET_TO_CLIENT, N_("Whether angry citizens are enabled"), N_("Introduces angry citizens like civilization II. Angry " "citizens have to become unhappy before any other class " "of citizens may be considered. See also unhappysize, " "cityfactor and governments."), NULL, - GAME_MIN_ANGRYCITIZEN, GAME_MAX_ANGRYCITIZEN, GAME_DEFAULT_ANGRYCITIZEN) GEN_INT("cityfactor", game.cityfactor, SSET_RULES, SSET_TO_CLIENT,