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.94 by root, Mon Mar 12 01:13:10 2007 UTC vs.
Revision 1.100 by root, Tue Apr 17 10:06:32 2007 UTC

344} 344}
345 345
346/* link_multipart_objects go through all the objects on the map looking 346/* link_multipart_objects go through all the objects on the map looking
347 * for objects whose arch says they are multipart yet according to the 347 * for objects whose arch says they are multipart yet according to the
348 * info we have, they only have the head (as would be expected when 348 * info we have, they only have the head (as would be expected when
349 * they are saved). We do have to look for the old maps that did save 349 * they are saved).
350 * the more sections and not re-add sections for them.
351 */ 350 */
352void 351void
353maptile::link_multipart_objects () 352maptile::link_multipart_objects ()
354{ 353{
355 if (!spaces) 354 if (!spaces)
399bool 398bool
400maptile::_load_objects (object_thawer &f) 399maptile::_load_objects (object_thawer &f)
401{ 400{
402 for (;;) 401 for (;;)
403 { 402 {
404 coroapi::cede_every (1000); // cede once in a while 403 coroapi::cede_to_tick_every (100); // cede once in a while
405 404
406 switch (f.kw) 405 switch (f.kw)
407 { 406 {
408 case KW_arch: 407 case KW_arch:
409 if (object *op = object::read (f, this)) 408 if (object *op = object::read (f, this))
454} 453}
455 454
456bool 455bool
457maptile::_save_objects (object_freezer &f, int flags) 456maptile::_save_objects (object_freezer &f, int flags)
458{ 457{
459 static int cede_count = 0; 458 coroapi::cede_to_tick ();
460 459
461 if (flags & IO_HEADER) 460 if (flags & IO_HEADER)
462 _save_header (f); 461 _save_header (f);
463 462
464 if (!spaces) 463 if (!spaces)
465 return false; 464 return false;
466 465
467 for (int i = 0; i < size (); ++i) 466 for (int i = 0; i < size (); ++i)
468 { 467 {
469#if 0 // temporarily disabled for improved(?) stability, schmorp #TODO#d#//D
470 if (cede_count >= 500)
471 {
472 cede_count = 0;
473 coroapi::cede ();
474 }
475#endif
476
477 int unique = 0; 468 int unique = 0;
478 for (object *op = spaces [i].bot; op; op = op->above) 469 for (object *op = spaces [i].bot; op; op = op->above)
479 { 470 {
480 // count per-object, but cede only when modification-safe
481 cede_count++;
482
483 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR]) 471 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR])
484 unique = 1; 472 unique = 1;
485 473
486 if (!op->can_map_save ()) 474 if (!op->can_map_save ())
487 continue; 475 continue;
493 } 481 }
494 else if (flags & IO_OBJECTS) 482 else if (flags & IO_OBJECTS)
495 op->write (f); 483 op->write (f);
496 } 484 }
497 } 485 }
486
487 coroapi::cede_to_tick ();
498 488
499 return true; 489 return true;
500} 490}
501 491
502bool 492bool
1081 1071
1082 //object *middle = 0; 1072 //object *middle = 0;
1083 //object *top = 0; 1073 //object *top = 0;
1084 //object *floor = 0; 1074 //object *floor = 0;
1085 // this seems to generate better code than using locals, above 1075 // this seems to generate better code than using locals, above
1086 object *&top = faces_obj[0]; 1076 object *&top = faces_obj[0] = 0;
1087 object *&middle = faces_obj[1]; 1077 object *&middle = faces_obj[1] = 0;
1088 object *&floor = faces_obj[2]; 1078 object *&floor = faces_obj[2] = 0;
1089 1079
1090 for (tmp = bot; tmp; last = tmp, tmp = tmp->above) 1080 for (tmp = bot; tmp; last = tmp, tmp = tmp->above)
1091 { 1081 {
1092 /* This could be made additive I guess (two lights better than 1082 /* This could be made additive I guess (two lights better than
1093 * one). But if so, it shouldn't be a simple additive - 2 1083 * one). But if so, it shouldn't be a simple additive - 2

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines