Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.112
diff -u -r1.112 game.c
--- common/game.c	2001/10/26 07:33:23	1.112
+++ common/game.c	2001/10/30 01:49:43
@@ -14,6 +14,7 @@
 #include <config.h>
 #endif
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.97
diff -u -r1.97 map.c
--- common/map.c	2001/10/15 13:42:50	1.97
+++ common/map.c	2001/10/30 01:49:44
@@ -1068,9 +1068,6 @@
   int maxcost = 72; /* should be big enough without being TOO big */
   struct tile *tile0, *tile1;
 
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
-
   tile0 = map_get_tile(x, y);
   debug_log_move_costs("Resetting move costs for", x, y, tile0);
 
@@ -1156,10 +1153,6 @@
 ***************************************************************/
 struct tile *map_get_tile(int x, int y)
 {
-  int is_real = normalize_map_pos(&x, &y);
-
-  assert(is_real);
-
   return MAP_TILE(x, y);
 }
 
@@ -1168,7 +1161,7 @@
 ***************************************************************/
 signed short map_get_continent(int x, int y)
 {
-  if (!normalize_map_pos(&x, &y))
+  if (!normalize_map_pos(&x, &y)) /* XXX */
     return -1;
   else
     return MAP_TILE(x, y)->continent;
@@ -1179,8 +1172,6 @@
 ***************************************************************/
 void map_set_continent(int x, int y, int val)
 {
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
   MAP_TILE(x, y)->continent = val;
 }
 
@@ -1190,7 +1181,7 @@
 ***************************************************************/
 enum tile_terrain_type map_get_terrain(int x, int y)
 {
-  if (!normalize_map_pos(&x, &y))
+  if (!normalize_map_pos(&x, &y)) /* XXX */
     return T_UNKNOWN;
   else
     return MAP_TILE(x, y)->terrain;
@@ -1201,7 +1192,7 @@
 ***************************************************************/
 enum tile_special_type map_get_special(int x, int y)
 {
-  if (!normalize_map_pos(&x, &y))
+  if (!normalize_map_pos(&x, &y)) /* XXX */
     return S_NO_SPECIAL;
   else
     return MAP_TILE(x, y)->special;
@@ -1212,8 +1203,6 @@
 ***************************************************************/
 void map_set_terrain(int x, int y, enum tile_terrain_type ter)
 {
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
   MAP_TILE(x, y)->terrain = ter;
 }
 
@@ -1222,9 +1211,6 @@
 ***************************************************************/
 void map_set_special(int x, int y, enum tile_special_type spe)
 {
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
-
   MAP_TILE(x, y)->special |= spe;
 
   if (spe & (S_ROAD | S_RAILROAD))
@@ -1236,8 +1222,6 @@
 ***************************************************************/
 void map_clear_special(int x, int y, enum tile_special_type spe)
 {
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
   MAP_TILE(x, y)->special &= ~spe;
 
   if (spe & (S_ROAD | S_RAILROAD))
@@ -1249,8 +1233,6 @@
 ***************************************************************/
 struct city *map_get_city(int x, int y)
 {
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
   return MAP_TILE(x, y)->city;
 }
 
@@ -1260,8 +1242,6 @@
 ***************************************************************/
 void map_set_city(int x, int y, struct city *pcity)
 {
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
   MAP_TILE(x, y)->city = pcity;
 }
 
@@ -1271,7 +1251,7 @@
 ***************************************************************/
 enum known_type tile_is_known(int x, int y)
 {
-  if (!normalize_map_pos(&x, &y))
+  if (!normalize_map_pos(&x, &y)) /* XXX */
     return TILE_UNKNOWN;
   else
     return (enum known_type) (MAP_TILE(x, y)->known);
@@ -1283,17 +1263,14 @@
 ***************************************************************/
 int same_pos(int x1, int y1, int x2, int y2)
 {
-  assert(is_real_tile(x1, y1) && is_real_tile(x2, y2));
-  normalize_map_pos(&x1, &y1);
-  normalize_map_pos(&x2, &y2);
+  CHECK_POS(x1, y1);
+  CHECK_POS(x2, y2);
   return (x1 == x2 && y1 == y2);
 }
 
 int is_real_tile(int x, int y)
 {
-  int x1 = x, y1 = y;
-
-  return normalize_map_pos(&x1, &y1);
+  return normalize_map_pos(&x, &y);
 }
 
 /**************************************************************************
@@ -1424,9 +1401,6 @@
 **************************************************************************/
 int is_move_cardinal(int start_x, int start_y, int end_x, int end_y)
 {
-  assert(is_real_tile(start_x, start_y) && is_real_tile(end_x, end_y));
-  normalize_map_pos(&start_x, &start_y);
-  normalize_map_pos(&end_x, &end_y);
   assert(is_tiles_adjacent(start_x, start_y, end_x, end_y));
 
   /* FIXME: this check will not work with an orthogonal map */
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.100
diff -u -r1.100 map.h
--- common/map.h	2001/10/19 08:12:52	1.100
+++ common/map.h	2001/10/30 01:49:44
@@ -197,6 +197,13 @@
 void initialize_move_costs(void);
 void reset_move_costs(int x, int y);
 
+#ifndef NDEBUG
+#define CHECK_POS(x,y) \
+  (assert(is_normal_map_pos((x),(y))), TRUE)
+#else
+#define CHECK_POS(x,y) TRUE
+#endif
+
 #define map_adjust_x(X)            \
   ((X) < 0                         \
    ? ((X) % map.xsize != 0 ? (X) % map.xsize + map.xsize : 0) \
@@ -208,7 +215,7 @@
   (((Y)<0) ? 0 : (((Y)>=map.ysize) ? map.ysize-1 : (Y)))
 
 #define map_inx(x,y) \
-  ((x)+(y)*map.xsize)
+  (CHECK_POS((x),(y)), (x)+(y)*map.xsize)
 
 #define DIRSTEP(dest_x, dest_y, dir)	\
 (    (dest_x) = DIR_DX[(dir)],      	\
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.87
diff -u -r1.87 maphand.c
--- server/maphand.c	2001/10/11 12:37:06	1.87
+++ server/maphand.c	2001/10/30 01:49:44
@@ -771,14 +771,11 @@
 ***************************************************************/
 int map_get_known_and_seen(int x, int y, struct player *pplayer)
 {
-  int is_real = normalize_map_pos(&x, &y);
-  int playerid=pplayer->player_no;
-  int offset = map_inx(x, y);
+  int playerid = pplayer->player_no;
+  int offset   = map_inx(x, y);
 
-  assert(is_real);
-
-  return ((map.tiles + offset)->known) & (1u << playerid) &&
-      (pplayer->private_map + offset)->seen;
+  return ((map.tiles + offset)->known) & (1u << playerid)
+    && (pplayer->private_map + offset)->seen;
 }
 
 /***************************************************************
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.112
diff -u -r1.112 settlers.c
--- server/settlers.c	2001/10/14 21:02:17	1.112
+++ server/settlers.c	2001/10/30 01:49:45
@@ -405,8 +405,6 @@
 **************************************************************************/
 static int is_already_assigned(struct unit *myunit, struct player *pplayer, int x, int y)
 {
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
   if (same_pos(myunit->x, myunit->y, x, y) ||
       same_pos(myunit->goto_dest_x, myunit->goto_dest_y, x, y)) {
 /* I'm still not sure this is exactly right -- Syela */
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.143
diff -u -r1.143 unittools.c
--- server/unittools.c	2001/10/15 13:42:52	1.143
+++ server/unittools.c	2001/10/30 01:49:46
@@ -1628,8 +1628,7 @@
   idex_register_unit(punit);
   punit->owner=pplayer->player_no;
 
-  assert(is_real_tile(x, y));
-  normalize_map_pos(&x, &y);
+  CHECK_POS(x, y);
   punit->x = x;
   punit->y = y;