[Scummvm-git-logs] scummvm master -> 2e3564aafdde2d6ab4b3f63c6e5d55394050234e

a-yyg 76591232+a-yyg at users.noreply.github.com
Thu Jul 1 12:22:25 UTC 2021


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:
2e3564aafd SAGA2: Fix global constructor warning


Commit: 2e3564aafdde2d6ab4b3f63c6e5d55394050234e
    https://github.com/scummvm/scummvm/commit/2e3564aafdde2d6ab4b3f63c6e5d55394050234e
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-01T21:21:20+09:00

Commit Message:
SAGA2: Fix global constructor warning

Changed paths:
    engines/saga2/objects.cpp
    engines/saga2/saga2.h


diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp
index 320d0c869d..f9bdf19435 100644
--- a/engines/saga2/objects.cpp
+++ b/engines/saga2/objects.cpp
@@ -65,7 +65,6 @@ const uint32        nameListID  = MKTAG('N', 'A', 'M', 'E'),
    Locals
  * ===================================================================== */
 
-Common::Array<char *> nameList;                // handle to list of names
 uint32              nameListCount;
 
 ProtoObj            *objectProtos = nullptr;   // object prototypes
@@ -1476,7 +1475,7 @@ const char *GameObject::nameText(uint16 index) {
 	if (index >= nameListCount)
 		return "Bad Name Index";
 
-	return nameList[index];
+	return g_vm->_nameList[index];
 }
 
 #define INTANGIBLE_MASK (ProtoObj::isEnchantment|ProtoObj::isSpell|ProtoObj::isSkill)
@@ -2443,7 +2442,7 @@ void initPrototypes(void) {
 
 		char *name = new char[s.size() + 1];
 		Common::strlcpy(name, s.c_str(), s.size() + 1);
-		nameList.push_back(name);
+		g_vm->_nameList.push_back(name);
 	}
 	nameListCount = count;
 
@@ -2628,10 +2627,10 @@ void initPrototypes(void) {
 
 void cleanupPrototypes(void) {
 	for (uint i = 0; i < nameListCount; ++i) {
-		if (nameList[i])
-			delete[] nameList[i];
+		if (g_vm->_nameList[i])
+			delete[] g_vm->_nameList[i];
 
-		nameList.clear();
+		g_vm->_nameList.clear();
 	}
 
 	if (actorProtos != nullptr) {
diff --git a/engines/saga2/saga2.h b/engines/saga2/saga2.h
index 14c04454aa..d50ddd09f0 100644
--- a/engines/saga2/saga2.h
+++ b/engines/saga2/saga2.h
@@ -97,6 +97,7 @@ public:
 
 	WeaponStuff _weaponRack[kMaxWeapons];
 	weaponID _loadedWeapons;
+	Common::Array<char *> _nameList;
 	Common::List<TimerList *> _timerLists;
 	Common::List<Timer *> _timers;
 	Common::List<ActorAppearance *> _appearanceLRU;




More information about the Scummvm-git-logs mailing list