try to clean up a bit better
This commit is contained in:
parent
2b5b820bab
commit
4b21fc9306
3 changed files with 6 additions and 2 deletions
src
|
@ -94,8 +94,8 @@ void CPlayer::Load(lua_State *l)
|
|||
{
|
||||
const int args = lua_gettop(l);
|
||||
|
||||
this->Units.resize(0);
|
||||
this->FreeWorkers.resize(0);
|
||||
this->Units.clear();
|
||||
this->FreeWorkers.clear();
|
||||
|
||||
// j = 0 represent player Index.
|
||||
for (int j = 1; j < args; ++j) {
|
||||
|
|
|
@ -491,6 +491,9 @@ void CUnit::Release(bool final)
|
|||
DebugPrint("unit already free\n");
|
||||
return;
|
||||
}
|
||||
if (PlayerSlot != static_cast<size_t>(-1)) {
|
||||
Player->RemoveUnit(*this);
|
||||
}
|
||||
Assert(Orders.size() == 1);
|
||||
// Must be removed before here
|
||||
Assert(Removed);
|
||||
|
|
|
@ -120,6 +120,7 @@ void CUnitManager::ReleaseUnit(CUnit *unit)
|
|||
unit->UnitManagerData.unitSlot = -1;
|
||||
units.pop_back();
|
||||
}
|
||||
Assert(unit->PlayerSlot == -1);
|
||||
releasedUnits.push_back(unit);
|
||||
unit->ReleaseCycle = GameCycle + 500; // can be reused after this time
|
||||
//Refs = GameCycle + (NetworkMaxLag << 1); // could be reuse after this time
|
||||
|
|
Loading…
Add table
Reference in a new issue