Index: common/game.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/game.h,v retrieving revision 1.90 diff -u -r1.90 game.h --- common/game.h 2001/10/26 07:33:23 1.90 +++ common/game.h 2001/11/23 19:31:59 @@ -120,6 +120,7 @@ int aqueduct_size; int sewer_size; int add_to_size_limit; + int savepalace; int spacerace; int turnblock; int fixedlength; Index: common/player.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/player.c,v retrieving revision 1.72 diff -u -r1.72 player.c --- common/player.c 2001/09/02 10:24:28 1.72 +++ common/player.c 2001/11/23 19:32:04 @@ -358,7 +358,27 @@ } /************************************************************************** -Locate the city where the players palace is located, (NULL Otherwise) +Move the palace into random city, when our capital was conquered. +**************************************************************************/ +void move_palace(struct player *pplayer, struct city *pfrom) +{ + int size; + struct city *pnewcity; + + size = city_list_size(&pplayer->cities); + if (size <= 1) + return; /* we can't choose from anything */ + + while(1) { + pnewcity = city_list_get(&pplayer->cities, myrand(size)); + if (pnewcity == pfrom) continue; + city_add_improvement(pnewcity, B_PALACE); + break; + } +} + +/************************************************************************** +Locate the city where the players palace is located, (NULL Otherwise) **************************************************************************/ struct city *find_palace(struct player *pplayer) { Index: common/player.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/player.h,v retrieving revision 1.65 diff -u -r1.65 player.h --- common/player.h 2001/09/25 19:58:13 1.65 +++ common/player.h 2001/11/23 19:32:04 @@ -195,6 +195,7 @@ const char *player_addr_hack(struct player *pplayer); +void move_palace(struct player *pplayer, struct city *pfrom); struct city *find_palace(struct player *pplayer); int ai_handicap(struct player *pplayer, enum handicap_type htype); Index: server/citytools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v retrieving revision 1.146 diff -u -r1.146 citytools.c --- server/citytools.c 2001/10/06 21:02:02 1.146 +++ server/citytools.c 2001/11/23 19:32:17 @@ -699,6 +699,8 @@ for (i=0;iimprovements[i]!=I_NONE) { city_remove_improvement(pcity,i); + /* We can't end up w/o palace */ + if (i == B_PALACE && game.savepalace) move_palace(pgiver, pcity); pcity->improvements[i]=I_ACTIVE; } } @@ -968,6 +970,8 @@ for (i=0;iimprovements[i]!=I_NONE) { city_remove_improvement(pcity,i); + /* We can't end up w/o palace */ + if (i == B_PALACE && game.savepalace) move_palace(pplayer, pcity); } } update_all_effects(); Index: server/savegame.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v retrieving revision 1.39 diff -u -r1.39 savegame.c --- server/savegame.c 2001/11/01 10:03:06 1.39 +++ server/savegame.c 2001/11/23 19:32:50 @@ -1808,6 +1808,8 @@ "game.aqueductloss"); game.killcitizen = secfile_lookup_int_default(file, game.killcitizen, "game.killcitizen"); + game.savepalace = secfile_lookup_int_default(file,game.savepalace, + "game.savepalace"); game.turnblock = secfile_lookup_int_default(file,game.turnblock, "game.turnblock"); game.fixedlength = secfile_lookup_int_default(file,game.fixedlength, @@ -2129,6 +2131,7 @@ secfile_insert_int(file, game.aqueductloss, "game.aqueductloss"); secfile_insert_int(file, game.killcitizen, "game.killcitizen"); secfile_insert_int(file, game.turnblock, "game.turnblock"); + secfile_insert_int(file, game.savepalace, "game.savepalace"); secfile_insert_int(file, game.fixedlength, "game.fixedlength"); secfile_insert_int(file, game.barbarianrate, "game.barbarians"); secfile_insert_int(file, game.onsetbarbarian, "game.onsetbarbs"); Index: server/stdinhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v retrieving revision 1.194 diff -u -r1.194 stdinhand.c --- server/stdinhand.c 2001/10/26 07:33:24 1.194 +++ server/stdinhand.c 2001/11/23 19:33:13 @@ -759,6 +759,14 @@ "period elapses. If a client doesn't reply with a PONG before the " "next server PING request the client is disconnected.") }, + { "savepalace", &game.savepalace, NULL, NULL, + SSET_META, SSET_TO_CLIENT, + 0, 1, 1, + N_("Whether palace is moved when capital is conquered"), + N_("If this is set to 1 when the capital is conquered, palace is " + "automatically rebuilt in another randomly choosed city, regardless " + "on the knowledge of Masonry.") }, + { "turnblock", &game.turnblock, NULL, NULL, SSET_META, SSET_TO_CLIENT, 0, 1, 0,