aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-07-03 20:48:17 +0200
committerEugene Sandulenko2019-09-03 17:17:10 +0200
commit595187da81778b6dd3fdceb0155bd48fad99ea57 (patch)
tree6f8d2ed34ce978ba924865c992c0cd2d10f44c83
parenta48ee7d111cb0d2a096d091b13e374275d3ab139 (diff)
downloadscummvm-rg350-595187da81778b6dd3fdceb0155bd48fad99ea57.tar.gz
scummvm-rg350-595187da81778b6dd3fdceb0155bd48fad99ea57.tar.bz2
scummvm-rg350-595187da81778b6dd3fdceb0155bd48fad99ea57.zip
HDB: Rewrote AI::killTrigger() to a safer variant
-rw-r--r--engines/hdb/ai-lists.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/engines/hdb/ai-lists.cpp b/engines/hdb/ai-lists.cpp
index 2456812e09..d2ddd4ae3a 100644
--- a/engines/hdb/ai-lists.cpp
+++ b/engines/hdb/ai-lists.cpp
@@ -863,9 +863,11 @@ bool AI::checkTriggerList(char *entName, int x, int y) {
}
void AI::killTrigger(const char *id) {
- for (Common::Array<Trigger *>::iterator it = _triggerList->begin(); it != _triggerList->end(); it++) {
- if (!scumm_stricmp(id, (*it)->id))
- _triggerList->erase(it);
+ for (uint i = 0; i < _triggerList->size(); i++) {
+ if (!scumm_stricmp(id, _triggerList->operator[](i)->id)) {
+ _triggerList->remove_at(i);
+ i--;
+ }
}
}