| 854 | } |
| 855 | |
| 856 | bool Agent::setMission(GameState &state, AgentMission mission) |
| 857 | { |
| 858 | for (auto &m : this->missions) |
| 859 | { |
| 860 | // if we're removing an InvestigateBuilding mission |
| 861 | // decrease the investigate count so the other investigating vehicles won't dangle |
| 862 | if (m.type == AgentMission::MissionType::InvestigateBuilding) |
| 863 | { |
| 864 | if (!m.isFinished(state, *this)) |
| 865 | { |
| 866 | m.targetBuilding->decreasePendingInvestigatorCount(state); |
| 867 | } |
| 868 | } |
| 869 | } |
| 870 | missions.clear(); |
| 871 | missions.emplace_front(mission); |
| 872 | missions.front().start(state, *this); |
| 873 | return true; |
| 874 | } |
| 875 | |
| 876 | bool Agent::popFinishedMissions(GameState &state) |
| 877 | { |
no test coverage detected