UI: Do not show error popup related to Stanek's Gift data when loading save files from pre-v1.1.0 (#2429)

This commit is contained in:
catloversg
2025-12-20 03:32:20 +07:00
committed by GitHub
parent b76ceb725f
commit d92b5520ec
3 changed files with 42 additions and 13 deletions
+15 -7
View File
@@ -165,12 +165,20 @@ function assertParsedSaveData(parsedSaveData: unknown): asserts parsedSaveData i
* contains only what we need.
*/
export const loadedSaveObjectMiniDump = {
/**
* If VersionSave exists, it is always a string. It has 3 formats:
* - x.y: Very early versions (0.1-0.17) used this format.
* - x.y.z: Starting from roughly 0.17, we used this format. Note that in some commits, we mistakenly used the x.y format.
* - x: Starting from v1, we used the version number instead of the version string.
*/
// VersionSave is always a string. It has 3 formats/possible values:
// - Empty string: Pre-v0.20.0.
// - '"x.y.z"': v0.20.0 to the last v0 version. Notice how I use both single quotes and double quotes. The double
// quotes are part of the string value. For example, with v0.20.0, the string value is "0.20.0" (8 chars, not 6 chars).
// - x: Starting from v1, we used the version number instead of the version string.
//
// The history of this property in the save data is complicated. In v0, we used the version string in src\Constants.ts,
// then we switched to the version number in v1. In v0, the version string has 2 formats:
// - x.y: Very early versions (v0.1 to roughly v0.17) used this format.
// - x.y.z: Starting from roughly v0.17, we used this format. Note that in some commits, we mistakenly used the x.y
// format.
//
// However, the save data only contains VersionSave starting from v0.20.0, so if we load a pre-v0.20.0 save file, this
// property will be an empty string.
VersionSave: undefined as string | undefined,
};
@@ -473,7 +481,7 @@ async function loadGame(saveData: SaveData): Promise<boolean> {
}
// "Optional 1"
loadStaneksGift(saveObj.StaneksGiftSave);
loadStaneksGift(saveObj.StaneksGiftSave, loadedSaveObjectMiniDump.VersionSave);
try {
loadStockMarket(saveObj.StockMarketSave);
} catch (e) {