[Scummvm-git-logs] scummvm master -> 09f67c83ceeb34e4560a758e207e053aef0b7f35

dreammaster dreammaster at scummvm.org
Fri Mar 30 02:32:04 CEST 2018


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:
09f67c83ce XEEN: Fix LLoyd's Beacon spell in Clouds of Xeen


Commit: 09f67c83ceeb34e4560a758e207e053aef0b7f35
    https://github.com/scummvm/scummvm/commit/09f67c83ceeb34e4560a758e207e053aef0b7f35
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-29T20:30:00-04:00

Commit Message:
XEEN: Fix LLoyd's Beacon spell in Clouds of Xeen

Changed paths:
    engines/xeen/dialogs/dialogs_spells.cpp
    engines/xeen/map.cpp
    engines/xeen/map.h


diff --git a/engines/xeen/dialogs/dialogs_spells.cpp b/engines/xeen/dialogs/dialogs_spells.cpp
index a14d4ba..21bd7e2 100644
--- a/engines/xeen/dialogs/dialogs_spells.cpp
+++ b/engines/xeen/dialogs/dialogs_spells.cpp
@@ -742,12 +742,8 @@ bool LloydsBeacon::execute() {
 		}
 	}
 
-	// Open up the text file for the destination map and read in it's name
-	Common::String txtName = Common::String::format("%s%c%03d.txt",
-		c._lloydSide ? "dark" : "xeen", c._lloydMap >= 100 ? 'x' : '0', c._lloydMap);
-	File textFile(txtName, 1);
-	Common::String mapName = textFile.readString();
-	textFile.close();
+	// Get the destination map name
+	Common::String mapName = Map::getMazeName(c._lloydMap, c._lloydSide);
 
 	// Display the dialog
 	w.open();
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index 06c1592..ce14553 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -747,20 +747,7 @@ void Map::load(int mapId) {
 			// Handle loading text data
 			if (!textLoaded) {
 				textLoaded = true;
-
-				if (g_vm->getGameID() == GType_Clouds) {
-					_mazeName = Res._cloudsMapNames[mapId];
-				} else {
-					Common::String txtName = Common::String::format("%s%c%03d.txt",
-						ccNum ? "dark" : "xeen", mapId >= 100 ? 'x' : '0', mapId);
-					File fText(txtName, 1);
-					char mazeName[33];
-					fText.read(mazeName, 33);
-					mazeName[32] = '\0';
-
-					_mazeName = Common::String(mazeName);
-					fText.close();
-				}
+				_mazeName = getMazeName(mapId, ccNum);
 
 				// Load the monster/object data
 				Common::String mobName = Common::String::format("maze%c%03d.mob",
@@ -1404,4 +1391,24 @@ void Map::getNewMaze() {
 		load(mapId);
 }
 
+Common::String Map::getMazeName(int mapId, int ccNum) {
+	if (ccNum == -1)
+		ccNum = g_vm->_files->_ccNum;
+
+	if (g_vm->getGameID() == GType_Clouds) {
+		return Res._cloudsMapNames[mapId];
+	} else {
+		Common::String txtName = Common::String::format("%s%c%03d.txt",
+			ccNum ? "dark" : "xeen", mapId >= 100 ? 'x' : '0', mapId);
+		File fText(txtName, 1);
+		char mazeName[33];
+		fText.read(mazeName, 33);
+		mazeName[32] = '\0';
+
+		Common::String name = Common::String(mazeName);
+		fText.close();
+		return name;
+	}
+}
+
 } // End of namespace Xeen
diff --git a/engines/xeen/map.h b/engines/xeen/map.h
index fc591fc..c34ef9e 100644
--- a/engines/xeen/map.h
+++ b/engines/xeen/map.h
@@ -516,6 +516,13 @@ public:
 	 * position to the relative position on the new map
 	 */
 	void getNewMaze();
+
+	/**
+	 * Return the name of a specified maze
+	 * @param mapId		Map Id
+	 * @param ccNum		Cc file number. If -1, uses the current C
+	 */
+	static Common::String getMazeName(int mapId, int ccNum = -1);
 };
 
 } // End of namespace Xeen





More information about the Scummvm-git-logs mailing list