1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Fix app not starting when the savegames were corrupted - there is now a better error message

This commit is contained in:
tobspr
2020-06-13 10:11:18 +02:00
parent 0521252675
commit ecbcd02abc
4 changed files with 18 additions and 18 deletions

View File

@@ -366,11 +366,19 @@ export class MainMenuState extends GameState {
this.app.adProvider.showVideoAd().then(() => {
this.app.analytics.trackUiClick("resume_game_adcomplete");
const savegame = this.app.savegameMgr.getSavegameById(game.internalId);
savegame.readAsync().then(() => {
this.moveToState("InGameState", {
savegame,
savegame
.readAsync()
.then(() => {
this.moveToState("InGameState", {
savegame,
});
})
.catch(err => {
this.dialogs.showWarning(
T.dialogs.gameLoadFailure.title,
T.dialogs.gameLoadFailure.text + "<br><br>" + err
);
});
});
});
}

View File

@@ -138,15 +138,10 @@ export class PreloadState extends GameState {
.then(() => {
return this.app.savegameMgr.initialize().catch(err => {
logger.error("Failed to initialize savegames:", err);
return new Promise(resolve => {
// const { ok } = this.dialogs.showWarning(
// T.preload.savegame_corrupt_dialog.title,
// T.preload.savegame_corrupt_dialog.content,
// ["ok:good"]
// );
// ok.add(resolve);
alert("Your savegames failed to load. They might not show up. Sorry!");
});
alert(
"Your savegames failed to load, it seems your data files got corrupted. I'm so sorry!\n\n(This can happen if your pc crashed while a game was saved).\n\nYou can try re-importing your savegames."
);
return this.app.savegameMgr.writeAsync();
});
})