diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/common/map.c modciv/common/map.c --- freeciv/common/map.c Sun May 6 01:54:28 2001 +++ modciv/common/map.c Sun May 6 02:02:54 2001 @@ -1182,3 +1182,64 @@ return TRUE; } + + +/************************************************************************** +Returns whether the tile was modified. +**************************************************************************/ +int remove_illegal_specials(int x, int y) +{ + struct tile *ptile = map_get_tile(x, y); + int terrain = ptile->terrain; + struct tile_type *type = get_tile_type(terrain); + + int changed = 0; + + if (terrain == T_OCEAN) { + int illegal_specials = S_ROAD | S_IRRIGATION | S_RAILROAD | S_MINE + | S_POLLUTION | S_HUT | S_FORTRESS | S_RIVER | S_FARMLAND + | S_AIRBASE | S_FALLOUT; + + if (ptile->special & illegal_specials) { + ptile->special &= ~illegal_specials; + changed = 1; + } + } + + if (ptile->special & S_RAILROAD + && !(ptile->special & S_ROAD)) { + map_set_special(x, y, S_ROAD); + changed = 1; + } + + if (ptile->special & S_MINE + && terrain != type->mining_result) { + map_clear_special(x, y, S_MINE); + changed = 1; + } + + if (ptile->special & S_FARMLAND + && !(ptile->special & S_IRRIGATION)) { + map_set_special(x, y, S_IRRIGATION); + changed = 1; + } + + if ((ptile->special & S_IRRIGATION || ptile->special & S_FARMLAND) + && terrain != type->irrigation_result) { + map_clear_special(x, y, S_IRRIGATION); + map_clear_special(x, y, S_FARMLAND); + changed = 1; + } + + if (ptile->special & S_MINE && ptile->special & S_IRRIGATION) { + map_clear_special(x, y, S_MINE); + changed = 1; + } + + if (ptile->special & S_SPECIAL_1 && ptile->special & S_SPECIAL_2) { + map_clear_special(x, y, S_SPECIAL_2); + changed = 1; + } + + return changed; +} diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/common/map.h modciv/common/map.h --- freeciv/common/map.h Sun May 6 01:54:31 2001 +++ modciv/common/map.h Sun May 6 02:02:59 2001 @@ -235,6 +235,7 @@ char *map_get_infrastructure_text(int spe); int map_get_infrastructure_prerequisite(int spe); int get_preferred_pillage(int pset); +int remove_illegal_specials(int x, int y); void map_irrigate_tile(int x, int y); void map_mine_tile(int x, int y); diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/server/maphand.c modciv/server/maphand.c --- freeciv/server/maphand.c Sun May 6 01:54:36 2001 +++ modciv/server/maphand.c Sun May 6 02:03:03 2001 @@ -53,6 +53,19 @@ static int map_get_seen(int x, int y, int playerid); /************************************************************************** +... +**************************************************************************/ +static void check_terrain_specials(void) +{ + whole_map_iterate(x, y) { + if (remove_illegal_specials(x, y)) { + send_tile_info(NULL, x, y); + freelog(LOG_DEBUG, "Illegal special removed at %d,%d", x, y); + } + } whole_map_iterate_end; +} + +/************************************************************************** Used only in global_warming() and nuclear_winter() below. **************************************************************************/ static int is_terrain_ecologically_wet(int x, int y) @@ -120,6 +133,8 @@ } } + check_terrain_specials(); + notify_player_ex(0, -1, -1, E_GLOBAL_ECO, _("Game: Global warming has occurred!")); notify_player(0, _("Game: Coastlines have been flooded and vast " @@ -166,6 +181,8 @@ } unit_list_iterate_end; } } + + check_terrain_specials(); notify_player_ex(0, -1, -1, E_GLOBAL_ECO, _("Game: Nuclear winter has occurred!")); diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/server/savegame.c modciv/server/savegame.c --- freeciv/server/savegame.c Sun May 6 01:54:40 2001 +++ modciv/server/savegame.c Sun May 6 02:03:07 2001 @@ -433,9 +433,10 @@ /* Should be handled as part of send_all_know_tiles, but do it here too for safety */ - for(y=0; ysent = 0; + whole_map_iterate(x, y) { + map_get_tile(x,y)->sent = 0; + remove_illegal_specials(x, y); + } whole_map_iterate_end; } /***************************************************************