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.98 by root, Sat Mar 17 22:11:22 2007 UTC

454} 454}
455 455
456bool 456bool
457maptile::_save_objects (object_freezer &f, int flags) 457maptile::_save_objects (object_freezer &f, int flags)
458{ 458{
459 static int cede_count = 0; 459 coroapi::cede ();
460 460
461 if (flags & IO_HEADER) 461 if (flags & IO_HEADER)
462 _save_header (f); 462 _save_header (f);
463 463
464 if (!spaces) 464 if (!spaces)
465 return false; 465 return false;
466 466
467 for (int i = 0; i < size (); ++i) 467 for (int i = 0; i < size (); ++i)
468 { 468 {
469#if 0 // temporarily disabled for improved(?) stability, schmorp #TODO#d#//D 469#if 0 // disabled, there still seem to be races somewhere
470 static int cede_count = 0;
471
470 if (cede_count >= 500) 472 if (cede_count >= 500)
471 { 473 {
472 cede_count = 0; 474 cede_count = 0;
473 coroapi::cede (); 475 coroapi::cede ();
474 } 476 }
475#endif 477#endif
476 478
477 int unique = 0; 479 int unique = 0;
478 for (object *op = spaces [i].bot; op; op = op->above) 480 for (object *op = spaces [i].bot; op; op = op->above)
479 { 481 {
482#if 0
480 // count per-object, but cede only when modification-safe 483 // count per-object, but cede only when modification-safe
481 cede_count++; 484 cede_count++;
485#endif
482 486
483 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR]) 487 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR])
484 unique = 1; 488 unique = 1;
485 489
486 if (!op->can_map_save ()) 490 if (!op->can_map_save ())
493 } 497 }
494 else if (flags & IO_OBJECTS) 498 else if (flags & IO_OBJECTS)
495 op->write (f); 499 op->write (f);
496 } 500 }
497 } 501 }
502
503 coroapi::cede ();
498 504
499 return true; 505 return true;
500} 506}
501 507
502bool 508bool
1081 1087
1082 //object *middle = 0; 1088 //object *middle = 0;
1083 //object *top = 0; 1089 //object *top = 0;
1084 //object *floor = 0; 1090 //object *floor = 0;
1085 // this seems to generate better code than using locals, above 1091 // this seems to generate better code than using locals, above
1086 object *&top = faces_obj[0]; 1092 object *&top = faces_obj[0] = 0;
1087 object *&middle = faces_obj[1]; 1093 object *&middle = faces_obj[1] = 0;
1088 object *&floor = faces_obj[2]; 1094 object *&floor = faces_obj[2] = 0;
1089 1095
1090 for (tmp = bot; tmp; last = tmp, tmp = tmp->above) 1096 for (tmp = bot; tmp; last = tmp, tmp = tmp->above)
1091 { 1097 {
1092 /* This could be made additive I guess (two lights better than 1098 /* This could be made additive I guess (two lights better than
1093 * one). But if so, it shouldn't be a simple additive - 2 1099 * one). But if so, it shouldn't be a simple additive - 2

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines