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

clone2727 clone2727 at gmail.com
Mon Feb 4 20:46:30 CET 2013


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

Summary:
49ebbfd9dc PEGASUS: Sort save file names alphabetically
89d574e6d0 PEGASUS: Limit the accepted characters in save file names
c991d3990e TRANSLATION: Mark pegasus.cpp as translatable
b61ac55036 PEGASUS: Fix minor energy bar glitch while calibrating


Commit: 49ebbfd9dca6630ad38629bbb3a736d18d63a471
    https://github.com/scummvm/scummvm/commit/49ebbfd9dca6630ad38629bbb3a736d18d63a471
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-02-04T09:34:06-08:00

Commit Message:
PEGASUS: Sort save file names alphabetically

Changed paths:
    engines/pegasus/detection.cpp
    engines/pegasus/pegasus.cpp
    engines/pegasus/pegasus.h



diff --git a/engines/pegasus/detection.cpp b/engines/pegasus/detection.cpp
index 908005b..ba63114 100644
--- a/engines/pegasus/detection.cpp
+++ b/engines/pegasus/detection.cpp
@@ -119,12 +119,12 @@ SaveStateList PegasusMetaEngine::listSaves(const char *target) const {
 	// The original had no pattern, so the user must rename theirs
 	// Note that we ignore the target because saves are compatible between
 	// all versions
-	Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("pegasus-*.sav");
+	Common::StringArray fileNames = Pegasus::PegasusEngine::listSaveFiles();
 
 	SaveStateList saveList;
-	for (uint32 i = 0; i < filenames.size(); i++) {
+	for (uint32 i = 0; i < fileNames.size(); i++) {
 		// Isolate the description from the file name
-		Common::String desc = filenames[i].c_str() + 8;
+		Common::String desc = fileNames[i].c_str() + 8;
 		for (int j = 0; j < 4; j++)
 			desc.deleteLastChar();
 
@@ -136,8 +136,8 @@ SaveStateList PegasusMetaEngine::listSaves(const char *target) const {
 
 void PegasusMetaEngine::removeSaveState(const char *target, int slot) const {
 	// See listSaves() for info on the pattern
-	Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("pegasus-*.sav");
-	g_system->getSavefileManager()->removeSavefile(filenames[slot].c_str());
+	Common::StringArray fileNames = Pegasus::PegasusEngine::listSaveFiles();
+	g_system->getSavefileManager()->removeSavefile(fileNames[slot].c_str());
 }
 
 bool PegasusMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 98f0553..89acac1 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -639,9 +639,15 @@ void PegasusEngine::writeContinueStream(Common::WriteStream *stream) {
 	delete[] data;
 }
 
+Common::StringArray PegasusEngine::listSaveFiles() {
+	Common::StringArray fileNames = g_system->getSavefileManager()->listSavefiles("pegasus-*.sav");
+	Common::sort(fileNames.begin(), fileNames.end());
+	return fileNames;
+}
+
 Common::Error PegasusEngine::loadGameState(int slot) {
-	Common::StringArray filenames = _saveFileMan->listSavefiles("pegasus-*.sav");
-	Common::InSaveFile *loadFile = _saveFileMan->openForLoading(filenames[slot]);
+	Common::StringArray fileNames = listSaveFiles();
+	Common::InSaveFile *loadFile = _saveFileMan->openForLoading(fileNames[slot]);
 	if (!loadFile)
 		return Common::kUnknownError;
 
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index a8f2e1f..246414a 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -30,6 +30,7 @@
 #include "common/macresman.h"
 #include "common/rect.h"
 #include "common/scummsys.h"
+#include "common/str-array.h"
 #include "common/system.h"
 #include "common/util.h"
 
@@ -195,6 +196,7 @@ public:
 	bool saveRequested() const { return _saveRequested; }
 	void requestLoad() { _loadRequested = true; }
 	bool loadRequested() const { return _loadRequested; }
+	static Common::StringArray listSaveFiles();
 
 protected:
 	Common::Error run();


Commit: 89d574e6d09e6ff4d4d3a0717f0e19c6b17bb960
    https://github.com/scummvm/scummvm/commit/89d574e6d09e6ff4d4d3a0717f0e19c6b17bb960
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-02-04T11:06:29-08:00

Commit Message:
PEGASUS: Limit the accepted characters in save file names

Changed paths:
    engines/pegasus/pegasus.cpp



diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 89acac1..be3fcd5 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -657,7 +657,23 @@ Common::Error PegasusEngine::loadGameState(int slot) {
 	return valid ? Common::kNoError : Common::kUnknownError;
 }
 
+static bool isValidSaveFileChar(char c) {
+	// Limit it to letters, digits, and a few other characters that should be safe
+	return Common::isAlnum(c) || c == ' ' || c == '_' || c == '+' || c == '-' || c == '.';
+}
+
+static bool isValidSaveFileName(const Common::String &desc) {
+	for (uint32 i = 0; i < desc.size(); i++)
+		if (!isValidSaveFileChar(desc[i]))
+			return false;
+
+	return true;
+}
+
 Common::Error PegasusEngine::saveGameState(int slot, const Common::String &desc) {
+	if (!isValidSaveFileName(desc))
+		return Common::Error(Common::kCreatingFileFailed, _("Invalid save file name"));
+
 	Common::String output = Common::String::format("pegasus-%s.sav", desc.c_str());
 	Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(output, false);
 	if (!saveFile)


Commit: c991d3990e81e76dfc581e9fa1c1e57fa8073d04
    https://github.com/scummvm/scummvm/commit/c991d3990e81e76dfc581e9fa1c1e57fa8073d04
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-02-04T11:16:26-08:00

Commit Message:
TRANSLATION: Mark pegasus.cpp as translatable

Changed paths:
    po/POTFILES



diff --git a/po/POTFILES b/po/POTFILES
index 3d9b993..4389904 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -61,6 +61,7 @@ engines/tinsel/saveload.cpp
 engines/toltecs/detection.cpp
 engines/toltecs/menu.cpp
 engines/parallaction/saveload.cpp
+engines/pegasus/pegasus.cpp
 
 audio/fmopl.cpp
 audio/mididrv.cpp


Commit: b61ac55036ebe9a6441b6480769a22d90188da12
    https://github.com/scummvm/scummvm/commit/b61ac55036ebe9a6441b6480769a22d90188da12
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2013-02-04T11:41:18-08:00

Commit Message:
PEGASUS: Fix minor energy bar glitch while calibrating

Need to set the energy level before showing it

Changed paths:
    engines/pegasus/energymonitor.cpp



diff --git a/engines/pegasus/energymonitor.cpp b/engines/pegasus/energymonitor.cpp
index 8aa77eb..be9d205 100644
--- a/engines/pegasus/energymonitor.cpp
+++ b/engines/pegasus/energymonitor.cpp
@@ -262,9 +262,9 @@ void EnergyMonitor::calibrateEnergyBar() {
 	_energyLight.setCurrentFrameIndex(0);
 	_energyLight.hide();
 
-	show();
 	setEnergyValue(0);
 	setEnergyDrainRate(-(int32)kMaxJMPEnergy / 2);
+	show();
 
 	// Make sure warning light is hidden...
 	_energyLight.hide();






More information about the Scummvm-git-logs mailing list