| 389 | } |
| 390 | |
| 391 | void 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 |
nothing calls this directly
no test coverage detected