mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 03:40:25 +00:00
HPL1: fix removal of player collide scripts
the problem was caused by an incorrect fix for iterator invalidation
This commit is contained in:
parent
fe0ec0f5f5
commit
873d28366b
@ -524,17 +524,21 @@ void cPlayer::AddCollideScript(eGameCollideScriptType aType, const tString &asFu
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
void cPlayer::RemoveCollideScriptWithChildEntity(iGameEntity *apEntity) {
|
||||
for (auto& kv : m_mapCollideCallbacks) {
|
||||
cGameCollideScript *pCallback = kv.second;
|
||||
tGameCollideScriptMapIt it = m_mapCollideCallbacks.begin();
|
||||
for (; it != m_mapCollideCallbacks.end();) {
|
||||
cGameCollideScript *pCallback = it->second;
|
||||
tGameCollideScriptMapIt currentIt = it;
|
||||
++it;
|
||||
|
||||
if (pCallback && pCallback->mpEntity == apEntity) {
|
||||
if (mbUpdatingCollisionCallbacks)
|
||||
if (mbUpdatingCollisionCallbacks) {
|
||||
pCallback->mbDeleteMe = true;
|
||||
else
|
||||
} else {
|
||||
hplDelete(pCallback);
|
||||
m_mapCollideCallbacks.erase(currentIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_mapCollideCallbacks.clear();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user