aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichiesams2013-07-01 17:23:57 -0500
committerrichiesams2013-08-04 13:31:54 -0500
commit8d9f90bf12c758ac4845f19ae8584c0c5ee264c8 (patch)
tree1506cc45f5a9c55478bb19f81e71ebf21a25f58b
parentdec34c174bd34f1fd1354985e7c70336270dd9e6 (diff)
downloadscummvm-rg350-8d9f90bf12c758ac4845f19ae8584c0c5ee264c8.tar.gz
scummvm-rg350-8d9f90bf12c758ac4845f19ae8584c0c5ee264c8.tar.bz2
scummvm-rg350-8d9f90bf12c758ac4845f19ae8584c0c5ee264c8.zip
ZVISION: Create ScriptManager accessor for ZVision
Having the ScriptManager as a member variable forced it to be const, which prevented any non cont methods to be used. Thus, ScriptManager is created on the heap and disposed after use.
-rw-r--r--engines/zvision/zvision.cpp16
-rw-r--r--engines/zvision/zvision.h5
2 files changed, 15 insertions, 6 deletions
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index 2009ccde44..33b2a80bd4 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -60,19 +60,23 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine
//DebugMan.addDebugChannel(kZVisionDebugExample, "example", "this is just an example for a engine specific debug channel");
//DebugMan.addDebugChannel(kZVisionDebugExample2, "example2", "also an example");
- // Don't forget to register your random source
+ // Register random source
_rnd = new Common::RandomSource("zvision");
+ // Create managers
+ _scriptManager = new ScriptManager();
+
debug("ZVision::ZVision");
}
ZVision::~ZVision() {
debug("ZVision::~ZVision");
- // Dispose your resources here
+ // Dispose of resources
+ delete _scriptManager;
delete _rnd;
- // Remove all of our debug levels here
+ // Remove all of our debug levels
DebugMan.clearAllDebugChannels();
}
@@ -93,7 +97,7 @@ void ZVision::initialize() {
Graphics::PixelFormat format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); // RGB555
initGraphics(640, 480, true, &format);
- _scriptManager.initialize();
+ _scriptManager->initialize();
// Create debugger console. It requires GFX to be initialized
_console = new Console(this);
@@ -134,4 +138,8 @@ Common::Error ZVision::run() {
return Common::kNoError;
}
+ScriptManager *ZVision::getScriptManager() const {
+ return _scriptManager;
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index b57ce20e25..b0cd1aec5a 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -58,7 +58,7 @@ private:
// We need random numbers
Common::RandomSource *_rnd;
- ScriptManager _scriptManager;
+ ScriptManager *_scriptManager;
// To prevent allocation every time we process events
Common::Event _event;
@@ -69,7 +69,8 @@ public:
uint32 getFeatures() const;
Common::Language getLanguage() const;
virtual Common::Error run();
-
+ ScriptManager *getScriptManager() const;
+
private:
void initialize();