MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / cleanUpDeathNote

Method cleanUpDeathNote

game/state/gamestate.cpp:975–1012  ·  view source on GitHub ↗

* Immediately remove all dead objects. */

Source from the content-addressed store, hash-verified

973 * Immediately remove all dead objects.
974 */
975void 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
1014void GameState::update(unsigned int ticks)
1015{

Callers 4

fillSquadsMethod · 0.80
exitBattleMethod · 0.80
executeOrdersMethod · 0.80
executeOrdersMethod · 0.80

Calls 4

emptyMethod · 0.80
endMethod · 0.80
beginMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected