diff options
author | Paul Gilbert | 2016-11-07 07:36:52 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-11-07 07:36:52 -0500 |
commit | f6593ce9c0db62d16af051f7ad98128cfe41bd2c (patch) | |
tree | 1c327839b58f17a8efedcacd65b60376467f149d /engines/titanic/core | |
parent | 57cd02b04877d6a6dd78743b4baa5d2b28dcc69a (diff) | |
download | scummvm-rg350-f6593ce9c0db62d16af051f7ad98128cfe41bd2c.tar.gz scummvm-rg350-f6593ce9c0db62d16af051f7ad98128cfe41bd2c.tar.bz2 scummvm-rg350-f6593ce9c0db62d16af051f7ad98128cfe41bd2c.zip |
TITANIC: Simplify freeing class list on exit
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/saveable_object.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/core/saveable_object.h | 2 |
2 files changed, 2 insertions, 10 deletions
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index b0009c3bc1..73b4bf861f 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -421,15 +421,14 @@ CSaveableObject *ClassDef::create() { /*------------------------------------------------------------------------*/ -CSaveableObject::ClassListMap *CSaveableObject::_classList = nullptr; +CSaveableObject::ClassListMap *CSaveableObject::_classList; CSaveableObject::ClassDefList *CSaveableObject::_classDefs; -CSaveableObject::VoidArray *CSaveableObject::_typesToFree; #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } \ ClassDef *T::_type #define ADDFN(CHILD, PARENT) \ CHILD::_type = new TypeTemplate<CHILD>(#CHILD, PARENT::_type); \ - _typesToFree->push_back(CHILD::_type); \ + _classDefs->push_back(CHILD::_type); \ (*_classList)[#CHILD] = Function##CHILD DEFFN(CArm); @@ -1023,7 +1022,6 @@ DEFFN(CTimeEventInfo); void CSaveableObject::initClassList() { _classDefs = new ClassDefList(); _classList = new ClassListMap(); - _typesToFree = new VoidArray(); ADDFN(CArm, CCarry); ADDFN(CAuditoryCentre, CBrain); ADDFN(CBowlEar, CEar); @@ -1623,12 +1621,8 @@ void CSaveableObject::freeClassList() { for (i = _classDefs->begin(); i != _classDefs->end(); ++i) delete *i; - for (uint idx = 0; idx < _typesToFree->size(); ++idx) - delete (*_typesToFree)[idx]; - delete _classDefs; delete _classList; - delete _typesToFree; } CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index 0591f0930c..80525f1156 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -61,10 +61,8 @@ class CSaveableObject { private: typedef Common::List<ClassDef *> ClassDefList; typedef Common::HashMap<Common::String, CreateFunction> ClassListMap; - typedef Common::Array<void *> VoidArray; static ClassDefList *_classDefs; static ClassListMap *_classList; - static VoidArray *_typesToFree; public: /** * Sets up the list of saveable object classes |