diff options
author | Paul Gilbert | 2011-04-09 21:27:25 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-04-09 21:27:25 +1000 |
commit | 747295e9b452cc906821c275bea948560438d03e (patch) | |
tree | f4aed4bf941d527578ca3494d5430a3c3abd6e1b /engines | |
parent | f5d22217d66e568b92230b8c8d799ab3dedc05e8 (diff) | |
download | scummvm-rg350-747295e9b452cc906821c275bea948560438d03e.tar.gz scummvm-rg350-747295e9b452cc906821c275bea948560438d03e.tar.bz2 scummvm-rg350-747295e9b452cc906821c275bea948560438d03e.zip |
TSAGE: Fixing memory leaks
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/events.cpp | 1 | ||||
-rw-r--r-- | engines/tsage/globals.h | 1 | ||||
-rw-r--r-- | engines/tsage/resources.cpp | 26 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 1 | ||||
-rw-r--r-- | engines/tsage/tsage.cpp | 17 | ||||
-rw-r--r-- | engines/tsage/tsage.h | 1 |
6 files changed, 27 insertions, 20 deletions
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index be3b7e3f53..7b02683226 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -37,6 +37,7 @@ namespace tSage { EventsClass::EventsClass() { + _currentCursor = CURSOR_NONE; _frameNumber = 0; _priorFrameTime = 0; _prevDelayFrame = 0; diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index c06c073691..1696ae300d 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -70,7 +70,6 @@ public: SequenceManager _sequenceManager; Common::RandomSource _randomSource; int _stripNum; - FloatSet _floatSet; public: Globals(); ~Globals(); diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp index 74e9183cf5..619f818f6e 100644 --- a/engines/tsage/resources.cpp +++ b/engines/tsage/resources.cpp @@ -178,14 +178,14 @@ void RlbManager::loadSection(uint32 fileOffset) { assert(type <= 1); uint32 offset = _file.readUint32LE(); - ResourceEntry *re = new ResourceEntry(); - re->id = id; - re->fileOffset = offset; - re->isCompressed = type != 0; - re->size = ((sizeHi & 0xF) << 16) | size; - re->uncompressedSize = ((sizeHi & 0xF0) << 12) | uncSize; - - _resources.push_back(*re); + ResourceEntry re; + re.id = id; + re.fileOffset = offset; + re.isCompressed = type != 0; + re.size = ((sizeHi & 0xF) << 16) | size; + re.uncompressedSize = ((sizeHi & 0xF0) << 12) | uncSize; + + _resources.push_back(re); } } @@ -340,12 +340,12 @@ void RlbManager::loadIndex() { fileOffset = READ_LE_UINT16(p + 4); p += 6; - SectionEntry *se = new SectionEntry(); - se->resNum = resNum; - se->resType = (ResourceType)(configId & 0x1f); - se->fileOffset = (((configId >> 5) & 0x7ff) << 16) | fileOffset; + SectionEntry se; + se.resNum = resNum; + se.resType = (ResourceType)(configId & 0x1f); + se.fileOffset = (((configId >> 5) & 0x7ff) << 16) | fileOffset; - _sections.push_back(*se); + _sections.push_back(se); } _memoryManager.deallocate(pData); diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 665fa46830..5a351f3772 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -35,6 +35,7 @@ SceneManager::SceneManager() { _hasPalette = false; _sceneNumber = -1; _nextSceneNumber = -1; + _previousScene = 0; _fadeMode = FADEMODE_GRADUAL; _scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); _saver->addListener(this); diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 5a1d8d3f76..aff4f051a2 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -73,15 +73,21 @@ bool TSageEngine::hasFeature(EngineFeature f) const { void TSageEngine::initialise() { _tSageManager = new RlbManager(_memoryManager, "tsage.rlb"); _dataManager = new RlbManager(_memoryManager, "ring.rlb"); -} -Common::Error TSageEngine::run() { - // Basic initialisation - initialise(); _saver = new Saver(); _globals = new Globals(); _globals->gfxManager().setDefaults(); +} +void TSageEngine::deinitialise() { + delete _globals; + delete _saver; + delete _tSageManager; + delete _dataManager; +} + +Common::Error TSageEngine::run() { + // Basic initialisation initialise(); _globals->_events.showCursor(); @@ -89,8 +95,7 @@ Common::Error TSageEngine::run() { _globals->_sceneHandler.registerHandler(); _globals->_game.execute(); - delete _globals; - delete _saver; + deinitialise(); return Common::kNoError; } diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h index 2bb9e3803f..02516152ae 100644 --- a/engines/tsage/tsage.h +++ b/engines/tsage/tsage.h @@ -90,6 +90,7 @@ public: Common::String generateSaveName(int slot); void initialise(); + void deinitialise(); }; extern TSageEngine *_vm; |