[Scummvm-git-logs] scummvm master -> 5915558a1eef707d1103aabaabbbe14024d5c328

sev- noreply at scummvm.org
Sun Dec 29 12:48:50 UTC 2024


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:
5915558a1e GROOVIE: Avoid adding '\0' to strings


Commit: 5915558a1eef707d1103aabaabbbe14024d5c328
    https://github.com/scummvm/scummvm/commit/5915558a1eef707d1103aabaabbbe14024d5c328
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-12-29T13:48:20+01:00

Commit Message:
GROOVIE: Avoid adding '\0' to strings

Changed paths:
    engines/groovie/script.cpp


diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 46c3ceccc1d..5ce1170e139 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -690,7 +690,6 @@ void Script::savegame(uint slot, const Common::String &name) {
 	for (uint i = 0; i < name_len; i++) {
 		newchar = name.size() > i ? name[i] + 0x30 : ' ';
 		if ((newchar < 0x30 || newchar > 0x39) && (newchar < 0x41 || newchar > 0x7A) && newchar != 0x2E) {
-			cacheName += '\0';
 			break;
 		} else if (newchar == 0x2E) { // '.', generated when space is pressed
 			cacheName += ' ';
@@ -1626,10 +1625,14 @@ void Script::o_savegame() {
 
 	Common::String name;
 	for (int i = 0; i < 27; i++) {
-		if (i < 19)
+		if (i < 19) {
+			if (_variables[i] == 0)
+				break;
+
 			name += _variables[i];
-		else
+		} else {
 			name += '\0' - 0x30;
+		}
 	}
 	savegame(slot, name);
 }




More information about the Scummvm-git-logs mailing list