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.100 by root, Tue Apr 17 10:06:32 2007 UTC vs.
Revision 1.101 by root, Sat Apr 21 16:56:28 2007 UTC

353{ 353{
354 if (!spaces) 354 if (!spaces)
355 return; 355 return;
356 356
357 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 357 for (mapspace *ms = spaces + size (); ms-- > spaces; )
358 for (object *tmp = ms->bot; tmp; tmp = tmp->above) 358 for (object *op = ms->bot; op; op = op->above)
359 { 359 {
360 /* already multipart - don't do anything more */ 360 /* already multipart - don't do anything more */
361 if (!tmp->head && !tmp->more) 361 if (!op->head && !op->more && op->arch->more)
362 { 362 {
363 /* If there is nothing more to this object, this for loop 363 op->remove ();
364 * won't do anything. 364 op->expand_tail ();
365 */
366 archetype *at;
367 object *last, *op;
368 for (at = tmp->arch->more, last = tmp;
369 at;
370 at = at->more, last = op)
371 {
372 op = arch_to_object (at);
373
374 /* update x,y coordinates */
375 op->x += tmp->x;
376 op->y += tmp->y;
377 op->head = tmp;
378 op->map = this;
379 last->more = op;
380 op->name = tmp->name;
381 op->title = tmp->title;
382
383 /* we could link all the parts onto tmp, and then just
384 * call insert_ob_in_map once, but the effect is the same,
385 * as insert_ob_in_map will call itself with each part, and
386 * the coding is simpler to just to it here with each part.
387 */
388 insert_ob_in_map (op, op->map, tmp, INS_NO_MERGE | INS_ABOVE_FLOOR_ONLY | INS_NO_WALK_ON); 365 insert (op, op->x, op->y, 0, INS_NO_MERGE | INS_ABOVE_FLOOR_ONLY | INS_NO_WALK_ON);
389 }
390 } 366 }
391 } 367 }
392} 368}
393 369
394/* 370/*
431} 407}
432 408
433void 409void
434maptile::activate () 410maptile::activate ()
435{ 411{
412 active = true;
413
436 if (!spaces) 414 if (spaces)
437 return;
438
439 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 415 for (mapspace *ms = spaces + size (); ms-- > spaces; )
440 for (object *op = ms->bot; op; op = op->above) 416 for (object *op = ms->bot; op; op = op->above)
441 op->activate_recursive (); 417 op->activate_recursive ();
442} 418}
443 419
444void 420void
445maptile::deactivate () 421maptile::deactivate ()
446{ 422{
423 active = false;
424
447 if (!spaces) 425 if (spaces)
448 return;
449
450 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 426 for (mapspace *ms = spaces + size (); ms-- > spaces; )
451 for (object *op = ms->bot; op; op = op->above) 427 for (object *op = ms->bot; op; op = op->above)
452 op->deactivate_recursive (); 428 op->deactivate_recursive ();
453} 429}
454 430
455bool 431bool
456maptile::_save_objects (object_freezer &f, int flags) 432maptile::_save_objects (object_freezer &f, int flags)
457{ 433{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines