[Scummvm-git-logs] scummvm master -> 90ce265ab89bf6f0898813c578e0ec5abce37512

sev- sev at scummvm.org
Wed Jan 31 19:23:59 CET 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:
90ce265ab8 TUCKER: Print infobar string if no savegame exists


Commit: 90ce265ab89bf6f0898813c578e0ec5abce37512
    https://github.com/scummvm/scummvm/commit/90ce265ab89bf6f0898813c578e0ec5abce37512
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-01-31T19:23:56+01:00

Commit Message:
TUCKER: Print infobar string if no savegame exists

Before, the ingame load dialog pretended to allow loading savegames from
all possible slots even if no savegames existed.
This introduces the original interpreter's behavior which instead loads
a resource string from infobar.txt informing the user that no savegames
are available.

Changed paths:
    engines/tucker/saveload.cpp
    engines/tucker/tucker.cpp
    engines/tucker/tucker.h


diff --git a/engines/tucker/saveload.cpp b/engines/tucker/saveload.cpp
index 92da2d4..8ed969c 100644
--- a/engines/tucker/saveload.cpp
+++ b/engines/tucker/saveload.cpp
@@ -126,4 +126,9 @@ bool TuckerEngine::canSaveGameStateCurrently() {
 	return !_player && _cursorType < 2;
 }
 
+bool TuckerEngine::existsSavegame() {
+	Common::String pattern = generateGameStateFileName(_targetName.c_str(), 0, true);
+	return !_saveFileMan->listSavefiles(pattern).empty();
+}
+
 } // namespace Tucker
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index cf28b1b..d9e14b3 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -27,6 +27,7 @@
 #include "common/debug.h"
 #include "common/error.h"
 #include "common/keyboard.h"
+#include "common/savefile.h"
 #include "common/textconsole.h"
 
 #include "engines/util.h"
@@ -1314,13 +1315,19 @@ void TuckerEngine::updateSfxData3_2() {
 }
 
 void TuckerEngine::saveOrLoad() {
+	bool hasSavegame = existsSavegame();
+
 	if (!_leftMouseButtonPressed) {
 		_mouseClick = 0;
 	}
 	if (_currentSaveLoadGameState > 0) {
-		drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, _saveOrLoadGamePanel + 19, 102);
-		int len = getStringWidth(_saveOrLoadGamePanel + 19, _infoBarBuf);
-		drawStringInteger(_currentSaveLoadGameState, len / 2 + 128, 160, 2);
+		if (_saveOrLoadGamePanel == 0 && !hasSavegame) {
+			drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, _saveOrLoadGamePanel + 21, 102);
+		} else {
+			drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, _saveOrLoadGamePanel + 19, 102);
+			int len = getStringWidth(_saveOrLoadGamePanel + 19, _infoBarBuf);
+			drawStringInteger(_currentSaveLoadGameState, len / 2 + 128, 160, 2);
+		}
 	} else {
 		drawSpeechText(_scrollOffset + 120, 170, _infoBarBuf, 21, 102);
 	}
@@ -1348,7 +1355,7 @@ void TuckerEngine::saveOrLoad() {
 		if (_mousePosX > 260 && _mousePosX < 290 && _mousePosY > 152 && _mousePosY < 168) {
 			if (_saveOrLoadGamePanel == 1) {
 				saveGameState(_currentSaveLoadGameState, "");
-			} else if (_currentSaveLoadGameState > 0) {
+			} else if (hasSavegame && _currentSaveLoadGameState > 0) {
 				loadGameState(_currentSaveLoadGameState);
 			}
 			_forceRedrawPanelItems = true;
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index 6046804..58ffa24 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -579,6 +579,7 @@ protected:
 	virtual Common::Error saveGameState(int num, const Common::String &description);
 	virtual bool canLoadGameStateCurrently();
 	virtual bool canSaveGameStateCurrently();
+	virtual bool existsSavegame();
 
 	TuckerConsole *_console;
 





More information about the Scummvm-git-logs mailing list