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.203 by root, Sat Apr 23 04:56:46 2011 UTC vs.
Revision 1.206 by root, Wed May 4 16:12:15 2011 UTC

361} 361}
362 362
363void 363void
364maptile::activate () 364maptile::activate ()
365{ 365{
366 if (spaces) 366 if (state != MAP_INACTIVE)
367 return;
368
367 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 369 for (mapspace *ms = spaces + size (); ms-- > spaces; )
368 for (object *op = ms->bot; op; op = op->above) 370 for (object *op = ms->bot; op; op = op->above)
369 op->activate_recursive (); 371 op->activate_recursive ();
372
373 state = MAP_ACTIVE;
370} 374}
371 375
372void 376void
373maptile::deactivate () 377maptile::deactivate ()
374{ 378{
375 if (spaces) 379 if (state != MAP_ACTIVE)
380 return;
381
376 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 382 for (mapspace *ms = spaces + size (); ms-- > spaces; )
377 for (object *op = ms->bot; op; op = op->above) 383 for (object *op = ms->bot; op; op = op->above)
378 op->deactivate_recursive (); 384 op->deactivate_recursive ();
385
386 state = MAP_INACTIVE;
379} 387}
380 388
381bool 389bool
382maptile::_save_objects (object_freezer &f, int flags) 390maptile::_save_objects (object_freezer &f, int flags)
383{ 391{
427} 435}
428 436
429void 437void
430maptile::init () 438maptile::init ()
431{ 439{
432 in_memory = MAP_SWAPPED; 440 state = MAP_SWAPPED;
433 441
434 /* The maps used to pick up default x and y values from the 442 /* The maps used to pick up default x and y values from the
435 * map archetype. Mimic that behaviour. 443 * map archetype. Mimic that behaviour.
436 */ 444 */
437 width = 16; 445 width = 16;
844 /* We need to look through all the maps and see if any maps 852 /* We need to look through all the maps and see if any maps
845 * are pointing at this one for tiling information. Since 853 * are pointing at this one for tiling information. Since
846 * tiling can be asymetric, we just can not look to see which 854 * tiling can be asymetric, we just can not look to see which
847 * maps this map tiles with and clears those. 855 * maps this map tiles with and clears those.
848 */ 856 */
849 for (int i = 0; i < 4; i++) 857 for (int i = 0; i < TILE_NUM; i++)
850 if (tile_map[i] == m) 858 if (tile_map[i] == m)
851 tile_map[i] = 0; 859 tile_map[i] = 0;
852} 860}
853 861
854void 862void
1198maptile::tile_available (int dir, bool load) 1206maptile::tile_available (int dir, bool load)
1199{ 1207{
1200 if (tile_path[dir]) 1208 if (tile_path[dir])
1201 { 1209 {
1202 // map is there and we don't need to load it OR it's loaded => return what we have 1210 // map is there and we don't need to load it OR it's loaded => return what we have
1203 if (tile_map[dir] && (!load || tile_map[dir]->in_memory == MAP_ACTIVE)) 1211 if (tile_map[dir] && (!load || tile_map[dir]->linkable ()))
1204 return tile_map[dir]; 1212 return tile_map[dir];
1205 1213
1206 // well, try to locate it then, if possible - maybe it's there already 1214 // well, try to locate it then, if possible - maybe it's there already
1207 if ((tile_map[dir] = find_async (tile_path[dir], this, load))) 1215 if ((tile_map[dir] = find_async (tile_path[dir], this, load)))
1208 return tile_map[dir]; 1216 return tile_map[dir];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines