[Scummvm-git-logs] scummvm master -> f6593ce9c0db62d16af051f7ad98128cfe41bd2c

dreammaster dreammaster at scummvm.org
Mon Nov 7 13:37:07 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f6593ce9c0 TITANIC: Simplify freeing class list on exit


Commit: f6593ce9c0db62d16af051f7ad98128cfe41bd2c
    https://github.com/scummvm/scummvm/commit/f6593ce9c0db62d16af051f7ad98128cfe41bd2c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-07T07:36:52-05:00

Commit Message:
TITANIC: Simplify freeing class list on exit

Changed paths:
    engines/titanic/core/saveable_object.cpp
    engines/titanic/core/saveable_object.h
    engines/titanic/true_talk/tt_npc_script.cpp



diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index b0009c3..73b4bf8 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 0591f09..80525f1 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
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp
index bfb97c8..ffa9d7f 100644
--- a/engines/titanic/true_talk/tt_npc_script.cpp
+++ b/engines/titanic/true_talk/tt_npc_script.cpp
@@ -340,7 +340,7 @@ uint TTnpcScript::getRangeValue(uint id) {
 
 		int index = (int)getRandomNumber(count) - 1;
 		if (count > 1 && range->_values[index] == range->_priorIndex) {
-			for (int retry = 0; retry < 8 && index != range->_priorIndex; ++retry)
+			for (int retry = 0; retry < 8 && index != (int)range->_priorIndex; ++retry)
 				index = (int)getRandomNumber(count) - 1;
 		}
 





More information about the Scummvm-git-logs mailing list