MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / linkUpList

Function linkUpList

game/state/battle/battle.cpp:391–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391void linkUpList(std::list<BattleMapPart *> list)
392{
393 auto next = list.begin();
394 auto prev = next++;
395 auto cur = next++;
396
397 // In case we are linking to map edge, first map part may be falling and must be linked
398 if ((*prev)->willCollapse())
399 {
400 (*prev)->cancelCollapse();
401 (*cur)->supportedParts.emplace_back((*prev)->position, (*prev)->type->type);
402 }
403 // Link middle
404 while (next != list.end())
405 {
406 (*cur)->cancelCollapse();
407 (*prev)->supportedParts.emplace_back((*cur)->position, (*cur)->type->type);
408 (*next)->supportedParts.emplace_back((*cur)->position, (*cur)->type->type);
409
410 prev++;
411 cur++;
412 next++;
413 }
414 // In case we are linking to map edge, last map part may be falling and must be linked
415 if ((*cur)->willCollapse())
416 {
417 (*cur)->cancelCollapse();
418 (*prev)->supportedParts.emplace_back((*cur)->position, (*cur)->type->type);
419 }
420}
421
422// Remove all solid walls and ground that ended up inside large units
423// For now, removes only ground

Callers

nothing calls this directly

Calls 4

endMethod · 0.80
beginMethod · 0.45
willCollapseMethod · 0.45
cancelCollapseMethod · 0.45

Tested by

no test coverage detected