aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb
diff options
context:
space:
mode:
authorEugene Sandulenko2019-07-03 20:10:20 +0200
committerEugene Sandulenko2019-09-03 17:17:10 +0200
commitfe9242f412dc66d30ed506021228c792fda99793 (patch)
tree06f9ad4f239d89c8468b0cd7abb5b424dac20d90 /engines/hdb
parentf35b63bc1351278dc5950f8867b0bcb997453fb6 (diff)
downloadscummvm-rg350-fe9242f412dc66d30ed506021228c792fda99793.tar.gz
scummvm-rg350-fe9242f412dc66d30ed506021228c792fda99793.tar.bz2
scummvm-rg350-fe9242f412dc66d30ed506021228c792fda99793.zip
HDB: Implement safe version of removeEntity(). The previous one crashed
Diffstat (limited to 'engines/hdb')
-rw-r--r--engines/hdb/ai-funcs.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp
index 56239c80e0..761f74d4f4 100644
--- a/engines/hdb/ai-funcs.cpp
+++ b/engines/hdb/ai-funcs.cpp
@@ -669,7 +669,11 @@ int AI::checkForTouchplate(int x, int y) {
}
void AI::removeEntity(AIEntity *e) {
- _ents->erase(&e);
+ for (int i = 0; i < _ents->size(); i++)
+ if (_ents->operator[](i) == e) {
+ _ents->remove_at(i);
+ return;
+ }
}
void AI::setEntityGoal(AIEntity *e, int x, int y) {