aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorrichiesams2013-08-18 15:25:34 -0500
committerrichiesams2013-08-18 19:53:02 -0500
commit3a23873c45f8b274836eacd8d1de471da6defb5b (patch)
tree2a5e112ef7f5237271a3d2421b400f0504a012de /engines
parent25deaf3a35efac8e5103e193f5f68409a87047a0 (diff)
downloadscummvm-rg350-3a23873c45f8b274836eacd8d1de471da6defb5b.tar.gz
scummvm-rg350-3a23873c45f8b274836eacd8d1de471da6defb5b.tar.bz2
scummvm-rg350-3a23873c45f8b274836eacd8d1de471da6defb5b.zip
ZVISION: Convert _activeControls from a List to a HashMap
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/scr_file_handling.cpp21
-rw-r--r--engines/zvision/script_manager.h4
2 files changed, 9 insertions, 16 deletions
diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp
index 9c99ce184d..10e5c8f0eb 100644
--- a/engines/zvision/scr_file_handling.cpp
+++ b/engines/zvision/scr_file_handling.cpp
@@ -62,12 +62,7 @@ void ScriptManager::parseScrFile(const Common::String &fileName, bool isGlobal)
_activePuzzles.push_back(puzzle);
}
} else if (line.matchString("control:*", true)) {
- Common::SharedPtr<Control> control;
-
- // Some controls don't require nodes. They just initialize the scene
- if (parseControl(line, file, control)) {
- _activeControls.push_back(control);
- }
+ parseControl(line, file);
}
}
}
@@ -300,7 +295,7 @@ uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const {
return flags;
}
-bool ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream, Common::SharedPtr<Control> &control) {
+void ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream) {
uint32 key;
char controlTypeBuffer[20];
@@ -309,21 +304,19 @@ bool ScriptManager::parseControl(Common::String &line, Common::SeekableReadStrea
Common::String controlType(controlTypeBuffer);
if (controlType.equalsIgnoreCase("push_toggle")) {
- Control::parsePushToggleControl(key, _engine, stream);
- return false;
+ _activeControls[key] = new PushToggleControl(key, stream);
+ return;
} else if (controlType.equalsIgnoreCase("flat")) {
Control::parseFlatControl(_engine);
- return false;
+ return;
} else if (controlType.equalsIgnoreCase("pana")) {
Control::parsePanoramaControl(_engine, stream);
- return false;
+ return;
}
else if (controlType.equalsIgnoreCase("tilt")) {
Control::parseTiltControl(_engine, stream);
- return false;
+ return;
}
-
- return true;
}
} // End of namespace ZVision
diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h
index c0801edd5e..3d64727506 100644
--- a/engines/zvision/script_manager.h
+++ b/engines/zvision/script_manager.h
@@ -70,7 +70,7 @@ private:
/** Holds the global puzzles */
Common::List<Puzzle>_globalPuzzles;
/** Holds the currently active controls */
- Common::List<Common::SharedPtr<Control> > _activeControls;
+ Common::HashMap<uint32, Control *> _activeControls;
Location _nextLocation;
bool _changeLocation;
@@ -145,7 +145,7 @@ private:
* @param line The line initially read
* @param stream Scr file stream
*/
- bool parseControl(Common::String &line, Common::SeekableReadStream &stream, Common::SharedPtr<Control> &control);
+ void parseControl(Common::String &line, Common::SeekableReadStream &stream);
};