diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/common/map.c diffciv/common/map.c --- freeciv/common/map.c Fri Jun 22 14:04:41 2001 +++ diffciv/common/map.c Sun Jul 1 13:35:15 2001 @@ -861,6 +861,58 @@ change_terrain(x, y, result); } +/************************************************************************** +This function returns true if the tile at the given location can be +"reclaimed" from ocean into land. This is the case only when there are +a sufficient number of adjacent tiles that are not ocean. +**************************************************************************/ +int can_reclaim_ocean(int x, int y) +{ + int landtiles; + + if (terrain_control.ocean_reclaim_requirement >= 9) + return 0; + if (terrain_control.ocean_reclaim_requirement <= 0) + return 1; + + landtiles = 0; + adjc_iterate(x, y, x1, y1) { + if (map_get_tile(x1, y1)->terrain != T_OCEAN) { + landtiles++; + } + if (landtiles >= terrain_control.ocean_reclaim_requirement) + return 1; + } adjc_iterate_end; + + return 0; +} + +/************************************************************************** +This function returns true if the tile at the given location can be +"channeled" from land into ocean. This is the case only when there are +a sufficient number of adjacent tiles that are ocean. +**************************************************************************/ +int can_channel_land(int x, int y) +{ + int oceantiles; + + if (terrain_control.land_channel_requirement >= 9) + return 0; + if (terrain_control.land_channel_requirement <= 0) + return 1; + + oceantiles = 0; + adjc_iterate(x, y, x1, y1) { + if (map_get_tile(x1, y1)->terrain == T_OCEAN) { + oceantiles++; + } + if (oceantiles >= terrain_control.land_channel_requirement) + return 1; + } adjc_iterate_end; + + return 0; +} + /*************************************************************** The basic cost to move punit from tile t1 to tile t2. That is, tile_move_cost(), with pre-calculated tile pointers; diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/common/map.h diffciv/common/map.h --- freeciv/common/map.h Wed Jun 20 14:55:13 2001 +++ diffciv/common/map.h Sun Jul 1 13:35:35 2001 @@ -244,6 +244,8 @@ void map_mine_tile(int x, int y); void change_terrain(int x, int y, enum tile_terrain_type type); void map_transform_tile(int x, int y); +int can_reclaim_ocean(int x, int y); +int can_channel_land(int x, int y); int map_build_road_time(int x, int y); int map_build_irrigation_time(int x, int y); diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/common/unit.c diffciv/common/unit.c --- freeciv/common/unit.c Wed Jun 20 14:57:00 2001 +++ diffciv/common/unit.c Sun Jul 1 13:35:48 2001 @@ -553,58 +553,6 @@ } /************************************************************************** -This function returns true if the tile at the given location can be -"reclaimed" from ocean into land. This is the case only when there are -a sufficient number of adjacent tiles that are not ocean. -**************************************************************************/ -static int can_reclaim_ocean(int x, int y) -{ - int landtiles; - - if (terrain_control.ocean_reclaim_requirement >= 9) - return 0; - if (terrain_control.ocean_reclaim_requirement <= 0) - return 1; - - landtiles = 0; - adjc_iterate(x, y, x1, y1) { - if (map_get_tile(x1, y1)->terrain != T_OCEAN) { - landtiles++; - } - if (landtiles >= terrain_control.ocean_reclaim_requirement) - return 1; - } adjc_iterate_end; - - return 0; -} - -/************************************************************************** -This function returns true if the tile at the given location can be -"channeled" from land into ocean. This is the case only when there are -a sufficient number of adjacent tiles that are ocean. -**************************************************************************/ -static int can_channel_land(int x, int y) -{ - int oceantiles; - - if (terrain_control.land_channel_requirement >= 9) - return 0; - if (terrain_control.land_channel_requirement <= 0) - return 1; - - oceantiles = 0; - adjc_iterate(x, y, x1, y1) { - if (map_get_tile(x1, y1)->terrain == T_OCEAN) { - oceantiles++; - } - if (oceantiles >= terrain_control.land_channel_requirement) - return 1; - } adjc_iterate_end; - - return 0; -} - -/************************************************************************** Check if the unit's current activity is actually legal. **************************************************************************/ int can_unit_continue_current_activity(struct unit *punit) diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/server/settlers.c diffciv/server/settlers.c --- freeciv/server/settlers.c Fri Jun 1 16:22:54 2001 +++ diffciv/server/settlers.c Sun Jul 1 13:31:11 2001 @@ -586,7 +586,12 @@ type = get_tile_type(t); s = ptile->special; r = type->transform_result; - + + if (t == T_OCEAN && !can_reclaim_ocean(x, y)) + return -1; + if (r == T_OCEAN && !can_channel_land(x, y)) + return -1; + if ((t == T_ARCTIC || t == T_DESERT || t == T_JUNGLE || t == T_SWAMP || t == T_TUNDRA || t == T_MOUNTAINS) && r != T_LAST) { if (r == T_OCEAN && ptile->city)