aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe/input.cpp
diff options
context:
space:
mode:
authorColin Snover2017-11-18 10:58:46 -0600
committerEugene Sandulenko2017-11-18 22:35:12 +0100
commite40b4a348a8beb91fe97aa97f6e2323e78b3e10e (patch)
tree5bcd9bd0c363017d4a33697f455bac6bec53d3e4 /engines/fullpipe/input.cpp
parenta5060cf3789a438a76b8e70b6e07ba7a26906895 (diff)
downloadscummvm-rg350-e40b4a348a8beb91fe97aa97f6e2323e78b3e10e.tar.gz
scummvm-rg350-e40b4a348a8beb91fe97aa97f6e2323e78b3e10e.tar.bz2
scummvm-rg350-e40b4a348a8beb91fe97aa97f6e2323e78b3e10e.zip
FULLPIPE: Fix memory leaks of arcade keys
Fixes Trac#9657.
Diffstat (limited to 'engines/fullpipe/input.cpp')
-rw-r--r--engines/fullpipe/input.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index d692f87366..3b733b9eab 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -262,16 +262,12 @@ void FullpipeEngine::initArcadeKeys(const char *varname) {
return;
int cnt = var->getSubVarsCount();
-
+ _arcadeKeys.resize(cnt);
for (int i = 0; i < cnt; i++) {
- Common::Point *point = new Common::Point;
-
+ Common::Point &point = _arcadeKeys[i];
GameVar *sub = var->getSubVarByIndex(i);
-
- point->x = sub->getSubVarAsInt("X");
- point->y = sub->getSubVarAsInt("Y");
-
- _arcadeKeys.push_back(point);
+ point.x = sub->getSubVarAsInt("X");
+ point.y = sub->getSubVarAsInt("Y");
}
}
@@ -283,7 +279,7 @@ void FullpipeEngine::processArcade(ExCommand *cmd) {
if (cmd->_sceneClickX <= g_fp->_aniMan2->_ox) {
for (idx = (int)_arcadeKeys.size() - 1; idx >= 0; idx--) {
- if (_arcadeKeys[idx]->x < g_fp->_aniMan2->_ox)
+ if (_arcadeKeys[idx].x < g_fp->_aniMan2->_ox)
break;
}
@@ -291,7 +287,7 @@ void FullpipeEngine::processArcade(ExCommand *cmd) {
return;
} else {
for (idx = 0; idx < (int)_arcadeKeys.size(); idx++) {
- if (_arcadeKeys[idx]->x > g_fp->_aniMan2->_ox)
+ if (_arcadeKeys[idx].x > g_fp->_aniMan2->_ox)
break;
}
@@ -299,8 +295,8 @@ void FullpipeEngine::processArcade(ExCommand *cmd) {
return;
}
- cmd->_sceneClickX = _arcadeKeys[idx]->x;
- cmd->_sceneClickY = _arcadeKeys[idx]->y;
+ cmd->_sceneClickX = _arcadeKeys[idx].x;
+ cmd->_sceneClickY = _arcadeKeys[idx].y;
cmd->_x = cmd->_sceneClickX - g_fp->_sceneRect.left;
cmd->_y = cmd->_sceneClickY - g_fp->_sceneRect.top;