* Immediately remove all dead objects. */
| 973 | * Immediately remove all dead objects. |
| 974 | */ |
| 975 | void OpenApoc::GameState::cleanUpDeathNote() |
| 976 | { |
| 977 | // Any additional death notes should processed here. |
| 978 | if (!vehiclesDeathNote.empty()) |
| 979 | { |
| 980 | for (auto &name : this->vehiclesDeathNote) |
| 981 | { |
| 982 | vehicles.erase(name); |
| 983 | |
| 984 | // Remove vehicle from selection |
| 985 | for (const auto &[cityId, city] : cities) |
| 986 | { |
| 987 | for (auto it = city->cityViewSelectedVehicles.begin(); |
| 988 | it != city->cityViewSelectedVehicles.end();) |
| 989 | { |
| 990 | if (it->id == name) |
| 991 | { |
| 992 | it = city->cityViewSelectedVehicles.erase(it); |
| 993 | } |
| 994 | else |
| 995 | { |
| 996 | ++it; |
| 997 | } |
| 998 | } |
| 999 | } |
| 1000 | } |
| 1001 | vehiclesDeathNote.clear(); |
| 1002 | } |
| 1003 | |
| 1004 | if (!agentsDeathNote.empty()) |
| 1005 | { |
| 1006 | for (auto &name : this->agentsDeathNote) |
| 1007 | { |
| 1008 | agents.erase(name); |
| 1009 | } |
| 1010 | agentsDeathNote.clear(); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | void GameState::update(unsigned int ticks) |
| 1015 | { |
no test coverage detected