Permalink
Browse files

Merge pull request #316 from redv/fix_vehicles_zombies

fixed vehicles-zombies
  • Loading branch information...
JonnyH committed Dec 22, 2017
2 parents ae86cc2 + 00ca29b commit 3c7e42ef1f5c266e8656fdd8255ec7725df6750d
Showing with 20 additions and 8 deletions.
  1. +17 −8 game/state/gamestate.cpp
  2. +2 −0 game/state/gamestate.h
  3. +1 −0 game/ui/base/transactionscreen.cpp
View
@@ -1070,6 +1070,22 @@ bool GameState::canTurbo() const
return true;
}
/**
* Immediately remove all dead objects.
*/
void OpenApoc::GameState::cleanUpDeathNote()
{
// Any additional death notes should processed here.
if (!vehiclesDeathNote.empty())
{
for (auto &name : this->vehiclesDeathNote)
{
vehicles.erase(name);
}
vehiclesDeathNote.clear();
}
}
void GameState::update(unsigned int ticks)
{
if (this->current_battle)
@@ -1106,14 +1122,7 @@ void GameState::update(unsigned int ticks)
v.second->update(*this, ticks);
}
}
if (!vehiclesDeathNote.empty())
{
for (auto &name : this->vehiclesDeathNote)
{
vehicles.erase(name);
}
vehiclesDeathNote.clear();
}
cleanUpDeathNote();
Trace::end("GameState::update::vehicles");
Trace::start("GameState::update::agents");
View
@@ -218,6 +218,8 @@ class GameState : public std::enable_shared_from_this<GameState>
// - there are any projectiles on the current map
bool canTurbo() const;
// Immediately remove all dead objects.
void cleanUpDeathNote();
// Update progress
void update(unsigned int ticks);
// updateTurbo progresses 5 minutes at a time - can only be called if canTurbo() returns true.
@@ -1340,6 +1340,7 @@ void TransactionScreen::executeOrders()
player->balance += v.second;
}
}
state->cleanUpDeathNote();
// Step 03.02: If transfer then move stuff from negative to positive
if (mode == Mode::Transfer || needTransfer)

0 comments on commit 3c7e42e

Please sign in to comment.