ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/map.C
(Generate patch)

Comparing deliantra/server/common/map.C (file contents):
Revision 1.59 by root, Sat Dec 30 20:32:30 2006 UTC vs.
Revision 1.60 by root, Sun Dec 31 10:28:35 2006 UTC

1333 * so that it is easier for calling functions to verify success. 1333 * so that it is easier for calling functions to verify success.
1334 */ 1334 */
1335static maptile * 1335static maptile *
1336load_and_link_tiled_map (maptile *orig_map, int tile_num) 1336load_and_link_tiled_map (maptile *orig_map, int tile_num)
1337{ 1337{
1338 maptile *mp = orig_map->find_map (orig_map->tile_path[tile_num]); 1338 maptile *mp = orig_map->load_map_sync (orig_map->tile_path [tile_num], orig_map);
1339 mp->load (); 1339
1340 if (!mp || mp->in_memory != MAP_IN_MEMORY)
1341 {
1342 // emergency mode, manufacture a dummy map, this creates a memleak, but thats fine
1343 LOG (llevError, "FATAL: cannot load tiled map %s from %s, leaking memory and worse!\n",
1344 &orig_map->tile_path[tile_num], &orig_map->path);
1345 mp = new maptile (1, 1);
1346 mp->alloc ();
1347 mp->in_memory = MAP_IN_MEMORY;
1348 }
1340 1349
1341 int dest_tile = (tile_num + 2) % 4; 1350 int dest_tile = (tile_num + 2) % 4;
1342 1351
1343 orig_map->tile_map[tile_num] = mp; 1352 orig_map->tile_map[tile_num] = mp;
1344 1353
1345 /* need to do a strcmp here as the orig_map->path is not a shared string */ 1354 // optimisation: back-link map to origin map if euclidean
1346 if (orig_map->tile_map[tile_num]->tile_path[dest_tile] && orig_map->tile_map[tile_num]->tile_path[dest_tile] == orig_map->path) 1355 //TODO: non-euclidean maps MUST GO
1356 if (orig_map->tile_map[tile_num]->tile_path[dest_tile] == orig_map->path)
1347 orig_map->tile_map[tile_num]->tile_map[dest_tile] = orig_map; 1357 orig_map->tile_map[tile_num]->tile_map[dest_tile] = orig_map;
1348 1358
1349 return mp; 1359 return mp;
1350} 1360}
1351 1361

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines