--- deliantra/server/common/map.C 2010/07/10 21:07:47 1.201 +++ deliantra/server/common/map.C 2011/04/22 06:10:32 1.202 @@ -667,6 +667,8 @@ case KW_tile_path_2: thawer.get (tile_path [1]); break; case KW_tile_path_3: thawer.get (tile_path [2]); break; case KW_tile_path_4: thawer.get (tile_path [3]); break; + case KW_tile_path_5: thawer.get (tile_path [4]); break; + case KW_tile_path_6: thawer.get (tile_path [5]); break; case KW_ERROR: set_key_text (thawer.kw_str, thawer.value); @@ -759,6 +761,8 @@ if (tile_path [1]) MAP_OUT2 (tile_path_2, tile_path [1]); if (tile_path [2]) MAP_OUT2 (tile_path_3, tile_path [2]); if (tile_path [3]) MAP_OUT2 (tile_path_4, tile_path [3]); + if (tile_path [4]) MAP_OUT2 (tile_path_5, tile_path [4]); + if (tile_path [5]) MAP_OUT2 (tile_path_6, tile_path [5]); freezer.put (this); freezer.put (KW(end)); @@ -825,7 +829,7 @@ shoprace = 0; delete [] shopitems, shopitems = 0; - for (int i = 0; i < 4; i++) + for (int i = 0; i < TILE_NUM; i++) tile_path [i] = 0; } @@ -1195,9 +1199,11 @@ { if (tile_path[dir]) { + // map is there and we don't need to load it OR it's loaded => return what we have if (tile_map[dir] && (!load || tile_map[dir]->in_memory == MAP_ACTIVE)) return tile_map[dir]; + // well, try to locate it then, if possible - maybe it's there already if ((tile_map[dir] = find_async (tile_path[dir], this, load))) return tile_map[dir]; } @@ -1331,65 +1337,65 @@ *dx = 0; *dy = 0; } - else if (map1->tile_available (0, false) == map2) - { /* up */ + else if (map1->tile_available (TILE_NORTH, false) == map2) + { *dx = 0; *dy = -map2->height; } - else if (map1->tile_available (1, false) == map2) - { /* right */ + else if (map1->tile_available (TILE_EAST , false) == map2) + { *dx = map1->width; *dy = 0; } - else if (map1->tile_available (2, false) == map2) - { /* down */ + else if (map1->tile_available (TILE_SOUTH, false) == map2) + { *dx = 0; *dy = map1->height; } - else if (map1->tile_available (3, false) == map2) - { /* left */ + else if (map1->tile_available (TILE_WEST , false) == map2) + { *dx = -map2->width; *dy = 0; } - else if (map1->tile_map[0] && map1->tile_map[0]->tile_available (1, false) == map2) + else if (map1->tile_map[TILE_NORTH] && map1->tile_map[TILE_NORTH]->tile_available (TILE_EAST , false) == map2) { /* up right */ - *dx = map1->tile_map[0]->width; - *dy = -map1->tile_map[0]->height; + *dx = +map1->tile_map[TILE_NORTH]->width; + *dy = -map1->tile_map[TILE_NORTH]->height; } - else if (map1->tile_map[0] && map1->tile_map[0]->tile_available (3, false) == map2) + else if (map1->tile_map[TILE_NORTH] && map1->tile_map[TILE_NORTH]->tile_available (TILE_WEST , false) == map2) { /* up left */ *dx = -map2->width; - *dy = -map1->tile_map[0]->height; + *dy = -map1->tile_map[TILE_NORTH]->height; } - else if (map1->tile_map[1] && map1->tile_map[1]->tile_available (0, false) == map2) + else if (map1->tile_map[TILE_EAST ] && map1->tile_map[TILE_EAST ]->tile_available (TILE_NORTH, false) == map2) { /* right up */ - *dx = map1->width; + *dx = +map1->width; *dy = -map2->height; } - else if (map1->tile_map[1] && map1->tile_map[1]->tile_available (2, false) == map2) + else if (map1->tile_map[TILE_EAST ] && map1->tile_map[TILE_EAST ]->tile_available (TILE_SOUTH, false) == map2) { /* right down */ - *dx = map1->width; - *dy = map1->tile_map[1]->height; + *dx = +map1->width; + *dy = +map1->tile_map[TILE_EAST]->height; } - else if (map1->tile_map[2] && map1->tile_map[2]->tile_available (1, false) == map2) + else if (map1->tile_map[TILE_SOUTH] && map1->tile_map[TILE_SOUTH]->tile_available (TILE_EAST , false) == map2) { /* down right */ - *dx = map1->tile_map[2]->width; - *dy = map1->height; + *dx = +map1->tile_map[TILE_SOUTH]->width; + *dy = +map1->height; } - else if (map1->tile_map[2] && map1->tile_map[2]->tile_available (3, false) == map2) + else if (map1->tile_map[TILE_SOUTH] && map1->tile_map[TILE_SOUTH]->tile_available (TILE_WEST , false) == map2) { /* down left */ *dx = -map2->width; - *dy = map1->height; + *dy = +map1->height; } - else if (map1->tile_map[3] && map1->tile_map[3]->tile_available (0, false) == map2) + else if (map1->tile_map[TILE_WEST ] && map1->tile_map[TILE_WEST ]->tile_available (TILE_NORTH, false) == map2) { /* left up */ - *dx = -map1->tile_map[3]->width; + *dx = -map1->tile_map[TILE_WEST]->width; *dy = -map2->height; } - else if (map1->tile_map[3] && map1->tile_map[3]->tile_available (2, false) == map2) + else if (map1->tile_map[TILE_WEST ] && map1->tile_map[TILE_WEST ]->tile_available (TILE_SOUTH, false) == map2) { /* left down */ - *dx = -map1->tile_map[3]->width; - *dy = map1->tile_map[3]->height; + *dx = -map1->tile_map[TILE_WEST]->width; + *dy = +map1->tile_map[TILE_WEST]->height; } else return 0; @@ -1631,7 +1637,7 @@ // clip to map to the left if (x0 < 0) { - if (maptile *tile = m->tile_available (TILE_LEFT, 1)) + if (maptile *tile = m->tile_available (TILE_WEST, 1)) split_to_tiles (buf, tile, x0 + tile->width, y0, min (x1 + tile->width, tile->width), y1, dx - tile->width, dy); if (x1 < 0) // entirely to the left @@ -1643,7 +1649,7 @@ // clip to map to the right if (x1 > m->width) { - if (maptile *tile = m->tile_available (TILE_RIGHT, 1)) + if (maptile *tile = m->tile_available (TILE_EAST, 1)) split_to_tiles (buf, tile, max (x0 - m->width, 0), y0, x1 - m->width, y1, dx + m->width, dy); if (x0 > m->width) // entirely to the right @@ -1655,7 +1661,7 @@ // clip to map above if (y0 < 0) { - if (maptile *tile = m->tile_available (TILE_UP, 1)) + if (maptile *tile = m->tile_available (TILE_NORTH, 1)) split_to_tiles (buf, tile, x0, y0 + tile->height, x1, min (y1 + tile->height, tile->height), dx, dy - tile->height); if (y1 < 0) // entirely above @@ -1667,7 +1673,7 @@ // clip to map below if (y1 > m->height) { - if (maptile *tile = m->tile_available (TILE_DOWN, 1)) + if (maptile *tile = m->tile_available (TILE_SOUTH, 1)) split_to_tiles (buf, tile, x0, max (y0 - m->height, 0), x1, y1 - m->height, dx, dy + m->height); if (y0 > m->height) // entirely below