aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2015-12-26 13:58:07 +0100
committerWillem Jan Palenstijn2015-12-26 13:58:07 +0100
commit6daf92cbf41bb152c77312b692474fb44b5a7aee (patch)
treef3080ea0b74f05ff9cab6c25d1d36cea9c1e6a44
parent7f2b69b75c8e352ea06c9571992a00d5ffe7308f (diff)
downloadscummvm-rg350-6daf92cbf41bb152c77312b692474fb44b5a7aee.tar.gz
scummvm-rg350-6daf92cbf41bb152c77312b692474fb44b5a7aee.tar.bz2
scummvm-rg350-6daf92cbf41bb152c77312b692474fb44b5a7aee.zip
LAB: Reduce passing around of pointers to the near-global _closeDataPtr
-rw-r--r--engines/lab/engine.cpp8
-rw-r--r--engines/lab/lab.h8
-rw-r--r--engines/lab/processroom.cpp32
3 files changed, 24 insertions, 24 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 91388ea1b4..b88a00024f 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -698,7 +698,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
case kButtonClose:
case kButtonLook:
if ((actionMode == 4) && (buttonId == kButtonLook) && _closeDataPtr) {
- doMainView(&_closeDataPtr);
+ doMainView();
_anim->_doBlack = true;
_closeDataPtr = nullptr;
@@ -748,7 +748,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
oldDirection = _direction;
newDir = processArrow(_direction, buttonId - 6);
- doTurn(_direction, newDir, &_closeDataPtr);
+ doTurn(_direction, newDir);
_anim->_doBlack = true;
_direction = newDir;
forceDraw = true;
@@ -759,7 +759,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
_closeDataPtr = nullptr;
oldRoomNum = _roomNum;
- if (doGoForward(&_closeDataPtr)) {
+ if (doGoForward()) {
if (oldRoomNum == _roomNum)
_anim->_doBlack = true;
} else {
@@ -996,7 +996,7 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
case 5:
if (_conditions->in(curInv)) {
// Use an item on something else
- if (doOperateRule(curPos, curInv, &_closeDataPtr)) {
+ if (doOperateRule(curPos, curInv)) {
_curFileName = _newFileName;
if (!_conditions->in(curInv))
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 958f1596c8..9a6ddc98c2 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -260,7 +260,7 @@ private:
/**
* Goes through the rules if the user tries to go forward.
*/
- bool doGoForward(CloseDataPtr *closePtrList);
+ bool doGoForward();
/**
* Does the journal processing.
@@ -270,7 +270,7 @@ private:
/**
* Goes through the rules if the user tries to go to the main view
*/
- bool doMainView(CloseDataPtr *closePtrList);
+ bool doMainView();
/**
* Does the map processing.
@@ -295,12 +295,12 @@ private:
/**
* Goes through the rules if the user tries to operate an item on an object.
*/
- bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList);
+ bool doOperateRule(Common::Point pos, int16 ItemNum);
/**
* Goes through the rules if the user tries to turn.
*/
- bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList);
+ bool doTurn(uint16 from, uint16 to);
/**
* If the user hits the "Use" button; things that can get used on themselves.
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 4d42f96b50..a7a1ee01ed 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -560,41 +560,41 @@ bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr clos
return false;
}
-bool LabEngine::doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList) {
+bool LabEngine::doOperateRule(Common::Point pos, int16 ItemNum) {
_newFileName = NOFILE;
- CloseDataPtr closePtr = getObject(pos, *closePtrList);
+ CloseDataPtr closePtr = getObject(pos, _closeDataPtr);
- if (doOperateRuleSub(ItemNum, _roomNum, closePtr, closePtrList, false))
+ if (doOperateRuleSub(ItemNum, _roomNum, closePtr, &_closeDataPtr, false))
return true;
- else if (doOperateRuleSub(ItemNum, _roomNum, *closePtrList, closePtrList, false))
+ else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, &_closeDataPtr, false))
return true;
- else if (doOperateRuleSub(ItemNum, _roomNum, closePtr, closePtrList, true))
+ else if (doOperateRuleSub(ItemNum, _roomNum, closePtr, &_closeDataPtr, true))
return true;
- else if (doOperateRuleSub(ItemNum, _roomNum, *closePtrList, closePtrList, true))
+ else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, &_closeDataPtr, true))
return true;
else {
_newFileName = _curFileName;
- if (doOperateRuleSub(ItemNum, 0, closePtr, closePtrList, false))
+ if (doOperateRuleSub(ItemNum, 0, closePtr, &_closeDataPtr, false))
return true;
- else if (doOperateRuleSub(ItemNum, 0, *closePtrList, closePtrList, false))
+ else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, &_closeDataPtr, false))
return true;
- else if (doOperateRuleSub(ItemNum, 0, closePtr, closePtrList, true))
+ else if (doOperateRuleSub(ItemNum, 0, closePtr, &_closeDataPtr, true))
return true;
- else if (doOperateRuleSub(ItemNum, 0, *closePtrList, closePtrList, true))
+ else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, &_closeDataPtr, true))
return true;
}
return false;
}
-bool LabEngine::doGoForward(CloseDataPtr *closePtrList) {
+bool LabEngine::doGoForward() {
RuleList &rules = _rooms[_roomNum]._rules;
for (RuleList::iterator rule = rules.begin(); rule != rules.end(); ++rule) {
if ((rule->_ruleType == kRuleTypeGoForward) && (rule->_param1 == (_direction + 1))) {
if (checkConditions(rule->_condition)) {
- doActions(rule->_actionList, closePtrList);
+ doActions(rule->_actionList, &_closeDataPtr);
return true;
}
}
@@ -603,7 +603,7 @@ bool LabEngine::doGoForward(CloseDataPtr *closePtrList) {
return false;
}
-bool LabEngine::doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) {
+bool LabEngine::doTurn(uint16 from, uint16 to) {
from++;
to++;
@@ -614,7 +614,7 @@ bool LabEngine::doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) {
((rule->_ruleType == kRuleTypeTurnFromTo) &&
(rule->_param1 == from) && (rule->_param2 == to))) {
if (checkConditions(rule->_condition)) {
- doActions(rule->_actionList, closePtrList);
+ doActions(rule->_actionList, &_closeDataPtr);
return true;
}
}
@@ -623,12 +623,12 @@ bool LabEngine::doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) {
return false;
}
-bool LabEngine::doMainView(CloseDataPtr *closePtrList) {
+bool LabEngine::doMainView() {
RuleList &rules = _rooms[_roomNum]._rules;
for (RuleList::iterator rule = rules.begin(); rule != rules.end(); ++rule) {
if (rule->_ruleType == kRuleTypeGoMainView) {
if (checkConditions(rule->_condition)) {
- doActions(rule->_actionList, closePtrList);
+ doActions(rule->_actionList, &_closeDataPtr);
return true;
}
}