[Scummvm-cvs-logs] CVS: scummvm saveload.cpp,1.50,1.51

Max Horn fingolfin at users.sourceforge.net
Thu May 16 03:44:03 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv5831

Modified Files:
	saveload.cpp 
Log Message:
added 'savepath' option to config file (can be specified globally or for each game differently). A command line switch should eventually be added, too

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- saveload.cpp	14 May 2002 23:32:34 -0000	1.50
+++ saveload.cpp	16 May 2002 10:43:17 -0000	1.51
@@ -25,6 +25,7 @@
 #include "sound/mididrv.h"
 #include "sound/imuse.h"
 #include "actor.h"
+#include "config-file.h"
 
 struct SaveGameHeader {
 	uint32 type;
@@ -161,25 +162,31 @@
 void Scumm::makeSavegameName(char *out, int slot, bool compatible)
 {
 
-#ifndef _WIN32_WCE
+	const char *dir = NULL;
 
-#if !defined(MACOS_CARBON)
-	const char *dir = getenv("SCUMMVM_SAVEPATH");
-	if (dir == NULL)
-		dir = "";
+#ifdef _WIN32_WCE
+	dir = _gameDataPath;
 #else
-	const char *dir = "";
-#endif
 
-	/* snprintf should be used here, but it's not portable enough */
-	sprintf(out, "%s%s.%c%.2d", dir, _exe_name, compatible ? 'c' : 's', slot);
+  #if !defined(MACOS_CARBON)
+	dir = getenv("SCUMMVM_SAVEPATH");
+  #endif
 
-#else
+	// If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config
+	if (!dir || dir[0] == 0)
+		dir = scummcfg->get("savepath");
 
-	sprintf(out, "%s%s.%c%.2d", _gameDataPath, _exe_name,
-					compatible ? 'c' : 's', slot);
+	// If SCUMMVM_SAVEPATH was not specified, try to use general path from config
+	if (!dir || dir[0] == 0)
+		dir = scummcfg->get("savepath", "scummvm");
 
+	// If no save path was specified, use no directory prefix
+	if (dir == NULL)
+		dir = "";
 #endif
+
+	// snprintf should be used here, but it's not portable enough
+	sprintf(out, "%s%s.%c%.2d", dir, _exe_name, compatible ? 'c' : 's', slot);
 }
 
 bool Scumm::getSavegameName(int slot, char *desc)





More information about the Scummvm-git-logs mailing list