aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-28 02:20:57 +0530
committerEugene Sandulenko2019-09-03 17:17:03 +0200
commite18effcce4ba7a998b0b83491c2b7363ba55ac64 (patch)
tree3e32d4ecad7dc66c1a2f3ec677abbdb70d3eac27
parent4461c1b7efa24384c51ad62fe796a06decac041c (diff)
downloadscummvm-rg350-e18effcce4ba7a998b0b83491c2b7363ba55ac64.tar.gz
scummvm-rg350-e18effcce4ba7a998b0b83491c2b7363ba55ac64.tar.bz2
scummvm-rg350-e18effcce4ba7a998b0b83491c2b7363ba55ac64.zip
HDB: Rewrite _animTargets as a struct array
-rw-r--r--engines/hdb/ai-init.cpp4
-rw-r--r--engines/hdb/ai-lists.cpp17
-rw-r--r--engines/hdb/ai.h2
3 files changed, 10 insertions, 13 deletions
diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp
index 5bb8c89c05..56ecad26ca 100644
--- a/engines/hdb/ai-init.cpp
+++ b/engines/hdb/ai-init.cpp
@@ -669,7 +669,6 @@ AIEntTypeInfo aiEntList[] = {
AI::AI() {
_ents = new Common::Array<AIEntity *>;
_floats = new Common::Array<AIEntity *>;
- _animTargets = new Common::Array<AnimTarget *>;
_arrowPaths = new Common::Array<ArrowPath *>;
_triggerList = new Common::Array<Trigger *>;
_hereList = new Common::Array<HereT *>;
@@ -684,7 +683,6 @@ AI::AI() {
AI::~AI() {
delete _ents;
delete _floats;
- delete _animTargets;
delete _arrowPaths;
delete _triggerList;
delete _hereList;
@@ -854,7 +852,7 @@ void AI::restartSystem() {
_numLuaList = 0;
// Clear Anim Targets List
- _animTargets->clear();
+ _animTargets.clear();
// Clear ArrowPath List
_arrowPaths->clear();
diff --git a/engines/hdb/ai-lists.cpp b/engines/hdb/ai-lists.cpp
index bd3fcbf236..95bfe04d94 100644
--- a/engines/hdb/ai-lists.cpp
+++ b/engines/hdb/ai-lists.cpp
@@ -77,7 +77,7 @@ void AI::addAnimateTarget(int x, int y, int start, int end, AnimSpeed speed, boo
}
// Insert in the beginning
- _animTargets->insert_at(0, at);
+ _animTargets.insert_at(0, at);
}
/*
@@ -90,15 +90,15 @@ void AI::animateTargets() {
int layer;
g_hdb->_map->getMapXY(&mx, &my);
- debug(9, "animateTargets: Size of _animTargets: %d", _animTargets->size());
+ debug(9, "animateTargets: Size of _animTargets: %d", _animTargets.size());
debug(9, "_animTargets:");
- for (Common::Array<AnimTarget *>::iterator it = _animTargets->begin(); it != _animTargets->end(); it++) {
- at = *it;
- debug(9, "it - _animTargets->begin(): %ld", it - _animTargets->begin());
+ for (uint i = 0; i < _animTargets.size(); i++) {
+ at = _animTargets[i];
+ debug(9, "i: %d", i);
debug(9, "at: at->x: %d, at->y: %d, at->start: %d, at->end: %d, at->vel: %d", at->x, at->y, at->start, at->end, at->vel);
- // Draw Non-Map stuff every frame
+ // Draw Non-map stuff every frame
if (!at->inMap)
// FIXME: Out of bounds reference to gfxList
at->gfxList[at->start]->drawMasked(at->x - mx, at->y - my);
@@ -133,9 +133,8 @@ void AI::animateTargets() {
if (at->killAuto)
autoDeactivate(at->x, at->y);
- AnimTarget **jt = it;
- _animTargets->erase(it);
- it = jt-1;
+ _animTargets.remove_at(i);
+ i--;
continue;
}
}
diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h
index 654eec95a4..ab0abe6af3 100644
--- a/engines/hdb/ai.h
+++ b/engines/hdb/ai.h
@@ -1110,7 +1110,7 @@ private:
Common::Array<AIEntity *> *_ents;
Common::Array<AIEntity *> *_floats;
- Common::Array<AnimTarget *> *_animTargets;
+ Common::Array<AnimTarget *> _animTargets;
AIEntity *_player;
// Cinematics Variables