summaryrefslogtreecommitdiffstats
path: root/src/save/GenericGameStorage.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-11-13 11:19:54 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-11-13 11:19:54 +0100
commit2e915780aa7be1570e2ee018daae8c97cbc3290e (patch)
tree4b9f431d0f9bdff09abed3cb87390ed88f8511c4 /src/save/GenericGameStorage.cpp
parentMerge branch 'miami' of https://github.com/GTAmodding/re3 into miami (diff)
downloadre3-2e915780aa7be1570e2ee018daae8c97cbc3290e.tar
re3-2e915780aa7be1570e2ee018daae8c97cbc3290e.tar.gz
re3-2e915780aa7be1570e2ee018daae8c97cbc3290e.tar.bz2
re3-2e915780aa7be1570e2ee018daae8c97cbc3290e.tar.lz
re3-2e915780aa7be1570e2ee018daae8c97cbc3290e.tar.xz
re3-2e915780aa7be1570e2ee018daae8c97cbc3290e.tar.zst
re3-2e915780aa7be1570e2ee018daae8c97cbc3290e.zip
Diffstat (limited to '')
-rw-r--r--src/save/GenericGameStorage.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 966f353a..82f66308 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -148,24 +148,22 @@ GenericSave(int file)
// Save simple vars
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName[0] ? CStats::LastMissionPassedName : "ITBEG");
- if (lastMissionPassed[0] != '\0') {
- AsciiToUnicode("...'", suffix);
- suffix[3] = L'\0';
+ AsciiToUnicode("...'", suffix);
+ suffix[3] = L'\0';
#ifdef FIX_BUGS
- // fix buffer overflow
- int len = UnicodeStrlen(lastMissionPassed);
- if (len > ARRAY_SIZE(saveName)-1)
- len = ARRAY_SIZE(saveName)-1;
- memcpy(saveName, lastMissionPassed, sizeof(wchar) * len);
+ // fix buffer overflow
+ int len = UnicodeStrlen(lastMissionPassed);
+ if (len > ARRAY_SIZE(saveName)-1)
+ len = ARRAY_SIZE(saveName)-1;
+ memcpy(saveName, lastMissionPassed, sizeof(wchar) * len);
#else
- TextCopy(saveName, lastMissionPassed);
- int len = UnicodeStrlen(saveName);
+ TextCopy(saveName, lastMissionPassed);
+ int len = UnicodeStrlen(saveName);
#endif
- saveName[len] = '\0';
- if (len > ARRAY_SIZE(saveName)-2)
- TextCopy(&saveName[ARRAY_SIZE(saveName)-ARRAY_SIZE(suffix)], suffix);
- saveName[ARRAY_SIZE(saveName)-1] = '\0';
- }
+ saveName[len] = '\0';
+ if (len > ARRAY_SIZE(saveName)-2)
+ TextCopy(&saveName[ARRAY_SIZE(saveName)-ARRAY_SIZE(suffix)], suffix);
+ saveName[ARRAY_SIZE(saveName)-1] = '\0';
WriteDataToBufferPointer(buf, saveName);
GetLocalTime(&saveTime);
WriteDataToBufferPointer(buf, saveTime);