diff options
author | Robert Göffringmann | 2004-11-19 07:55:33 +0000 |
---|---|---|
committer | Robert Göffringmann | 2004-11-19 07:55:33 +0000 |
commit | 0bda71fa39dec43d9f9e259a57bd958622c2fc2f (patch) | |
tree | 28ae9d16766114c590dc6213e4750b567a3d6f85 /sword1 | |
parent | d173491acc2133497bc22b9728686b6b997ae505 (diff) | |
download | scummvm-rg350-0bda71fa39dec43d9f9e259a57bd958622c2fc2f.tar.gz scummvm-rg350-0bda71fa39dec43d9f9e259a57bd958622c2fc2f.tar.bz2 scummvm-rg350-0bda71fa39dec43d9f9e259a57bd958622c2fc2f.zip |
a little cleanup
svn-id: r15832
Diffstat (limited to 'sword1')
-rw-r--r-- | sword1/resman.cpp | 8 | ||||
-rw-r--r-- | sword1/resman.h | 2 | ||||
-rw-r--r-- | sword1/sword1.cpp | 11 | ||||
-rw-r--r-- | sword1/sword1.h | 2 |
4 files changed, 9 insertions, 14 deletions
diff --git a/sword1/resman.cpp b/sword1/resman.cpp index ecb53ffe0b..63cb31409c 100644 --- a/sword1/resman.cpp +++ b/sword1/resman.cpp @@ -46,8 +46,8 @@ namespace Sword1 { #define MAX_PATH_LEN 260 -ResMan::ResMan(const char *resFile, MemMan *pMemoMan) { - _memMan = pMemoMan; +ResMan::ResMan(const char *resFile) { + _memMan = new MemMan(); loadCluDescript(resFile); } @@ -71,7 +71,9 @@ ResMan::~ResMan(void) { } debug(0, "ResMan closed\n"); #endif + flush(); freeCluDescript(); + delete _memMan; } void ResMan::loadCluDescript(const char *fileName) { @@ -165,6 +167,8 @@ void ResMan::flush(void) { _memMan->setCondition(group->resHandle + resCnt, MEM_CAN_FREE); group->resHandle[resCnt].refCount = 0; } + // the memory manager cached the blocks we asked it to free, so explicitly make it free them + _memMan->flush(); } void *ResMan::fetchRes(uint32 id) { diff --git a/sword1/resman.h b/sword1/resman.h index 4f2336e70c..73ac71cdc1 100644 --- a/sword1/resman.h +++ b/sword1/resman.h @@ -50,7 +50,7 @@ struct Prj { class ResMan { public: - ResMan(const char *resFile, MemMan *pMemoMan); + ResMan(const char *resFile); ~ResMan(void); void flush(void); void resClose(uint32 id); diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp index 0b67ba75be..1e56aa0944 100644 --- a/sword1/sword1.cpp +++ b/sword1/sword1.cpp @@ -29,7 +29,6 @@ #include "common/file.h" #include "common/timer.h" -#include "sword1/memman.h" #include "sword1/resman.h" #include "sword1/objectman.h" #include "sword1/mouse.h" @@ -121,10 +120,7 @@ SwordEngine::~SwordEngine() { delete _screen; delete _mouse; delete _objectMan; - _resMan->flush(); // free all memory - _memMan->flush(); delete _resMan; - delete _memMan; } void SwordEngine::initialize(void) { @@ -140,10 +136,8 @@ void SwordEngine::initialize(void) { File::addDefaultDirectory(_gameDataPath + "video/"); _system->initSize(640, 480); - debug(5, "Starting memory manager"); - _memMan = new MemMan(); debug(5, "Starting resource manager"); - _resMan = new ResMan("swordres.rif", _memMan); + _resMan = new ResMan("swordres.rif"); debug(5, "Starting object manager"); _objectMan = new ObjectMan(_resMan); _mixer->setVolume(255); @@ -207,8 +201,7 @@ void SwordEngine::initialize(void) { } void SwordEngine::reinitialize(void) { - _resMan->flush(); // free everything that's currently alloced and opened. - _memMan->flush(); // Handle with care. + _resMan->flush(); // free everything that's currently alloced and opened. (*evil*) _logic->initialize(); // now reinitialize these objects as they (may) have locked _objectMan->initialize(); // resources which have just been wiped. diff --git a/sword1/sword1.h b/sword1/sword1.h index 330d47a38c..dea5ccb24b 100644 --- a/sword1/sword1.h +++ b/sword1/sword1.h @@ -45,7 +45,6 @@ class Sound; class Logic; class Mouse; class ResMan; -class MemMan; class ObjectMan; class Menu; class Music; @@ -89,7 +88,6 @@ private: uint16 _mouseX, _mouseY, _mouseState; uint8 _keyPressed; - MemMan *_memMan; ResMan *_resMan; ObjectMan *_objectMan; Screen *_screen; |