diff -ruN freeciv.orig/common/map.c freeciv/common/map.c --- freeciv.orig/common/map.c Sun Jun 18 11:27:06 2000 +++ freeciv/common/map.c Mon Jun 19 19:03:12 2000 @@ -570,6 +570,13 @@ } /*************************************************************** +return flags (OCEAN/LAND/SWEETWATER/...) for given terrain type +***************************************************************/ +enum terrain_flag terrain_get_flags (enum tile_terrain_type type) { + return get_tile_type (type)->flags; +} + +/*************************************************************** Check if terrain is ok for land units to be, infrastructure (transporters etc.) doesn't count @@ -577,7 +584,11 @@ but may change in future (T_ARCHIPELAGO, T_FJORD etc.) ***************************************************************/ int is_land (int x, int y) { +#if 1 return (map_get_terrain(x,y) != T_OCEAN); +#else + return (terrain_get_flags(map_get_terrain(x,y)) & TF_LAND); +#endif } /*************************************************************** @@ -585,7 +596,29 @@ infrastructure (cities etc.) doesn't count ***************************************************************/ int is_ocean (int x, int y) { +#if 1 return (map_get_terrain(x,y) == T_OCEAN); +#else + return (terrain_get_flags(map_get_terrain(x,y)) & TF_OCEAN); +#endif +} + +/*************************************************************** +Check if tile can supply water for irrigations +***************************************************************/ +int has_sweetwater (int x, int y) { + enum tile_terrain_type t; + enum tile_special_type s; + + t=map_get_terrain(x,y); +#if 1 + if ((t == T_OCEAN) || (t == T_RIVER)) return 1; +#else + if (terrain_get_flags(t) & TF_SWEETWATER) return 1; +#endif + s=map_get_special(x,y); + if ((s & S_RIVER) || (s & S_IRRIGATION)) return 1; + return 0; } /*************************************************************** diff -ruN freeciv.orig/common/map.h freeciv/common/map.h --- freeciv.orig/common/map.h Sat Jun 17 23:21:09 2000 +++ freeciv/common/map.h Mon Jun 19 19:03:25 2000 @@ -219,8 +219,10 @@ int is_special_close(int x, int y); int is_special_type_close(int x, int y, enum tile_special_type spe); int is_sea_usable(int x, int y); +enum terrain_flag terrain_get_flags (enum tile_terrain_type type); int is_land (int x, int y); int is_ocean (int x, int y); +int has_sweetwater (int x, int y); int get_tile_food_base(struct tile * ptile); int get_tile_shield_base(struct tile * ptile); int get_tile_trade_base(struct tile * ptile); diff -ruN freeciv.orig/server/settlers.c freeciv/server/settlers.c --- freeciv.orig/server/settlers.c Wed Jun 14 13:18:04 2000 +++ freeciv/server/settlers.c Mon Jun 19 18:53:39 2000 @@ -525,16 +525,8 @@ **************************************************************************/ static int is_wet(struct player *pplayer, int x, int y) { - enum tile_terrain_type t; - enum tile_special_type s; - if (!pplayer->ai.control && !map_get_known(x, y, pplayer)) return 0; - - t=map_get_terrain(x,y); - if (t == T_OCEAN || t == T_RIVER) return 1; - s=map_get_special(x,y); - if ((s & S_RIVER) || (s & S_IRRIGATION)) return 1; - return 0; + return has_sweetwater (x,y); } /**************************************************************************