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.68 by root, Thu Jan 4 16:19:31 2007 UTC vs.
Revision 1.69 by root, Thu Jan 4 16:56:39 2007 UTC

1286 * the value of orig_map->tile_map[tile_num]. 1286 * the value of orig_map->tile_map[tile_num].
1287 */ 1287 */
1288static inline maptile * 1288static inline maptile *
1289find_and_link (maptile *orig_map, int tile_num) 1289find_and_link (maptile *orig_map, int tile_num)
1290{ 1290{
1291 maptile *mp = orig_map->find_sync (orig_map->tile_path [tile_num], orig_map); 1291 maptile *mp = orig_map->tile_map [tile_num];
1292 1292
1293 if (!mp) 1293 if (!mp)
1294 { 1294 {
1295 mp = orig_map->find_sync (orig_map->tile_path [tile_num], orig_map);
1296
1297 if (!mp)
1298 {
1295 // emergency mode, manufacture a dummy map, this creates a memleak, but thats fine 1299 // emergency mode, manufacture a dummy map, this creates a memleak, but thats fine
1296 LOG (llevError, "FATAL: cannot load tiled map %s from %s, leaking memory and worse!\n", 1300 LOG (llevError, "FATAL: cannot load tiled map %s from %s, leaking memory and worse!\n",
1297 &orig_map->tile_path[tile_num], &orig_map->path); 1301 &orig_map->tile_path[tile_num], &orig_map->path);
1298 mp = new maptile (1, 1); 1302 mp = new maptile (1, 1);
1299 mp->alloc (); 1303 mp->alloc ();
1300 mp->in_memory = MAP_IN_MEMORY; 1304 mp->in_memory = MAP_IN_MEMORY;
1305 }
1301 } 1306 }
1302 1307
1303 int dest_tile = (tile_num + 2) % 4; 1308 int dest_tile = (tile_num + 2) % 4;
1304 1309
1305 orig_map->tile_map[tile_num] = mp; 1310 orig_map->tile_map [tile_num] = mp;
1306 1311
1307 // optimisation: back-link map to origin map if euclidean 1312 // optimisation: back-link map to origin map if euclidean
1308 //TODO: non-euclidean maps MUST GO 1313 //TODO: non-euclidean maps MUST GO
1309 if (orig_map->tile_map[tile_num]->tile_path[dest_tile] == orig_map->path) 1314 if (orig_map->tile_map[tile_num]->tile_path[dest_tile] == orig_map->path)
1310 orig_map->tile_map[tile_num]->tile_map[dest_tile] = orig_map; 1315 orig_map->tile_map[tile_num]->tile_map[dest_tile] = orig_map;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines