… | |
… | |
345 | |
345 | |
346 | { |
346 | { |
347 | archetype *head = parts.front ().first; |
347 | archetype *head = parts.front ().first; |
348 | |
348 | |
349 | // check that all archetypes belong to the same object or are heads |
349 | // check that all archetypes belong to the same object or are heads |
350 | for (AUTODECL (p, parts.begin ()); p != parts.end (); ++p) |
350 | for (auto (p, parts.begin ()); p != parts.end (); ++p) |
351 | { |
351 | { |
352 | archetype *at = p->first; |
352 | archetype *at = p->first; |
353 | |
353 | |
354 | if (at->head != head && at->head) |
354 | if (at->head != head && at->head) |
355 | { |
355 | { |
… | |
… | |
386 | first_archetype = head; |
386 | first_archetype = head; |
387 | } |
387 | } |
388 | |
388 | |
389 | // reassemble new chain |
389 | // reassemble new chain |
390 | archetype *prev = head; |
390 | archetype *prev = head; |
391 | for (AUTODECL (p, parts.begin () + 1); p != parts.end (); ++p) |
391 | for (auto (p, parts.begin () + 1); p != parts.end (); ++p) |
392 | { |
392 | { |
393 | archetype *at = p->first; |
393 | archetype *at = p->first; |
394 | overwrite (at, p->second); |
394 | overwrite (at, p->second); |
395 | |
395 | |
396 | if (at->clone.x > head->tail_x) head->tail_x = at->clone.x; |
396 | if (at->clone.x > head->tail_x) head->tail_x = at->clone.x; |
… | |
… | |
406 | } |
406 | } |
407 | |
407 | |
408 | return true; |
408 | return true; |
409 | |
409 | |
410 | fail: |
410 | fail: |
411 | for (AUTODECL (p, parts.begin ()); p != parts.end (); ++p) |
411 | for (auto (p, parts.begin ()); p != parts.end (); ++p) |
412 | p->second->destroy (true); |
412 | p->second->destroy (true); |
413 | |
413 | |
414 | return false; |
414 | return false; |
415 | } |
415 | } |
416 | |
416 | |
… | |
… | |
540 | archetype::find (const char *name) |
540 | archetype::find (const char *name) |
541 | { |
541 | { |
542 | if (!name) |
542 | if (!name) |
543 | return 0; |
543 | return 0; |
544 | |
544 | |
545 | AUTODECL (i, ht.find (name)); |
545 | auto (i, ht.find (name)); |
546 | |
546 | |
547 | if (i == ht.end ()) |
547 | if (i == ht.end ()) |
548 | return 0; |
548 | return 0; |
549 | else |
549 | else |
550 | return i->second; |
550 | return i->second; |