Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12773) remove map_has_special
Home

[Freeciv-Dev] (PR#12773) remove map_has_special

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12773) remove map_has_special
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Apr 2005 23:13:42 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12773 >

map.h has two functions map_has_special and tile_has_special.  They are 
in all ways identical.  This is a remnant of the old interface when 
map_has_special took an (x,y) coordinates while tile_has_special took a 
pointer.

This patch removes map_has_special from map.[ch] and replaces all its 
users with tile_has_special.  The latter is strict search-and-replace.

In general I'd like to use the tile_xxx interface for all local-tile 
functions.  This means lots of renaming.  map_xxx functions are then 
used for global (e.g., civ_map) functions.  We can also have a tile.h 
that splits off a large part of map.h (which is the largest .h file in 
common/).  Lots of code will be moved around but it should all be 
straightforward.

-jason

? diff
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.61
diff -u -r1.61 aidata.c
--- ai/aidata.c 21 Mar 2005 14:10:53 -0000      1.61
+++ ai/aidata.c 12 Apr 2005 06:08:41 -0000
@@ -507,7 +507,7 @@
       /* we don't need more explaining, we got the point */
       continue;
     }
-    if (map_has_special(ptile, S_HUT) 
+    if (tile_has_special(ptile, S_HUT) 
         && (!ai_handicap(pplayer, H_HUTS)
              || map_is_known(ptile, pplayer))) {
       ai->explore.land_done = FALSE;
Index: ai/aiexplorer.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiexplorer.c,v
retrieving revision 1.9
diff -u -r1.9 aiexplorer.c
--- ai/aiexplorer.c     20 Mar 2005 12:56:20 -0000      1.9
+++ ai/aiexplorer.c     12 Apr 2005 06:08:41 -0000
@@ -178,7 +178,7 @@
   if ((unit_flag(punit, F_TRIREME) && 
        is_likely_trireme_loss(pplayer, ptile))
       || map_get_city(ptile)
-      || (is_barbarian(pplayer) && map_has_special(ptile, S_HUT))) {
+      || (is_barbarian(pplayer) && tile_has_special(ptile, S_HUT))) {
     return 0;
   }
 
@@ -228,7 +228,7 @@
 
   if ((!pplayer->ai.control || !ai_handicap(pplayer, H_HUTS))
       && map_is_known(ptile, pplayer)
-      && map_has_special(ptile, S_HUT)) {
+      && tile_has_special(ptile, S_HUT)) {
     /* we want to explore huts whenever we can,
      * even if doing so will not uncover any tiles. */
     desirable += HUT_SCORE;
Index: ai/aisettler.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aisettler.c,v
retrieving revision 1.17
diff -u -r1.17 aisettler.c
--- ai/aisettler.c      14 Mar 2005 20:26:24 -0000      1.17
+++ ai/aisettler.c      12 Apr 2005 06:08:41 -0000
@@ -297,7 +297,7 @@
   /* Defense modification (as tie breaker mostly) */
   int defense_bonus = 
             get_tile_type(map_get_terrain(result->tile))->defense_bonus;
-  if (map_has_special(result->tile, S_RIVER)) {
+  if (tile_has_special(result->tile, S_RIVER)) {
     defense_bonus +=
         (defense_bonus * terrain_control.river_defense_bonus) / 100;
   }
Index: ai/aitools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v
retrieving revision 1.143
diff -u -r1.143 aitools.c
--- ai/aitools.c        5 Apr 2005 20:36:09 -0000       1.143
+++ ai/aitools.c        12 Apr 2005 06:08:42 -0000
@@ -465,7 +465,7 @@
 
   /* If we are on defensive terrain, we are more likely to survive */
   db = get_tile_type(ptile->terrain)->defense_bonus;
-  if (map_has_special(ptile, S_RIVER)) {
+  if (tile_has_special(ptile, S_RIVER)) {
     db += (db * terrain_control.river_defense_bonus) / 100;
   }
   p *= 10.0 / db;
Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.351
diff -u -r1.351 aiunit.c
--- ai/aiunit.c 5 Apr 2005 20:36:09 -0000       1.351
+++ ai/aiunit.c 12 Apr 2005 06:08:42 -0000
@@ -601,7 +601,7 @@
     }
     
     /* ...or tiny pleasant hut here! */
-    if (map_has_special(ptile, S_HUT) && !is_barbarian(pplayer)) {
+    if (tile_has_special(ptile, S_HUT) && !is_barbarian(pplayer)) {
       
       return -RAMPAGE_HUT_OR_BETTER;
     }
@@ -814,7 +814,7 @@
       if (ok > 0) {
        /* accessible beachhead with zoc-ok water tile nearby */
         ok = get_tile_type(t)->defense_bonus;
-       if (map_has_special(tile1, S_RIVER))
+       if (tile_has_special(tile1, S_RIVER))
          ok += (ok * terrain_control.river_defense_bonus) / 100;
         if (get_tile_type(t)->movement_cost * SINGLE_MOVE <
             unit_move_rate(punit))
Index: client/goto.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.c,v
retrieving revision 1.82
diff -u -r1.82 goto.c
--- client/goto.c       19 Feb 2005 17:15:13 -0000      1.82
+++ client/goto.c       12 Apr 2005 06:08:42 -0000
@@ -399,7 +399,7 @@
     if (ttype->irrigation_time == 0) {
       return -1;
     }
-    if (map_has_special(ptile, S_MINE)) {
+    if (tile_has_special(ptile, S_MINE)) {
       /* Don't overwrite mines. */
       return -1;
     }
@@ -496,11 +496,11 @@
 
   /* Special cases: get_MC function doesn't know that we would have built
    * a road (railroad) on src tile by that time */
-  if (map_has_special(dest_tile, S_ROAD)) {
+  if (tile_has_special(dest_tile, S_ROAD)) {
     move_cost = MOVE_COST_ROAD;
   }
   if (connect_activity == ACTIVITY_RAILROAD
-      && map_has_special(dest_tile, S_RAILROAD)) {
+      && tile_has_special(dest_tile, S_RAILROAD)) {
     move_cost = MOVE_COST_RAIL;
   }
 
@@ -926,7 +926,7 @@
   for (i = 0; i < path->length; i++) {
     switch (activity) {
     case ACTIVITY_IRRIGATE:
-      if (!map_has_special(old_tile, S_IRRIGATION)) {
+      if (!tile_has_special(old_tile, S_IRRIGATION)) {
        /* Assume the unit can irrigate or we wouldn't be here. */
        p.orders[p.length] = ORDER_ACTIVITY;
        p.activity[p.length] = ACTIVITY_IRRIGATE;
@@ -935,14 +935,14 @@
       break;
     case ACTIVITY_ROAD:
     case ACTIVITY_RAILROAD:
-      if (!map_has_special(old_tile, S_ROAD)) {
+      if (!tile_has_special(old_tile, S_ROAD)) {
        /* Assume the unit can build the road or we wouldn't be here. */
        p.orders[p.length] = ORDER_ACTIVITY;
        p.activity[p.length] = ACTIVITY_ROAD;
        p.length++;
       }
       if (activity == ACTIVITY_RAILROAD) {
-       if (!map_has_special(old_tile, S_RAILROAD)) {
+       if (!tile_has_special(old_tile, S_RAILROAD)) {
          /* Assume the unit can build the rail or we wouldn't be here. */
          p.orders[p.length] = ORDER_ACTIVITY;
          p.activity[p.length] = ACTIVITY_RAILROAD;
Index: client/gui-ftwl/gui_text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/gui_text.c,v
retrieving revision 1.4
diff -u -r1.4 gui_text.c
--- client/gui-ftwl/gui_text.c  22 Jan 2005 19:45:39 -0000      1.4
+++ client/gui-ftwl/gui_text.c  12 Apr 2005 06:08:43 -0000
@@ -309,7 +309,7 @@
       && (tinfo->irrigation_result != ttype)) {
     my_snprintf(irrtext, sizeof(irrtext), irrfmt,
                (get_tile_type(tinfo->irrigation_result))->terrain_name);
-  } else if (map_has_special(punit->tile, S_IRRIGATION)
+  } else if (tile_has_special(punit->tile, S_IRRIGATION)
             && player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) {
     sz_strlcpy(irrtext, _("Bu_ild Farmland"));
   }
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.70
diff -u -r1.70 menu.c
--- client/gui-gtk-2.0/menu.c   8 Apr 2005 06:32:27 -0000       1.70
+++ client/gui-gtk-2.0/menu.c   12 Apr 2005 06:08:43 -0000
@@ -1409,7 +1409,7 @@
       if (unit_flag(punit, F_TRADE_ROUTE))
        menus_rename("<main>/_Orders/Build _Road", _("Make Trade _Route"));
       else if (unit_flag(punit, F_SETTLERS)) {
-       if (map_has_special(punit->tile, S_ROAD)) {
+       if (tile_has_special(punit->tile, S_ROAD)) {
          roadtext = _("Build _Railroad");
          road_activity=ACTIVITY_RAILROAD;  
        } 
@@ -1429,7 +1429,7 @@
        my_snprintf(irrtext, sizeof(irrtext), irrfmt,
                    get_tile_change_menu_text(punit->tile,
                                              ACTIVITY_IRRIGATE));
-      } else if (map_has_special(punit->tile, S_IRRIGATION)
+      } else if (tile_has_special(punit->tile, S_IRRIGATION)
                 && player_knows_techs_with_flag(game.player_ptr,
                                                 TF_FARMLAND)) {
        sz_strlcpy(irrtext, _("Bu_ild Farmland"));
Index: client/gui-mui/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/gui_main.c,v
retrieving revision 1.94
diff -u -r1.94 gui_main.c
--- client/gui-mui/gui_main.c   28 Mar 2005 16:59:14 -0000      1.94
+++ client/gui-mui/gui_main.c   12 Apr 2005 06:08:43 -0000
@@ -1300,7 +1300,7 @@
          && (tinfo->irrigation_result != ttype)) {
        my_snprintf(irrtext, sizeof(irrtext), chgfmt,
                    (get_tile_type(tinfo->irrigation_result))->terrain_name);
-      } else if (map_has_special(punit->tile, S_IRRIGATION)
+      } else if (tile_has_special(punit->tile, S_IRRIGATION)
                 && player_knows_techs_with_flag(game.player_ptr,
                                                 TF_FARMLAND)) {
        sz_strlcpy(irrtext, _("Build Farmland"));
@@ -1324,7 +1324,7 @@
         sz_strlcpy(transtext, _("Transform Terrain"));
       }
 
-      if (map_has_special(punit->tile, S_ROAD)) {
+      if (tile_has_special(punit->tile, S_ROAD)) {
        menu_entry_rename(MENU_ORDER_ROAD, _("Build Railroad"), FALSE);
       } else {
        menu_entry_rename(MENU_ORDER_ROAD, _("Build Road"), FALSE);
Index: client/gui-mui/mapclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapclass.c,v
retrieving revision 1.107
diff -u -r1.107 mapclass.c
--- client/gui-mui/mapclass.c   28 Mar 2005 16:59:14 -0000      1.107
+++ client/gui-mui/mapclass.c   12 Apr 2005 06:08:44 -0000
@@ -1700,7 +1700,7 @@
                if (can_unit_do_activity(punit, ACTIVITY_IRRIGATE))
                {
                  static char irrtext[64];
-                 if (map_has_special(punit->tile, S_IRRIGATION) &&
+                 if (tile_has_special(punit->tile, S_IRRIGATION) &&
                      player_knows_techs_with_flag(game.player_ptr, 
TF_FARMLAND))
                  {
                    sz_strlcpy(irrtext, _("Build Farmland"));
Index: client/gui-win32/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/menu.c,v
retrieving revision 1.35
diff -u -r1.35 menu.c
--- client/gui-win32/menu.c     14 Mar 2005 20:26:24 -0000      1.35
+++ client/gui-win32/menu.c     12 Apr 2005 06:08:44 -0000
@@ -1181,7 +1181,7 @@
       if (unit_flag(punit, F_TRADE_ROUTE)) {
        my_rename_menu(menu, IDM_ORDERS_ROAD, N_("Make Trade Route") "\tR");
       } else if (unit_flag(punit, F_SETTLERS)) {
-       if (map_has_special(punit->tile, S_ROAD)) {
+       if (tile_has_special(punit->tile, S_ROAD)) {
          roadtext = N_("Build Railroad") "\tR";
          road_activity = ACTIVITY_RAILROAD;  
        } else {
@@ -1199,7 +1199,7 @@
          && tinfo->irrigation_result != ttype) {
        my_snprintf(irrtext, sizeof(irrtext), irrfmt,
                    (get_tile_type(tinfo->irrigation_result))->terrain_name);
-      } else if (map_has_special(punit->tile, S_IRRIGATION)
+      } else if (tile_has_special(punit->tile, S_IRRIGATION)
                 && player_knows_techs_with_flag(game.player_ptr,
                                                 TF_FARMLAND)) {
        sz_strlcpy(irrtext, N_("Build Farmland") "\tI");
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.78
diff -u -r1.78 menu.c
--- client/gui-xaw/menu.c       14 Mar 2005 20:26:25 -0000      1.78
+++ client/gui-xaw/menu.c       12 Apr 2005 06:08:44 -0000
@@ -451,7 +451,7 @@
                          TEXT_ORDER_IRRIGATE_CHANGE_TO,
                          
(get_tile_type(tinfo->irrigation_result))->terrain_name);
       }
-      else if (map_has_special(punit->tile, S_IRRIGATION) &&
+      else if (tile_has_special(punit->tile, S_IRRIGATION) &&
               player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) {
        menu_entry_rename(MENU_ORDER, MENU_ORDER_IRRIGATE,
                          TEXT_ORDER_IRRIGATE_FARMLAND, NULL);
@@ -488,7 +488,7 @@
                          TEXT_ORDER_POLLUTION_POLLUTION, NULL);
       }
 
-      if (map_has_special(punit->tile, S_ROAD)) {
+      if (tile_has_special(punit->tile, S_ROAD)) {
        menu_entry_rename(MENU_ORDER, MENU_ORDER_ROAD,
                          TEXT_ORDER_ROAD_RAILROAD, NULL);
       } else {
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.325
diff -u -r1.325 city.c
--- common/city.c       10 Apr 2005 23:55:24 -0000      1.325
+++ common/city.c       12 Apr 2005 06:08:45 -0000
@@ -516,7 +516,7 @@
   }
 
   for (;*spec_gate!=S_NO_SPECIAL;spec_gate++) {
-    if (map_has_special(pcity->tile, *spec_gate) ||
+    if (tile_has_special(pcity->tile, *spec_gate) ||
         is_special_near_tile(pcity->tile, *spec_gate)) {
       return TRUE;
     }
Index: common/combat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v
retrieving revision 1.52
diff -u -r1.52 combat.c
--- common/combat.c     24 Mar 2005 21:39:33 -0000      1.52
+++ common/combat.c     12 Apr 2005 06:08:45 -0000
@@ -91,7 +91,7 @@
 
   /* 2. Only fighters can attack planes, except in city or airbase attacks */
   if (!unit_flag(punit, F_FIGHTER) && is_air_unit(pdefender)
-      && !(pcity || map_has_special(dest_tile, S_AIRBASE))) {
+      && !(pcity || tile_has_special(dest_tile, S_AIRBASE))) {
     return FALSE;
   }
 
@@ -321,7 +321,7 @@
 **************************************************************************/
 bool unit_on_fortress(const struct unit *punit)
 {
-  return map_has_special(punit->tile, S_FORTRESS);
+  return tile_has_special(punit->tile, S_FORTRESS);
 }
 
 /**************************************************************************
@@ -385,7 +385,7 @@
   int db, power = base_get_defense_power(punit);
 
   db = get_tile_type(punit->tile->terrain)->defense_bonus;
-  if (map_has_special(punit->tile, S_RIVER)) {
+  if (tile_has_special(punit->tile, S_RIVER)) {
     db += (db * terrain_control.river_defense_bonus) / 100;
   }
   power = (power * db) / 10;
@@ -463,7 +463,7 @@
     }
   }
 
-  if (map_has_special(ptile, S_FORTRESS) && !pcity) {
+  if (tile_has_special(ptile, S_FORTRESS) && !pcity) {
     defensepower +=
        (defensepower * terrain_control.fortress_defense_bonus) / 100;
   }
@@ -493,7 +493,7 @@
   }
 
   db = get_tile_type(t)->defense_bonus;
-  if (map_has_special(ptile, S_RIVER)) {
+  if (tile_has_special(ptile, S_RIVER)) {
     db += (db * terrain_control.river_defense_bonus) / 100;
   }
   defensepower *= db;
@@ -641,7 +641,7 @@
 bool is_stack_vulnerable(const struct tile *ptile)
 {
   return !(ptile->city != NULL
-           || map_has_special(ptile, S_FORTRESS)
-           || map_has_special(ptile, S_AIRBASE)
+           || tile_has_special(ptile, S_FORTRESS)
+           || tile_has_special(ptile, S_AIRBASE)
            || !game.rgame.killstack);
 }
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.213
diff -u -r1.213 map.c
--- common/map.c        16 Mar 2005 19:37:48 -0000      1.213
+++ common/map.c        12 Apr 2005 06:08:45 -0000
@@ -952,7 +952,7 @@
   result = tile_types[now].irrigation_result;
 
   if (now == result) {
-    if (map_has_special(ptile, S_IRRIGATION)) {
+    if (tile_has_special(ptile, S_IRRIGATION)) {
       map_set_special(ptile, S_FARMLAND);
     } else {
       map_set_special(ptile, S_IRRIGATION);
@@ -1282,15 +1282,6 @@
 }
 
 /***************************************************************
- Returns TRUE iff the given special is found at the given map
- position.
-***************************************************************/
-bool map_has_special(const struct tile *ptile, enum tile_special_type special)
-{
-  return contains_special(ptile->special, special);
-}
-
-/***************************************************************
  Returns TRUE iff the given tile has the given special.
 ***************************************************************/
 bool tile_has_special(const struct tile *ptile,
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.235
diff -u -r1.235 map.h
--- common/map.h        13 Mar 2005 17:50:54 -0000      1.235
+++ common/map.h        12 Apr 2005 06:08:45 -0000
@@ -306,8 +306,6 @@
                              const struct player *pplayer);
 
 /* special testing */
-bool map_has_special(const struct tile *ptile,
-                    enum tile_special_type to_test_for);
 bool tile_has_special(const struct tile *ptile,
                      enum tile_special_type to_test_for);
 bool contains_special(enum tile_special_type all,
Index: common/terrain.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.c,v
retrieving revision 1.16
diff -u -r1.16 terrain.c
--- common/terrain.c    29 Sep 2004 02:24:23 -0000      1.16
+++ common/terrain.c    12 Apr 2005 06:08:45 -0000
@@ -196,7 +196,7 @@
 bool is_special_near_tile(const struct tile *ptile, enum tile_special_type spe)
 {
   adjc_iterate(ptile, adjc_tile) {
-    if (map_has_special(adjc_tile, spe)) {
+    if (tile_has_special(adjc_tile, spe)) {
       return TRUE;
     }
   } adjc_iterate_end;
@@ -214,7 +214,7 @@
   int count = 0, total = 0;
 
   variable_adjc_iterate(ptile, adjc_tile, cardinal_only) {
-    if (map_has_special(adjc_tile, spe)) {
+    if (tile_has_special(adjc_tile, spe)) {
       count++;
     }
     total++;
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.232
diff -u -r1.232 unit.c
--- common/unit.c       21 Mar 2005 12:28:00 -0000      1.232
+++ common/unit.c       12 Apr 2005 06:08:46 -0000
@@ -1382,7 +1382,7 @@
     return FALSE;
   }
   if (is_ground_unit(punit) &&
-      map_has_special(punit->tile, S_FORTRESS)) {
+      tile_has_special(punit->tile, S_FORTRESS)) {
     return !is_unit_near_a_friendly_city (punit);
   }
   
Index: common/aicore/pf_tools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/pf_tools.c,v
retrieving revision 1.29
diff -u -r1.29 pf_tools.c
--- common/aicore/pf_tools.c    31 Mar 2005 18:32:10 -0000      1.29
+++ common/aicore/pf_tools.c    12 Apr 2005 06:08:46 -0000
@@ -535,7 +535,7 @@
     return FALSE;
   }
 
-  if (map_has_special(ptile, S_AIRBASE)) {
+  if (tile_has_special(ptile, S_AIRBASE)) {
     /* All airbases are considered non-dangerous, although non-allied ones
      * are inaccessible. */
     return FALSE;
Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.85
diff -u -r1.85 barbarian.c
--- server/barbarian.c  29 Mar 2005 12:27:19 -0000      1.85
+++ server/barbarian.c  12 Apr 2005 06:08:46 -0000
@@ -384,7 +384,7 @@
   }
   freelog(LOG_DEBUG, "Barbarians are willing to fight");
 
-  if (map_has_special(utile, S_HUT)) {
+  if (tile_has_special(utile, S_HUT)) {
     /* remove the hut in place of uprising */
     map_clear_special(utile, S_HUT);
     update_tile_knowledge(utile);
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.309
diff -u -r1.309 citytools.c
--- server/citytools.c  1 Apr 2005 00:42:27 -0000       1.309
+++ server/citytools.c  12 Apr 2005 06:08:46 -0000
@@ -172,7 +172,7 @@
    * we _only_ multiplied (or divided), then cities that had more
    * terrain labels would have their priorities hurt (or helped).
    */
-  goodness = map_has_special(ptile, S_RIVER) ?
+  goodness = tile_has_special(ptile, S_RIVER) ?
              city_name->river : -city_name->river;
   if (goodness > 0) {
     priority /= mult_factor;
@@ -870,7 +870,7 @@
 
   if (terrain_control.may_road
       && player_knows_techs_with_flag (ptaker, TF_RAILROAD)
-      && !map_has_special(pcity->tile, S_RAILROAD)) {
+      && !tile_has_special(pcity->tile, S_RAILROAD)) {
     notify_player(ptaker,
                  _("The people in %s are stunned by your"
                    " technological insight!\n"
@@ -979,7 +979,7 @@
   auto_arrange_workers(pcity);
 
   /* Put vision back to normal, if fortress acted as a watchtower */
-  if (map_has_special(ptile, S_FORTRESS)) {
+  if (tile_has_special(ptile, S_FORTRESS)) {
     /* This could be a helper function. */
     unit_list_iterate((ptile)->units, punit) {
       struct player *owner = unit_owner(punit);
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.300
diff -u -r1.300 cityturn.c
--- server/cityturn.c   18 Mar 2005 11:26:24 -0000      1.300
+++ server/cityturn.c   12 Apr 2005 06:08:47 -0000
@@ -1168,7 +1168,7 @@
       }
 
       if (!terrain_has_flag(map_get_terrain(ptile), TER_NO_POLLUTION)
-         && !map_has_special(ptile, S_POLLUTION)) {
+         && !tile_has_special(ptile, S_POLLUTION)) {
        map_set_special(ptile, S_POLLUTION);
        update_tile_knowledge(ptile);
        notify_player_ex(city_owner(pcity), pcity->tile,
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.158
diff -u -r1.158 gamehand.c
--- server/gamehand.c   29 Mar 2005 12:28:26 -0000      1.158
+++ server/gamehand.c   12 Apr 2005 06:08:47 -0000
@@ -71,7 +71,7 @@
    * other cases, huts are avoided as start positions).  Remove any such hut,
    * and make sure to tell the client, since we may have already sent this
    * tile (with the hut) earlier: */
-  if (map_has_special(ptile, S_HUT)) {
+  if (tile_has_special(ptile, S_HUT)) {
     map_clear_special(ptile, S_HUT);
     update_tile_knowledge(ptile);
     freelog(LOG_VERBOSE, "Removed hut on start position for %s",
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.158
diff -u -r1.158 maphand.c
--- server/maphand.c    15 Feb 2005 17:41:40 -0000      1.158
+++ server/maphand.c    12 Apr 2005 06:08:47 -0000
@@ -193,7 +193,7 @@
 **************************************************************************/
 static bool is_terrain_ecologically_wet(struct tile *ptile)
 {
-  return (map_has_special(ptile, S_RIVER)
+  return (tile_has_special(ptile, S_RIVER)
          || is_ocean_near_tile(ptile)
          || is_special_near_tile(ptile, S_RIVER));
 }
@@ -858,7 +858,7 @@
   freelog(LOG_DEBUG, "Removing unit sight points at  %i,%i",
          TILE_XY(punit->tile));
 
-  if (map_has_special(punit->tile, S_FORTRESS)
+  if (tile_has_special(punit->tile, S_FORTRESS)
       && unit_profits_of_watchtower(punit))
     fog_area(pplayer, ptile, get_watchtower_vision(punit));
   else
@@ -1474,7 +1474,7 @@
   map_clear_special(ptile, S_RIVER);
 
   cardinal_adjc_iterate(ptile, tile1) {
-    if (map_has_special(tile1, S_RIVER)) {
+    if (tile_has_special(tile1, S_RIVER)) {
       bool ocean_near = FALSE;
       cardinal_adjc_iterate(tile1, tile2) {
         if (is_ocean(map_get_terrain(tile2)))
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.364
diff -u -r1.364 plrhand.c
--- server/plrhand.c    10 Apr 2005 17:33:47 -0000      1.364
+++ server/plrhand.c    12 Apr 2005 06:08:48 -0000
@@ -340,7 +340,7 @@
   /* enhance vision of units inside a fortress */
   if (tech_flag(tech_found, TF_WATCHTOWER)) {
     unit_list_iterate(plr->units, punit) {
-      if (map_has_special(punit->tile, S_FORTRESS)
+      if (tile_has_special(punit->tile, S_FORTRESS)
          && is_ground_unit(punit)) {
        unfog_area(plr, punit->tile, get_watchtower_vision(punit));
        fog_area(plr, punit->tile,
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.230
diff -u -r1.230 savegame.c
--- server/savegame.c   26 Mar 2005 12:53:18 -0000      1.230
+++ server/savegame.c   12 Apr 2005 06:08:49 -0000
@@ -1574,7 +1574,7 @@
 
     /* allocate the unit's contribution to fog of war */
     if (unit_profits_of_watchtower(punit)
-       && map_has_special(punit->tile, S_FORTRESS)) {
+       && tile_has_special(punit->tile, S_FORTRESS)) {
       unfog_area(unit_owner(punit), punit->tile,
                 get_watchtower_vision(punit));
     } else {
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.223
diff -u -r1.223 settlers.c
--- server/settlers.c   21 Mar 2005 12:28:00 -0000      1.223
+++ server/settlers.c   12 Apr 2005 06:08:49 -0000
@@ -226,7 +226,7 @@
 {
   int goodness;
 
-  if (!map_has_special(ptile, S_POLLUTION)) {
+  if (!tile_has_special(ptile, S_POLLUTION)) {
     return -1;
   }
   map_clear_special(ptile, S_POLLUTION);
@@ -256,7 +256,7 @@
 {
   int goodness;
 
-  if (!map_has_special(ptile, S_FALLOUT)) {
+  if (!tile_has_special(ptile, S_FALLOUT)) {
     return -1;
   }
   map_clear_special(ptile, S_FALLOUT);
@@ -937,7 +937,7 @@
                                &best_newv, &best_oldv, best_act, best_tile,
                                ptile);
 
-       if (!map_has_special(ptile, S_ROAD)) {
+       if (!tile_has_special(ptile, S_ROAD)) {
          time = mv_turns
            + get_turns_for_activity_at(punit, ACTIVITY_ROAD, ptile);
          consider_settler_action(pplayer, ACTIVITY_ROAD,
@@ -957,7 +957,7 @@
                                    best_act, best_tile,
                                    ptile);
          }
-       } else if (!map_has_special(ptile, S_RAILROAD)
+       } else if (!tile_has_special(ptile, S_RAILROAD)
                   && can_rr) {
          time = mv_turns
            + get_turns_for_activity_at(punit, ACTIVITY_RAILROAD, ptile);
@@ -969,7 +969,7 @@
                                  ptile);
        } /* end S_ROAD else */
 
-       if (map_has_special(ptile, S_POLLUTION)) {
+       if (tile_has_special(ptile, S_POLLUTION)) {
          time = mv_turns
            + get_turns_for_activity_at(punit, ACTIVITY_POLLUTION, ptile);
          consider_settler_action(pplayer, ACTIVITY_POLLUTION,
@@ -980,7 +980,7 @@
                                  ptile);
        }
       
-       if (map_has_special(ptile, S_FALLOUT)) {
+       if (tile_has_special(ptile, S_FALLOUT)) {
          time = mv_turns
            + get_turns_for_activity_at(punit, ACTIVITY_FALLOUT, ptile);
          consider_settler_action(pplayer, ACTIVITY_FALLOUT,
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.242
diff -u -r1.242 srv_main.c
--- server/srv_main.c   5 Apr 2005 20:40:47 -0000       1.242
+++ server/srv_main.c   12 Apr 2005 06:08:49 -0000
@@ -375,7 +375,7 @@
 
   count = 0;
   whole_map_iterate(ptile) {
-    if (map_has_special(ptile, cause)) {
+    if (tile_has_special(ptile, cause)) {
       count++;
     }
   } whole_map_iterate_end;
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.327
diff -u -r1.327 unithand.c
--- server/unithand.c   24 Mar 2005 17:48:48 -0000      1.327
+++ server/unithand.c   12 Apr 2005 06:08:49 -0000
@@ -688,7 +688,7 @@
     }
 
     if (!is_air_unit(pdefender)
-       || (pcity || map_has_special(ptile, S_AIRBASE))) {
+       || (pcity || tile_has_special(ptile, S_AIRBASE))) {
       see_combat(punit, pdefender);
 
       unit_versus_unit(punit, pdefender, TRUE);
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.335
diff -u -r1.335 unittools.c
--- server/unittools.c  5 Apr 2005 20:36:10 -0000       1.335
+++ server/unittools.c  12 Apr 2005 06:08:50 -0000
@@ -413,7 +413,7 @@
       /* 7) Automatically refuel air units in cities, airbases, and
        *    transporters (carriers). */
       if (map_get_city(punit->tile)
-         || map_has_special(punit->tile, S_AIRBASE)
+         || tile_has_special(punit->tile, S_AIRBASE)
          || punit->transported_by != -1) {
        punit->fuel=unit_type(punit)->fuel;
       }
@@ -461,7 +461,7 @@
   if(is_heli_unit(punit)) {
     struct city *pcity = map_get_city(punit->tile);
     if(!pcity) {
-      if (!map_has_special(punit->tile, S_AIRBASE))
+      if (!tile_has_special(punit->tile, S_AIRBASE))
         punit->hp-=unit_type(punit)->hp/10;
     }
   }
@@ -1188,7 +1188,7 @@
 
   /* Calculate how well we can defend at (x,y) */
   db = get_tile_type(map_get_terrain(ptile))->defense_bonus;
-  if (map_has_special(ptile, S_RIVER))
+  if (tile_has_special(ptile, S_RIVER))
     db += (db * terrain_control.river_defense_bonus) / 100;
   d = unit_def_rating_basic_sq(punit) * db;
 
@@ -1411,7 +1411,7 @@
   }
 
   /* save old vision range */
-  if (map_has_special(punit->tile, S_FORTRESS)
+  if (tile_has_special(punit->tile, S_FORTRESS)
       && unit_profits_of_watchtower(punit))
     range = get_watchtower_vision(punit);
   else
@@ -1428,7 +1428,7 @@
   conn_list_do_buffer(pplayer->connections);
 
   /* apply new vision range */
-  if (map_has_special(punit->tile, S_FORTRESS)
+  if (tile_has_special(punit->tile, S_FORTRESS)
       && unit_profits_of_watchtower(punit)) {
     change_vision_range(pplayer, punit->tile, range, 
get_watchtower_vision(punit));
   } else {
@@ -1511,7 +1511,7 @@
     send_city_info(pplayer, pcity);
   }
 
-  if (map_has_special(ptile, S_FORTRESS)
+  if (tile_has_special(ptile, S_FORTRESS)
       && unit_profits_of_watchtower(punit)) {
     unfog_area(pplayer, punit->tile, get_watchtower_vision(punit));
   } else {
@@ -2090,12 +2090,12 @@
 
   if (!is_ocean(map_get_terrain(ptile)) && myrand(2) == 1) {
     if (game.rgame.nuke_contamination == CONTAMINATION_POLLUTION) {
-      if (!map_has_special(ptile, S_POLLUTION)) {
+      if (!tile_has_special(ptile, S_POLLUTION)) {
        map_set_special(ptile, S_POLLUTION);
        update_tile_knowledge(ptile);
       }
     } else {
-      if (!map_has_special(ptile, S_FALLOUT)) {
+      if (!tile_has_special(ptile, S_FALLOUT)) {
        map_set_special(ptile, S_FALLOUT);
        update_tile_knowledge(ptile);
       }
@@ -2602,7 +2602,7 @@
       enum unit_move_type move_type = unit_type(penemy)->move_type;
       Terrain_type_id terrain = map_get_terrain(ptile);
 
-      if (map_has_special(ptile, S_FORTRESS)
+      if (tile_has_special(ptile, S_FORTRESS)
          && unit_profits_of_watchtower(penemy))
        range = get_watchtower_vision(penemy);
       else
@@ -2695,7 +2695,7 @@
     }
 
     /* entering/leaving a fortress */
-    if (map_has_special(dst_tile, S_FORTRESS)
+    if (tile_has_special(dst_tile, S_FORTRESS)
        && homecity
        && is_friendly_city_near(unit_owner(punit), dst_tile)
        && !senthome) {
@@ -2703,7 +2703,7 @@
       send_city_info(pplayer, homecity);
     }
 
-    if (map_has_special(src_tile, S_FORTRESS)
+    if (tile_has_special(src_tile, S_FORTRESS)
        && homecity
        && is_friendly_city_near(unit_owner(punit), src_tile)
        && !senthome) {
@@ -2956,7 +2956,7 @@
    * being moved at a time (e.g., bounce unit) and they are not done in the
    * right order.  This is probably not a bug. */
 
-  if (map_has_special(pdesttile, S_HUT)) {
+  if (tile_has_special(pdesttile, S_HUT)) {
     return unit_enter_hut(punit);
   } else {
     return TRUE;
@@ -2995,7 +2995,7 @@
   int range;
   struct player *pplayer = unit_owner(punit);
 
-  if (map_has_special(punit->tile, S_FORTRESS)
+  if (tile_has_special(punit->tile, S_FORTRESS)
       && unit_profits_of_watchtower(punit))
     range = get_watchtower_vision(punit);
   else
Index: server/generator/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/generator/mapgen.c,v
retrieving revision 1.21
diff -u -r1.21 mapgen.c
--- server/generator/mapgen.c   16 Feb 2005 18:06:30 -0000      1.21
+++ server/generator/mapgen.c   12 Apr 2005 06:08:50 -0000
@@ -828,7 +828,7 @@
        !is_ocean(map_get_terrain(ptile))
 
        /* Don't start a river on river. */
-       && !map_has_special(ptile, S_RIVER)
+       && !tile_has_special(ptile, S_RIVER)
 
        /* Don't start a river on a tile is surrounded by > 1 river +
           ocean tile. */
@@ -1208,8 +1208,8 @@
 static bool is_special_close(struct tile *ptile)
 {
   square_iterate(ptile, 1, tile1) {
-    if (map_has_special(tile1, S_SPECIAL_1)
-       || map_has_special(tile1, S_SPECIAL_2)) {
+    if (tile_has_special(tile1, S_SPECIAL_1)
+       || tile_has_special(tile1, S_SPECIAL_2)) {
       return TRUE;
     }
   } square_iterate_end;
Index: server/generator/startpos.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/generator/startpos.c,v
retrieving revision 1.8
diff -u -r1.8 startpos.c
--- server/generator/startpos.c 30 Dec 2004 21:45:26 -0000      1.8
+++ server/generator/startpos.c 12 Apr 2005 06:08:54 -0000
@@ -113,7 +113,7 @@
   }
 
   /* Don't start on a hut. */
-  if (map_has_special(ptile, S_HUT)) {
+  if (tile_has_special(ptile, S_HUT)) {
     return FALSE;
   }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12773) remove map_has_special, Jason Short <=