[Scummvm-cvs-logs] scummvm master -> a1ab4cb062d5b94c2b0c590816b68770d8989248

Strangerke Strangerke at scummvm.org
Sun Feb 9 11:23:54 CET 2014


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:
a1ab4cb062 CGE: Reduce the scope of some variables


Commit: a1ab4cb062d5b94c2b0c590816b68770d8989248
    https://github.com/scummvm/scummvm/commit/a1ab4cb062d5b94c2b0c590816b68770d8989248
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-09T02:22:21-08:00

Commit Message:
CGE: Reduce the scope of some variables

Changed paths:
    engines/cge/cge_main.cpp
    engines/cge/detection.cpp
    engines/cge/vga13h.cpp



diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 602b36d..b401533 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -125,9 +125,8 @@ char *CGEEngine::mergeExt(char *buf, const char *name, const char *ext) {
 }
 
 int CGEEngine::takeEnum(const char **tab, const char *text) {
-	const char **e;
 	if (text) {
-		for (e = tab; *e; e++) {
+		for (const char **e = tab; *e; e++) {
 			if (scumm_stricmp(text, *e) == 0) {
 				return e - tab;
 			}
@@ -1029,7 +1028,6 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i
 	bool east = false;
 	bool port = false;
 	bool tran = false;
-	int i, lcnt = 0;
 
 	char tmpStr[kLineMax + 1];
 	Common::String line;
@@ -1041,6 +1039,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i
 			error("Bad SPR [%s]", tmpStr);
 
 		uint16 len;
+		int i, lcnt = 0;
 		for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) {
 			len = line.size();
 			lcnt++;
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index c377970..0c7c2e2 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -208,10 +208,9 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const {
 	sort(filenames.begin(), filenames.end());   // Sort (hopefully ensuring we are sorted numerically..)
 
 	SaveStateList saveList;
-	int slotNum = 0;
 	for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
 		// Obtain the last 3 digits of the filename, since they correspond to the save slot
-		slotNum = atoi(filename->c_str() + filename->size() - 3);
+		int slotNum = atoi(filename->c_str() + filename->size() - 3);
 
 		if (slotNum >= 0 && slotNum <= 99) {
 
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 4954e63..2022b80 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -210,10 +210,10 @@ Sprite *Sprite::expand() {
 			error("Bad SPR [%s]", fname);
 		Common::String line;
 		char tmpStr[kLineMax + 1];
-		int len = 0, lcnt = 0;
+		int lcnt = 0;
 
 		for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) {
-			len = line.size();
+			int len = line.size();
 			Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
 			lcnt++;
 			if (len == 0 || *tmpStr == '.')






More information about the Scummvm-git-logs mailing list