? profile.rc ? diff ? server/a.c Index: common/map.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/map.c,v retrieving revision 1.95 diff -u -r1.95 map.c --- common/map.c 2001/10/09 16:26:46 1.95 +++ common/map.c 2001/10/09 19:28:18 @@ -68,6 +68,8 @@ extern int is_server; +#define MAP_TILE(x,y) (map.tiles + map_inx(x, y)) + /*************************************************************** ... ***************************************************************/ @@ -1158,7 +1160,7 @@ assert(is_real); - return map.tiles + map_inx(x, y); + return MAP_TILE(x, y); } /*************************************************************** @@ -1169,7 +1171,7 @@ if (!normalize_map_pos(&x, &y)) return -1; else - return (map.tiles + x + y * map.xsize)->continent; + return MAP_TILE(x, y)->continent; } /*************************************************************** @@ -1179,7 +1181,7 @@ { assert(is_real_tile(x, y)); normalize_map_pos(&x, &y); - (map.tiles + x + y * map.xsize)->continent = val; + MAP_TILE(x, y)->continent = val; } @@ -1191,7 +1193,7 @@ if (!normalize_map_pos(&x, &y)) return T_UNKNOWN; else - return (map.tiles + x + y * map.xsize)->terrain; + return MAP_TILE(x, y)->terrain; } /*************************************************************** @@ -1202,7 +1204,7 @@ if (!normalize_map_pos(&x, &y)) return S_NO_SPECIAL; else - return (map.tiles + x + y * map.xsize)->special; + return MAP_TILE(x, y)->special; } /*************************************************************** @@ -1212,7 +1214,7 @@ { assert(is_real_tile(x, y)); normalize_map_pos(&x, &y); - (map.tiles + x + y * map.xsize)->terrain = ter; + MAP_TILE(x, y)->terrain = ter; } /*************************************************************** @@ -1223,7 +1225,7 @@ assert(is_real_tile(x, y)); normalize_map_pos(&x, &y); - (map.tiles + x + y * map.xsize)->special |= spe; + MAP_TILE(x, y)->special |= spe; if (spe & (S_ROAD | S_RAILROAD)) reset_move_costs(x, y); @@ -1236,7 +1238,7 @@ { assert(is_real_tile(x, y)); normalize_map_pos(&x, &y); - (map.tiles + x + y * map.xsize)->special &= ~spe; + MAP_TILE(x, y)->special &= ~spe; if (spe & (S_ROAD | S_RAILROAD)) reset_move_costs(x, y); @@ -1249,7 +1251,7 @@ { assert(is_real_tile(x, y)); normalize_map_pos(&x, &y); - return (map.tiles + x + y*map.xsize)->city; + return MAP_TILE(x, y)->city; } @@ -1260,7 +1262,7 @@ { assert(is_real_tile(x, y)); normalize_map_pos(&x, &y); - (map.tiles + x + y*map.xsize)->city=pcity; + MAP_TILE(x, y)->city = pcity; } @@ -1272,7 +1274,7 @@ if (!normalize_map_pos(&x, &y)) return TILE_UNKNOWN; else - return (enum known_type) ((map.tiles + x + y * map.xsize)->known); + return (enum known_type) (MAP_TILE(x, y)->known); } /*************************************************************** Index: server/mapgen.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v retrieving revision 1.73 diff -u -r1.73 mapgen.c --- server/mapgen.c 2001/10/09 15:27:33 1.73 +++ server/mapgen.c 2001/10/09 19:28:20 @@ -31,7 +31,8 @@ #include "mapgen.h" /* Wrapper for easy access. It's a macro so it can be a lvalue. */ -#define hmap(x,y) (height_map[map_inx(x, y)]) +#define hmap(x, y) (height_map[map_inx(x, y)]) +#define rmap(x, y) (river_map[map_inx(x, y)]) static void make_huts(int number); static void add_specials(int prob); @@ -310,12 +311,12 @@ *********************************************************************/ static int river_test_blocked(int x, int y) { - if (river_map[y*map.xsize + x] & RS_BLOCKED) + if (rmap(x, y) & RS_BLOCKED) return 1; /* any un-blocked? */ cartesian_adjacent_iterate(x, y, x1, y1) { - if (!(river_map[(y1)*map.xsize + x1] & RS_BLOCKED)) + if (!(rmap(x1, y1) & RS_BLOCKED)) return 0; } cartesian_adjacent_iterate_end; @@ -386,7 +387,7 @@ *********************************************************************/ static int river_test_height_map(int x, int y) { - return height_map[y*map.xsize + x]; + return hmap(x, y); } /********************************************************************* @@ -397,10 +398,10 @@ freelog(LOG_DEBUG, "Blockmarking (%d, %d) and adjacent tiles.", x, y); - river_map[y*map.xsize + x] |= RS_BLOCKED; + rmap(x, y) |= RS_BLOCKED; cartesian_adjacent_iterate(x, y, x1, y1) { - river_map[y1*map.xsize + x1] |= RS_BLOCKED; + rmap(x1, y1) |= RS_BLOCKED; } cartesian_adjacent_iterate_end; } @@ -527,7 +528,7 @@ while (1) { /* Mark the current tile as river. */ - river_map[y*map.xsize + x] |= RS_RIVER; + rmap(x, y) |= RS_RIVER; freelog(LOG_DEBUG, "The tile at (%d, %d) has been marked as river in river_map.\n", x, y); @@ -732,7 +733,7 @@ /* Try to make a river. If it is OK, apply it to the map. */ if (make_river(x, y)) { whole_map_iterate(x1, y1) { - if (river_map[y1*map.xsize + x1] & RS_RIVER) { + if (rmap(x1, y1) & RS_RIVER) { if (terrain_control.river_style == R_AS_TERRAIN) { map_set_terrain(x1, y1, T_RIVER); /* Civ1 river style. */ } else if (terrain_control.river_style == R_AS_SPECIAL) { Index: server/maphand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v retrieving revision 1.86 diff -u -r1.86 maphand.c --- server/maphand.c 2001/09/12 09:12:14 1.86 +++ server/maphand.c 2001/10/09 19:28:21 @@ -771,8 +771,11 @@ ***************************************************************/ int map_get_known_and_seen(int x, int y, struct player *pplayer) { - int offset = map_adjust_x(x)+map_adjust_y(y)*map.xsize; + int is_real = normalize_map_pos(&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;