aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2011-01-29 22:48:44 +0000
committerSven Hesse2011-01-29 22:48:44 +0000
commitffc4af820f9dbdb6af75ce15c56e3677db3af567 (patch)
tree6d580328b1f533968e86940d14734d724f30af00 /engines/gob
parentd2c9893327891a6cc1c2402593c1b8f62c650b7e (diff)
downloadscummvm-rg350-ffc4af820f9dbdb6af75ce15c56e3677db3af567.tar.gz
scummvm-rg350-ffc4af820f9dbdb6af75ce15c56e3677db3af567.tar.bz2
scummvm-rg350-ffc4af820f9dbdb6af75ce15c56e3677db3af567.zip
GOB: _environments doesn't need to be a pointer
svn-id: r55636
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/game.cpp30
-rw-r--r--engines/gob/game.h6
2 files changed, 17 insertions, 19 deletions
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index b913b2dd8c..6bf0f3c1f5 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -247,7 +247,7 @@ bool Environments::getMedia(uint8 env) {
}
-Game::Game(GobEngine *vm) : _vm(vm) {
+Game::Game(GobEngine *vm) : _vm(vm), _environments(_vm) {
_captureCount = 0;
_startTimeKey = 0;
@@ -267,14 +267,12 @@ Game::Game(GobEngine *vm) : _vm(vm) {
_numEnvironments = 0;
_curEnvironment = 0;
- _environments = new Environments(_vm);
- _script = new Script(_vm);
- _resources = new Resources(_vm);
- _hotspots = new Hotspots(_vm);
+ _script = new Script(_vm);
+ _resources = new Resources(_vm);
+ _hotspots = new Hotspots(_vm);
}
Game::~Game() {
- delete _environments;
delete _script;
delete _resources;
delete _hotspots;
@@ -644,11 +642,11 @@ void Game::totSub(int8 flags, const Common::String &totFile) {
if (_numEnvironments >= Environments::kEnvironmentCount)
error("Game::totSub(): Environments overflow");
- _environments->set(_numEnvironments);
+ _environments.set(_numEnvironments);
if (flags == 18) {
warning("Backuping media to %d", _numEnvironments);
- _environments->setMedia(_numEnvironments);
+ _environments.setMedia(_numEnvironments);
}
curBackupPos = _curEnvironment;
@@ -694,11 +692,11 @@ void Game::totSub(int8 flags, const Common::String &totFile) {
_numEnvironments--;
_curEnvironment = curBackupPos;
- _environments->get(_numEnvironments);
+ _environments.get(_numEnvironments);
if (flags == 18) {
warning("Restoring media from %d", _numEnvironments);
- _environments->getMedia(_numEnvironments);
+ _environments.getMedia(_numEnvironments);
}
_vm->_global->_inter_animDataSize = _script->getAnimDataSize();
@@ -718,13 +716,13 @@ void Game::switchTotSub(int16 index, int16 function) {
// WORKAROUND: Some versions don't make the MOVEMENT menu item unselectable
// in the dreamland screen, resulting in a crash when it's clicked.
if ((_vm->getGameType() == kGameTypeGob2) && (index == -1) && (function == 7) &&
- _environments->getTotFile(newPos).equalsIgnoreCase("gob06.tot"))
+ _environments.getTotFile(newPos).equalsIgnoreCase("gob06.tot"))
return;
curBackupPos = _curEnvironment;
backupedCount = _numEnvironments;
if (_curEnvironment == _numEnvironments)
- _environments->set(_numEnvironments++);
+ _environments.set(_numEnvironments++);
_curEnvironment -= index;
if (index >= 0)
@@ -732,7 +730,7 @@ void Game::switchTotSub(int16 index, int16 function) {
clearUnusedEnvironment();
- _environments->get(_curEnvironment);
+ _environments.get(_curEnvironment);
if (_vm->_inter->_terminate != 0) {
clearUnusedEnvironment();
@@ -751,15 +749,15 @@ void Game::switchTotSub(int16 index, int16 function) {
_curEnvironment = curBackupPos;
_numEnvironments = backupedCount;
- _environments->get(_curEnvironment);
+ _environments.get(_curEnvironment);
}
void Game::clearUnusedEnvironment() {
- if (!_environments->has(_script)) {
+ if (!_environments.has(_script)) {
delete _script;
_script = 0;
}
- if (!_environments->has(_resources)) {
+ if (!_environments.has(_resources)) {
delete _resources;
_resources = 0;
}
diff --git a/engines/gob/game.h b/engines/gob/game.h
index 8a67eb29fc..82e73678d5 100644
--- a/engines/gob/game.h
+++ b/engines/gob/game.h
@@ -128,6 +128,8 @@ public:
void switchTotSub(int16 index, int16 function);
protected:
+ GobEngine *_vm;
+
char _tempStr[256];
// Capture
@@ -137,9 +139,7 @@ protected:
// For totSub()
int8 _curEnvironment;
int8 _numEnvironments;
- Environments *_environments;
-
- GobEngine *_vm;
+ Environments _environments;
void clearUnusedEnvironment();
};