Skip to content

Commit

Permalink
Improve backup restore orders of game screen
Browse files Browse the repository at this point in the history
  • Loading branch information
fgl27 committed Oct 25, 2024
1 parent 1016c54 commit 47ba788
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 0 additions & 4 deletions app/specific/Screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,6 @@ function Screens_loadDataRequestStart(key) {
) {
ScreenObj[key].restoreBackup();
} else {
if (ScreenObj[key].hasBackupData) {
ScreenObj[key].eraseBackupData(Main_values.Main_gameSelected_id);
}

Screens_loadDataRequest(key);
}
}
Expand Down
15 changes: 9 additions & 6 deletions app/specific/ScreensObj.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ function ScreensObj_StartAllVars() {
this.BackupData.Lang[game] = null;
this.BackupData.lastScreenRefresh[game] = 0;
}

if (this.ScreenBackup) {
this.ScreenBackup[game] = null;
}
},
CheckBackupData: function (game) {
return (
Expand All @@ -297,7 +301,7 @@ function ScreensObj_StartAllVars() {
);
},
restoreBackup: function () {
var game = Main_values.Main_gameSelected_id;
var game = this.gameSelected_Id;

this.data = JSON.parse(JSON.stringify(this.BackupData.data[game]));
this.offset = this.data.length;
Expand Down Expand Up @@ -325,7 +329,7 @@ function ScreensObj_StartAllVars() {
}

if (!this.data || !this.data.length) {
this.ScreenBackup[game].style = null;
this.ScreenBackup[game] = null;
return;
}

Expand Down Expand Up @@ -2898,10 +2902,6 @@ function ScreensObj_TopLableAgameInit(key) {
!Main_A_equals_B_No_Case(ScreenObj[key].gameSelected_Id, Main_values.Main_gameSelected_id)
) {
ScreenObj[key].status = false;

if (ScreenObj[key].Cells && ScreenObj[key].Cells.length && ScreenObj[key].gameSelected_Id) {
ScreenObj[key].BackupScreen(ScreenObj[key].gameSelected_Id);
}
}

ScreenObj[key].gameSelected_Id = Main_values.Main_gameSelected_id;
Expand All @@ -2926,6 +2926,9 @@ function ScreensObj_TopLableAgameInit(key) {

function ScreensObj_TopLableAgameExit(key) {
ScreenObj[key].gameSelected_Id = Main_values.Main_gameSelected_id;
if (ScreenObj[key].Cells && ScreenObj[key].Cells.length && ScreenObj[key].gameSelected_Id) {
ScreenObj[key].BackupScreen(ScreenObj[key].gameSelected_Id);
}
Main_IconLoad('label_thumb', 'icon-options', STR_THUMB_OPTIONS_TOP);
}

Expand Down

0 comments on commit 47ba788

Please sign in to comment.