diff -urd -X freeciv.current/diff_ignore freeciv.current/client/tilespec.c work/client/tilespec.c --- freeciv.current/client/tilespec.c Wed Sep 12 10:44:16 2001 +++ work/client/tilespec.c Wed Sep 12 22:41:01 2001 @@ -24,6 +24,7 @@ #include #include #include +#include #include "astring.h" #include "capability.h" @@ -412,8 +413,10 @@ } /* Not very safe, but convenient: */ -#define SET_SPRITE(field, tag) \ - sprites.field = hash_lookup_data(sprite_hash, tag); +#define SET_SPRITE(field, tag) do { \ + sprites.field = hash_lookup_data(sprite_hash, tag);\ + assert(sprites.field);\ + } while(0) /********************************************************************** Initialize 'sprites' structure based on hardwired tags which @@ -468,10 +471,18 @@ SET_SPRITE(rail.isolated, "r.rail_isolated"); if (is_isometric) { - for (i=0; i<8; i++) { - my_snprintf(buffer, sizeof(buffer), "r.road%d", i); + for (i = 0; i < 8; i++) { + const char *s = dir_get_name(i); + char dir_name[3]; + + assert(strlen(s) == 1 || strlen(s) == 2); + dir_name[0] = tolower(s[0]); + dir_name[1] = tolower(s[1]); + dir_name[2] = tolower(s[2]); + + my_snprintf(buffer, sizeof(buffer), "r.road_%s", dir_name); SET_SPRITE(road.dir[i], buffer); - my_snprintf(buffer, sizeof(buffer), "r.rail%d", i); + my_snprintf(buffer, sizeof(buffer), "r.rail_%s", dir_name); SET_SPRITE(rail.dir[i], buffer); } } else { @@ -1097,8 +1108,8 @@ } for (dir=0; dir<8; dir++) { - int x1 = x + DIR_DX2[dir]; - int y1 = y + DIR_DY2[dir]; + int x1 = x + DIR_DX[dir]; + int y1 = y + DIR_DY[dir]; if (normalize_map_pos(&x1, &y1)) { ttype_near[dir] = map_get_terrain(x1, y1); tspecial_near[dir] = map_get_special(x1, y1); @@ -1113,22 +1124,22 @@ tspecial_near[dir] = S_NO_SPECIAL; } } - ttype_north = ttype_near[0]; - ttype_north_east = ttype_near[1]; - ttype_east = ttype_near[2]; - ttype_south_east = ttype_near[3]; - ttype_south = ttype_near[4]; - ttype_south_west = ttype_near[5]; - ttype_west = ttype_near[6]; - ttype_north_west = ttype_near[7]; - tspecial_north = tspecial_near[0]; - tspecial_north_east = tspecial_near[1]; - tspecial_east = tspecial_near[2]; - tspecial_south_east = tspecial_near[3]; - tspecial_south = tspecial_near[4]; - tspecial_south_west = tspecial_near[5]; - tspecial_west = tspecial_near[6]; - tspecial_north_west = tspecial_near[7]; + ttype_north = ttype_near[DIR8_NORTH]; + ttype_north_east = ttype_near[DIR8_NORTHEAST]; + ttype_east = ttype_near[DIR8_EAST]; + ttype_south_east = ttype_near[DIR8_SOUTHEAST]; + ttype_south = ttype_near[DIR8_SOUTH]; + ttype_south_west = ttype_near[DIR8_SOUTHWEST]; + ttype_west = ttype_near[DIR8_WEST]; + ttype_north_west = ttype_near[DIR8_NORTHWEST]; + tspecial_north = tspecial_near[DIR8_NORTH]; + tspecial_north_east = tspecial_near[DIR8_NORTHEAST]; + tspecial_east = tspecial_near[DIR8_EAST]; + tspecial_south_east = tspecial_near[DIR8_SOUTHEAST]; + tspecial_south = tspecial_near[DIR8_SOUTH]; + tspecial_south_west = tspecial_near[DIR8_SOUTHWEST]; + tspecial_west = tspecial_near[DIR8_WEST]; + tspecial_north_west = tspecial_near[DIR8_NORTHWEST]; if (draw_terrain) { if (ttype != T_OCEAN) /* painted via coasts. */ diff -urd -X freeciv.current/diff_ignore freeciv.current/common/map.c work/common/map.c --- freeciv.current/common/map.c Wed Sep 12 08:56:35 2001 +++ work/common/map.c Wed Sep 12 22:23:18 2001 @@ -49,10 +49,6 @@ const int CAR_DIR_DX[4] = {1, 0, -1, 0}; const int CAR_DIR_DY[4] = {0, 1, 0, -1}; -/* used to compute neighboring tiles */ -const int DIR_DX2[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }; -const int DIR_DY2[8] = { -1, -1, 0, 1, 1, 1, 0, -1 }; - /* Names of specials. * (These must correspond to enum tile_special_type in terrain.h.) */ diff -urd -X freeciv.current/diff_ignore freeciv.current/common/map.h work/common/map.h --- freeciv.current/common/map.h Wed Sep 12 08:56:35 2001 +++ work/common/map.h Wed Sep 12 22:23:18 2001 @@ -497,24 +497,6 @@ } \ } - -/* -used to compute neighboring tiles: -using -x1 = x + DIR_DX2[dir]; -y1 = y + DIR_DY2[dir]; -will give you the tile as shown below. -------- -|7|0|1| -|-+-+-| -|6| |2| -|-+-+-| -|5|4|3| -------- - */ -extern const int DIR_DX2[8]; -extern const int DIR_DY2[8]; - #define MAP_DEFAULT_HUTS 50 #define MAP_MIN_HUTS 0 #define MAP_MAX_HUTS 500 diff -urd -X freeciv.current/diff_ignore freeciv.current/data/hires/terrain1.spec work/data/hires/terrain1.spec --- freeciv.current/data/hires/terrain1.spec Wed Apr 18 00:01:40 2001 +++ work/data/hires/terrain1.spec Wed Sep 12 22:23:18 2001 @@ -89,26 +89,25 @@ 10, 3, "ts.whales" 10, 5, "ts.horses" +;roads + 11, 1, "r.road_n" + 11, 2, "r.road_ne" + 11, 3, "r.road_e" + 11, 4, "r.road_se" + 11, 5, "r.road_s" + 11, 6, "r.road_sw" + 11, 7, "r.road_w" + 11, 8, "r.road_nw" -;roads - we follow the the numbering of the DIR_D[XY] arrays - 11, 1, "r.road0" - 11, 2, "r.road1" - 11, 3, "r.road2" - 11, 4, "r.road3" - 11, 5, "r.road4" - 11, 6, "r.road5" - 11, 7, "r.road6" - 11, 8, "r.road7" - -;rails - we follow the the numbering of the DIR_D[XY] arrays - 12, 1, "r.rail0" - 12, 2, "r.rail1" - 12, 3, "r.rail2" - 12, 4, "r.rail3" - 12, 5, "r.rail4" - 12, 6, "r.rail5" - 12, 7, "r.rail6" - 12, 8, "r.rail7" +;rails + 12, 1, "r.rail_n" + 12, 2, "r.rail_ne" + 12, 3, "r.rail_e" + 12, 4, "r.rail_se" + 12, 5, "r.rail_s" + 12, 6, "r.rail_sw" + 12, 7, "r.rail_w" + 12, 8, "r.rail_nw" ;add-ons 4, 7, "tx.farmland"