| 4552 | } |
| 4553 | |
| 4554 | void BattleUnit::markUnVisible(GameState &state) |
| 4555 | { // Remove from list of visible units |
| 4556 | StateRef<BattleUnit> srThis = {&state, id}; |
| 4557 | for (auto &units : state.current_battle->visibleUnits) |
| 4558 | { |
| 4559 | if (units.first != owner) |
| 4560 | { |
| 4561 | units.second.erase(srThis); |
| 4562 | } |
| 4563 | } |
| 4564 | for (auto &units : state.current_battle->visibleEnemies) |
| 4565 | { |
| 4566 | if (units.first != owner) |
| 4567 | { |
| 4568 | units.second.erase(srThis); |
| 4569 | } |
| 4570 | } |
| 4571 | for (auto &unit : state.current_battle->units) |
| 4572 | { |
| 4573 | if (unit.second->owner != owner) |
| 4574 | { |
| 4575 | unit.second->visibleUnits.erase(srThis); |
| 4576 | unit.second->visibleEnemies.erase(srThis); |
| 4577 | } |
| 4578 | } |
| 4579 | } |
| 4580 | |
| 4581 | void BattleUnit::retreat(GameState &state) |
| 4582 | { |