ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/arch.C
(Generate patch)

Comparing deliantra/server/common/arch.C (file contents):
Revision 1.50 by root, Mon Apr 16 13:02:28 2007 UTC vs.
Revision 1.52 by root, Tue Apr 17 10:06:32 2007 UTC

324 assert (f.kw == KW_object); 324 assert (f.kw == KW_object);
325 325
326 typedef std::pair<archetype *, object *> part; 326 typedef std::pair<archetype *, object *> part;
327 std::vector<part> parts; 327 std::vector<part> parts;
328 328
329 coroapi::cede_to_tick_every (100);
330
329 for (;;) 331 for (;;)
330 { 332 {
331 archetype *at = get (f.get_str ()); 333 archetype *at = get (f.get_str ());
332 object *op = object::create (); 334 object *op = object::create ();
333 335
345 347
346 { 348 {
347 archetype *head = parts.front ().first; 349 archetype *head = parts.front ().first;
348 350
349 // check that all archetypes belong to the same object or are heads 351 // check that all archetypes belong to the same object or are heads
350 for (AUTODECL (p, parts.begin ()); p != parts.end (); ++p) 352 for (auto (p, parts.begin ()); p != parts.end (); ++p)
351 { 353 {
352 archetype *at = p->first; 354 archetype *at = p->first;
353 355
354 if (at->head != head && at->head) 356 if (at->head != head && at->head)
355 { 357 {
386 first_archetype = head; 388 first_archetype = head;
387 } 389 }
388 390
389 // reassemble new chain 391 // reassemble new chain
390 archetype *prev = head; 392 archetype *prev = head;
391 for (AUTODECL (p, parts.begin () + 1); p != parts.end (); ++p) 393 for (auto (p, parts.begin () + 1); p != parts.end (); ++p)
392 { 394 {
393 archetype *at = p->first; 395 archetype *at = p->first;
394 overwrite (at, p->second); 396 overwrite (at, p->second);
395 397
396 if (at->clone.x > head->tail_x) head->tail_x = at->clone.x; 398 if (at->clone.x > head->tail_x) head->tail_x = at->clone.x;
406 } 408 }
407 409
408 return true; 410 return true;
409 411
410fail: 412fail:
411 for (AUTODECL (p, parts.begin ()); p != parts.end (); ++p) 413 for (auto (p, parts.begin ()); p != parts.end (); ++p)
412 p->second->destroy (true); 414 p->second->destroy (true);
413 415
414 return false; 416 return false;
415} 417}
416 418
458{ 460{
459 object_thawer f (filename); 461 object_thawer f (filename);
460 462
461 f.next (); 463 f.next ();
462 464
463 // make sure the next - long - step is only done after a tick
464 coroapi::wait_for_tick_begin ();
465
466 if (!load_archetypes (f)) 465 if (!load_archetypes (f))
467 return false; 466 return false;
468 467
469 warn_archetypes = 1; 468 warn_archetypes = 1;
470 469
471 empty_archetype = archetype::find ("empty_archetype"); 470 empty_archetype = archetype::find ("empty_archetype");
472 if (!empty_archetype) 471 if (!empty_archetype)
473 return false; 472 return false;
474
475 coroapi::cede ();
476 473
477 return true; 474 return true;
478} 475}
479 476
480/* 477/*
540archetype::find (const char *name) 537archetype::find (const char *name)
541{ 538{
542 if (!name) 539 if (!name)
543 return 0; 540 return 0;
544 541
545 AUTODECL (i, ht.find (name)); 542 auto (i, ht.find (name));
546 543
547 if (i == ht.end ()) 544 if (i == ht.end ())
548 return 0; 545 return 0;
549 else 546 else
550 return i->second; 547 return i->second;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines