| 1622 | } |
| 1623 | |
| 1624 | void Battle::update(GameState &state, unsigned int ticks) |
| 1625 | { |
| 1626 | |
| 1627 | if (missionEndTimer > 0) |
| 1628 | { |
| 1629 | missionEndTimer++; |
| 1630 | ticksWithoutAction = 0; |
| 1631 | for (auto &p : participants) |
| 1632 | { |
| 1633 | ticksWithoutSeenAction[p] = 0; |
| 1634 | } |
| 1635 | } |
| 1636 | switch (mode) |
| 1637 | { |
| 1638 | case Mode::TurnBased: |
| 1639 | { |
| 1640 | updateTB(state); |
| 1641 | break; |
| 1642 | } |
| 1643 | case Mode::RealTime: |
| 1644 | { |
| 1645 | updateRT(state, ticks); |
| 1646 | break; |
| 1647 | } |
| 1648 | } |
| 1649 | updateProjectiles(state, ticks); |
| 1650 | for (auto &o : this->doors) |
| 1651 | { |
| 1652 | o.second->update(state, ticks); |
| 1653 | } |
| 1654 | for (auto it = this->doodads.begin(); it != this->doodads.end();) |
| 1655 | { |
| 1656 | auto d = *it++; |
| 1657 | d->update(state, ticks); |
| 1658 | } |
| 1659 | for (auto it = this->hazards.begin(); it != this->hazards.end();) |
| 1660 | { |
| 1661 | if ((*it)->update(state, ticks)) |
| 1662 | it = hazards.erase(it); |
| 1663 | else |
| 1664 | ++it; |
| 1665 | } |
| 1666 | for (auto it = this->explosions.begin(); it != this->explosions.end();) |
| 1667 | { |
| 1668 | auto d = *it++; |
| 1669 | d->update(state, ticks); |
| 1670 | } |
| 1671 | for (auto &o : this->map_parts) |
| 1672 | { |
| 1673 | o->update(state, ticks); |
| 1674 | } |
| 1675 | for (auto it = this->items.begin(); it != this->items.end();) |
| 1676 | { |
| 1677 | auto p = *it++; |
| 1678 | p->update(state, ticks); |
| 1679 | } |
| 1680 | for (auto &o : this->scanners) |
| 1681 | { |
no test coverage detected