<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40165 >
2008/3/24 Marko Lindqvist: > > TERRAIN_XXX_IDENTIFIER definitions have to go, and terrains must be > selected by properly checking their flags, ocean_depth -value, or what > ever is appropriate for each case. Attached patch removes code that creates these special ocean types. If such special features are needed in the future, they should be reimplemented in a proper, generic, fashion. civ1 & civ2 rulesets have only one ocean type, default ruleset three types; Lake, Ocean and Deep Ocean. - ML
diff -Nurd -X.diff_ignore freeciv/client/control.c freeciv/client/control.c --- freeciv/client/control.c 2008-06-24 01:37:58.000000000 +0300 +++ freeciv/client/control.c 2008-06-30 21:01:55.000000000 +0300 @@ -2858,14 +2858,6 @@ } /************************************************************************** - Regenerate water. -**************************************************************************/ -void key_editor_regenerate_water(void) -{ - send_packet_edit_regenerate_water(&client.conn); -} - -/************************************************************************** Send a request to the server to toggle fog-of-war for the current player (only applies in edit mode). **************************************************************************/ diff -Nurd -X.diff_ignore freeciv/client/control.h freeciv/client/control.h --- freeciv/client/control.h 2008-06-24 01:37:58.000000000 +0300 +++ freeciv/client/control.h 2008-06-30 21:02:04.000000000 +0300 @@ -194,7 +194,6 @@ void key_editor_toggle(void); void key_editor_recalculate_borders(void); -void key_editor_regenerate_water(void); void key_editor_toggle_fogofwar(void); /* don't change this unless you also put more entries in data/Freeciv */ diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/menu.c freeciv/client/gui-gtk-2.0/menu.c --- freeciv/client/gui-gtk-2.0/menu.c 2008-06-24 01:37:56.000000000 +0300 +++ freeciv/client/gui-gtk-2.0/menu.c 2008-06-30 21:03:08.000000000 +0300 @@ -169,7 +169,6 @@ MENU_EDITOR_TOGGLE, MENU_EDITOR_RECALCULATE_BORDERS, - MENU_EDITOR_REGENERATE_WATER, MENU_EDITOR_TOGGLE_FOGOFWAR, MENU_HELP_LANGUAGES, @@ -632,9 +631,6 @@ case MENU_EDITOR_RECALCULATE_BORDERS: key_editor_recalculate_borders(); break; - case MENU_EDITOR_REGENERATE_WATER: - key_editor_regenerate_water(); - break; case MENU_EDITOR_TOGGLE_FOGOFWAR: key_editor_toggle_fogofwar(); break; @@ -806,8 +802,6 @@ editor_menu_callback, MENU_EDITOR_TOGGLE, "<CheckItem>" }, { "/" N_("_Edit") "/" N_("Recalculate _Borders"), NULL, editor_menu_callback, MENU_EDITOR_RECALCULATE_BORDERS }, - { "/" N_("_Edit") "/" N_("Regenerate _Water"), NULL, - editor_menu_callback, MENU_EDITOR_REGENERATE_WATER }, { "/" N_("_Edit") "/" N_("Toggle Fog-of-war"), "<control>f", editor_menu_callback, MENU_EDITOR_TOGGLE_FOGOFWAR }, diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def --- freeciv/common/packets.def 2008-06-30 12:02:12.000000000 +0300 +++ freeciv/common/packets.def 2008-06-30 20:41:22.000000000 +0300 @@ -1427,9 +1427,6 @@ BOOL state; end -PACKET_EDIT_REGENERATE_WATER=151;cs,handle-per-conn -end - PACKET_EDIT_RECALCULATE_BORDERS=152;cs,handle-per-conn end diff -Nurd -X.diff_ignore freeciv/common/terrain.h freeciv/common/terrain.h --- freeciv/common/terrain.h 2008-06-28 20:49:38.000000000 +0300 +++ freeciv/common/terrain.h 2008-06-30 21:16:26.000000000 +0300 @@ -152,13 +152,7 @@ char identifier; /* Single-character identifier used in savegames. */ -#define TERRAIN_SEA_IDENTIFIER '-' -#define TERRAIN_OCEAN_IDENTIFIER ' ' -#define TERRAIN_SHELF_IDENTIFIER ',' -#define TERRAIN_FLOOR_IDENTIFIER ':' -#define TERRAIN_RIDGE_IDENTIFIER '^' -#define TERRAIN_GLACIER_IDENTIFIER 'a' -#define TERRAIN_UNKNOWN_IDENTIFIER 'u' +#define TERRAIN_UNKNOWN_IDENTIFIER '?' int movement_cost; int defense_bonus; /* % defense bonus - defaults to zero */ diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset --- freeciv/data/civ1/terrain.ruleset 2008-06-30 12:02:12.000000000 +0300 +++ freeciv/data/civ1/terrain.ruleset 2008-06-30 21:13:09.000000000 +0300 @@ -172,41 +172,6 @@ ; helptext = optional help text string; should escape all raw ; newlines so that xgettext parsing works -[terrain_salt_water_coast] -name = _("Sea") -graphic = "coast" -graphic_alt = "-" -identifier = "-" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -resources = "resource_fish" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile" -flags = "Oceanic", "NoCities", "NoPollution" -property_ocean_depth = 0 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - [terrain_ocean] name = _("Ocean") graphic = "coast" @@ -242,181 +207,6 @@ Ocean squares can never be polluted or subjected to fallout.\ ") -[terrain_ocean_shelf] -name = _("?ocean:Shelf") -graphic = "shelf" -graphic_alt = "coast" -identifier = "," -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -resources = "resource_fish" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 48 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_floor] -name = _("Briny Deep") -graphic = "floor" -graphic_alt = "coast" -identifier = ":" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 87 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_trench] -name = _("?ocean:Abyss") -graphic = "trench" -graphic_alt = "coast" -identifier = ";" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 99 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_ridge] -name = _("Oceanic Ridge") -graphic = "ridge" -graphic_alt = "coast" -identifier = "^" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 36 ; same as coast, for now -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_vent] -name = _("Oceanic Vent") -graphic = "vent" -graphic_alt = "coast" -identifier = "!" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 36 ; same as ridge, not generated -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - [terrain_arctic] name = _("Arctic") graphic = "arctic" diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset --- freeciv/data/civ2/terrain.ruleset 2008-06-30 12:02:12.000000000 +0300 +++ freeciv/data/civ2/terrain.ruleset 2008-06-30 21:13:48.000000000 +0300 @@ -180,41 +180,6 @@ ; helptext = optional help text string; should escape all raw ; newlines so that xgettext parsing works -[terrain_salt_water_coast] -name = _("Sea") -graphic = "coast" -graphic_alt = "-" -identifier = "-" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -resources = "resource_fish" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution" -property_ocean_depth = 0 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - [terrain_ocean] name = _("Ocean") graphic = "coast" @@ -250,181 +215,6 @@ Ocean squares can never be polluted or subjected to fallout.\ ") -[terrain_ocean_shelf] -name = _("?ocean:Shelf") -graphic = "shelf" -graphic_alt = "coast" -identifier = "," -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -resources = "resource_fish", "resource_whales" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 48 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_floor] -name = _("Briny Deep") -graphic = "floor" -graphic_alt = "coast" -identifier = ":" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 87 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_trench] -name = _("?ocean:Abyss") -graphic = "trench" -graphic_alt = "coast" -identifier = ";" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 99 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_ridge] -name = _("Oceanic Ridge") -graphic = "ridge" -graphic_alt = "coast" -identifier = "^" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 36 ; same as coast, for now -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_vent] -name = _("Oceanic Vent") -graphic = "vent" -graphic_alt = "coast" -identifier = "!" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 36 ; same as ridge, not generated -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - [terrain_glacier] name = _("Glacier") graphic = "arctic" diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset --- freeciv/data/default/terrain.ruleset 2008-06-30 12:02:12.000000000 +0300 +++ freeciv/data/default/terrain.ruleset 2008-06-30 21:08:47.000000000 +0300 @@ -180,7 +180,7 @@ ; helptext = optional help text string; should escape all raw ; newlines so that xgettext parsing works -[terrain_fresh_water_lake] +[terrain_lake] name = _("Lake") graphic = "lake" graphic_alt = "coast" @@ -215,44 +215,6 @@ Lake squares can never be polluted or subjected to fallout.\ ") -[terrain_salt_water_coast] -name = _("Sea") -graphic = "coast" -graphic_alt = "-" -identifier = "-" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -resources = "resource_fish" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "terrain_swamp" -transform_time = 36 -rail_time = 3 -clean_pollution_time = 3 -clean_fallout_time = 3 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter", "Trireme" -flags = "Oceanic", "NoCities", "NoPollution" -property_ocean_depth = 0 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - [terrain_ocean] name = _("Ocean") graphic = "coast" @@ -291,46 +253,8 @@ Ocean squares can never be polluted or subjected to fallout.\ ") -[terrain_ocean_shelf] -name = _("?ocean:Shelf") -graphic = "shelf" -graphic_alt = "coast" -identifier = "," -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -resources = "resource_fish", "resource_whales" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -rail_time = 3 -clean_pollution_time = 3 -clean_fallout_time = 3 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter", "Trireme" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 48 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_floor] -name = _("Briny Deep") +[terrain_deep_ocean] +name = _("Deep Ocean") graphic = "floor" graphic_alt = "coast" identifier = ":" @@ -367,120 +291,6 @@ Ocean squares can never be polluted or subjected to fallout.\ ") -[terrain_ocean_trench] -name = _("?ocean:Abyss") -graphic = "trench" -graphic_alt = "coast" -identifier = ";" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -rail_time = 3 -clean_pollution_time = 3 -clean_fallout_time = 3 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 99 -helptext = _("\ -Oceans cover much of the world, and only seaworthy units\ - can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_ridge] -name = _("Oceanic Ridge") -graphic = "ridge" -graphic_alt = "coast" -identifier = "^" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -rail_time = 3 -clean_pollution_time = 3 -clean_fallout_time = 3 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter", "Trireme" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 36 ; same as coast, for now -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_ocean_vent] -name = _("Oceanic Vent") -graphic = "vent" -graphic_alt = "coast" -identifier = "!" -movement_cost = 1 -defense_bonus = 0 -food = 1 -shield = 0 -trade = 2 -;resources = "none" -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -rail_time = 3 -clean_pollution_time = 3 -clean_fallout_time = 3 -warmer_wetter_result = "no" -warmer_drier_result = "no" -cooler_wetter_result = "no" -cooler_drier_result = "no" -native_to = "Sea", "Air", "Missile", "Helicopter" -flags = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast" -property_ocean_depth = 36 ; same as ridge, not generated -helptext = _("\ -Oceans cover much of the world, and only seaworthy units\ - can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - [terrain_glacier] name = _("Glacier") graphic = "arctic" diff -Nurd -X.diff_ignore freeciv/server/edithand.c freeciv/server/edithand.c --- freeciv/server/edithand.c 2008-06-28 20:49:38.000000000 +0300 +++ freeciv/server/edithand.c 2008-06-30 20:41:28.000000000 +0300 @@ -888,20 +888,6 @@ } /**************************************************************************** - Client editor requests us to regenerate water. -****************************************************************************/ -void handle_edit_regenerate_water(struct connection *pc) -{ - if (!can_conn_edit(pc)) { - notify_conn(pc->self, NULL, E_BAD_COMMAND, - _("You are not allowed to edit.")); - return; - } - - regenerate_water(update_tile_knowledge); -} - -/**************************************************************************** Remove any city at the given location. ****************************************************************************/ void handle_edit_city_remove(struct connection *pc, int x, int y) diff -Nurd -X.diff_ignore freeciv/server/generator/mapgen.c freeciv/server/generator/mapgen.c --- freeciv/server/generator/mapgen.c 2008-06-30 12:02:12.000000000 +0300 +++ freeciv/server/generator/mapgen.c 2008-06-30 20:58:57.000000000 +0300 @@ -1104,12 +1104,12 @@ **************************************************************************/ static void remove_tiny_islands(void) { - struct terrain *ridge = find_terrain_by_identifier(TERRAIN_RIDGE_IDENTIFIER); + struct terrain *shallow = most_shallow_ocean(); - assert(NULL != ridge); + assert(NULL != shallow); whole_map_iterate(ptile) { if (is_tiny_island(ptile)) { - tile_set_terrain(ptile, ridge); + tile_set_terrain(ptile, shallow); tile_clear_special(ptile, S_RIVER); tile_set_continent(ptile, 0); } @@ -1219,11 +1219,11 @@ remove_tiny_islands(); } - /* Continent numbers must be assigned before regenerate_water() */ + /* Continent numbers must be assigned before regenerate_lakes() */ assign_continent_numbers(); /* Make second pass on water. */ - regenerate_water(NULL); + regenerate_lakes(NULL); } else { assign_continent_numbers(); } diff -Nurd -X.diff_ignore freeciv/server/generator/utilities.c freeciv/server/generator/utilities.c --- freeciv/server/generator/utilities.c 2008-06-30 12:02:12.000000000 +0300 +++ freeciv/server/generator/utilities.c 2008-06-30 20:58:05.000000000 +0300 @@ -314,19 +314,11 @@ FIXME: Results differ from initially generated waters, but this is not used at all in normal map generation. **************************************************************************/ -void regenerate_water(tile_knowledge_cb knowledge_cb) +void regenerate_lakes(tile_knowledge_cb knowledge_cb) { #define MAX_ALT_TER_TYPES 5 #define DEFAULT_NEAR_COAST (6) struct terrain *lakes[MAX_ALT_TER_TYPES]; - struct terrain *sea = find_terrain_by_identifier(TERRAIN_SEA_IDENTIFIER); - struct terrain *coast = find_terrain_by_identifier(TERRAIN_OCEAN_IDENTIFIER); - struct terrain *shelf = find_terrain_by_identifier(TERRAIN_SHELF_IDENTIFIER); - struct terrain *floor = find_terrain_by_identifier(TERRAIN_FLOOR_IDENTIFIER); - int coast_depth = coast->property[MG_OCEAN_DEPTH]; - int coast_count = 0; - int shelf_count = 0; - int floor_count = 0; int num_laketypes; num_laketypes = terrains_by_flag(TER_FRESHWATER, lakes, sizeof(lakes)); @@ -338,158 +330,29 @@ #undef MAX_ALT_TER_TYPES - /* coasts, lakes, and seas */ - whole_map_iterate(ptile) { - struct terrain *pterrain = tile_terrain(ptile); - Continent_id here = tile_continent(ptile); - - if (T_UNKNOWN == pterrain) { - continue; - } - if (!terrain_has_flag(pterrain, TER_OCEANIC)) { - continue; - } - if (0 < lake_surrounders[-here]) { - if (terrain_control.lake_max_size >= ocean_sizes[-here] - && num_laketypes > 0) { - tile_change_terrain(ptile, lakes[myrand(num_laketypes)]); - } else { - tile_change_terrain(ptile, sea); - } - if (knowledge_cb) { - knowledge_cb(ptile); - } - continue; - } - /* leave any existing deep features in place */ - if (pterrain->property[MG_OCEAN_DEPTH] > coast_depth) { - continue; - } - - /* default to shelf */ - tile_change_terrain(ptile, shelf); - if (knowledge_cb) { - knowledge_cb(ptile); - } - shelf_count++; + if (num_laketypes > 0) { + /* Lakes */ + whole_map_iterate(ptile) { + struct terrain *pterrain = tile_terrain(ptile); + Continent_id here = tile_continent(ptile); - adjc_iterate(ptile, tile2) { - struct terrain *pterrain2 = tile_terrain(tile2); - if (T_UNKNOWN == pterrain2) { + if (T_UNKNOWN == pterrain) { continue; } - /* glacier not otherwise near land floats */ - if (TERRAIN_GLACIER_IDENTIFIER == terrain_identifier(pterrain2)) { + if (!terrain_has_flag(pterrain, TER_OCEANIC)) { continue; } - /* any land makes coast */ - if (!terrain_has_flag(pterrain2, TER_OCEANIC)) { - tile_change_terrain(ptile, coast); + if (0 < lake_surrounders[-here]) { + if (terrain_control.lake_max_size >= ocean_sizes[-here]) { + tile_change_terrain(ptile, lakes[myrand(num_laketypes)]); + } if (knowledge_cb) { knowledge_cb(ptile); } - coast_count++; - shelf_count--; - break; - } - } adjc_iterate_end; - } whole_map_iterate_end; - - /* continental shelf */ - whole_map_iterate(ptile) { - struct terrain *pterrain = tile_terrain(ptile); - int shallow = 0; - - if (T_UNKNOWN == pterrain) { - continue; - } - if (!terrain_has_flag(pterrain, TER_OCEANIC)) { - continue; - } - /* leave any other existing features in place */ - if (pterrain != shelf) { - continue; - } - - adjc_iterate(ptile, tile2) { - struct terrain *pterrain2 = tile_terrain(tile2); - if (T_UNKNOWN == pterrain2) continue; - - switch (terrain_identifier(pterrain2)) { - case TERRAIN_OCEAN_IDENTIFIER: - shallow++; - break; - default: - break; - }; - } adjc_iterate_end; - - if (DEFAULT_NEAR_COAST < shallow) { - /* smooth with neighbors */ - tile_change_terrain(ptile, coast); - if (knowledge_cb) { - knowledge_cb(ptile); - } - coast_count++; - shelf_count--; - } else if (0 == shallow) { - tile_change_terrain(ptile, floor); - if (knowledge_cb) { - knowledge_cb(ptile); } - floor_count++; - shelf_count--; - } - } whole_map_iterate_end; - - /* deep ocean floor */ - whole_map_iterate(ptile) { - struct terrain *pterrain = tile_terrain(ptile); - int shallow = 0; - - if (T_UNKNOWN == pterrain) { - continue; - } - if (!terrain_has_flag(pterrain, TER_OCEANIC)) { - continue; - } - /* leave any other existing features in place */ - if (pterrain != floor) { - continue; - } - - adjc_iterate(ptile, tile2) { - struct terrain *pterrain2 = tile_terrain(tile2); - if (T_UNKNOWN == pterrain2) - continue; - - switch (terrain_identifier(pterrain2)) { - case TERRAIN_GLACIER_IDENTIFIER: - case TERRAIN_OCEAN_IDENTIFIER: - case TERRAIN_SHELF_IDENTIFIER: - shallow++; - break; - default: - break; - }; - } adjc_iterate_end; - - if (DEFAULT_NEAR_COAST < shallow) { - /* smooth with neighbors */ - tile_change_terrain(ptile, shelf); - if (knowledge_cb) { - knowledge_cb(ptile); - } - floor_count--; - shelf_count++; - } - } whole_map_iterate_end; - - freelog(LOG_VERBOSE, "Map has %d coast, %d shelf, and %d floor tiles", - coast_count, - shelf_count, - floor_count); + } whole_map_iterate_end; + } } /************************************************************************** @@ -570,3 +433,29 @@ freelog(LOG_VERBOSE, "Map has %d continents and %d oceans", map.num_continents, map.num_oceans); } + +/************************************************************************** + Return most shallow ocean terrain type. Freshwater lakes are not + considered, if there is any salt water terrain types. +**************************************************************************/ +struct terrain *most_shallow_ocean(void) +{ + bool oceans = FALSE; + struct terrain *shallow = NULL; + + terrain_type_iterate(pterr) { + if (is_ocean(pterr)) { + if (!oceans && !terrain_has_flag(pterr, TER_FRESHWATER)) { + /* First ocean type */ + oceans = TRUE; + shallow = pterr; + } else if (!shallow + || pterr->property[MG_OCEAN_DEPTH] < + shallow->property[MG_OCEAN_DEPTH]) { + shallow = pterr; + } + } + } terrain_type_iterate_end; + + return shallow; +} diff -Nurd -X.diff_ignore freeciv/server/generator/utilities.h freeciv/server/generator/utilities.h --- freeciv/server/generator/utilities.h 2008-06-28 20:49:38.000000000 +0300 +++ freeciv/server/generator/utilities.h 2008-06-30 20:58:24.000000000 +0300 @@ -15,12 +15,14 @@ typedef void (*tile_knowledge_cb)(struct tile *ptile); -void regenerate_water(tile_knowledge_cb knowledge_cb); +void regenerate_lakes(tile_knowledge_cb knowledge_cb); void assign_continent_numbers(void); int get_lake_surrounders(Continent_id cont); int get_continent_size(Continent_id id); int get_ocean_size(Continent_id id); +struct terrain *most_shallow_ocean(void); + /* Provide a block to convert from native to map coordinates. For instance * do_in_map_pos(mx, my, xn, yn) { * tile_set_terrain(mx, my, T_OCEAN); diff -Nurd -X.diff_ignore freeciv/version.in freeciv/version.in --- freeciv/version.in 2008-06-30 12:02:12.000000000 +0300 +++ freeciv/version.in 2008-06-30 20:41:52.000000000 +0300 @@ -23,5 +23,5 @@ # - Avoid adding a new mandatory capability to the development branch for # as long as possible. We want to maintain network compatibility with # the stable branch for as long as possible. -NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel.2008.Jun.30" +NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel.2008.Jul.01" NETWORK_CAPSTRING_OPTIONAL=""
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev