From: Holger Schemel Date: Wed, 1 Mar 2023 15:55:42 +0000 (+0100) Subject: added storing if last level set was selected from "last played" menu X-Git-Tag: 4.3.5.2~20 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fb260f5e9048cac10367caaaefa6e9d635847241;p=rocksndiamonds.git added storing if last level set was selected from "last played" menu --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index a09d45d6..f9fb34ea 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2765,6 +2765,7 @@ SetupFileHash *loadSetupFileHash(char *filename) // ============================================================================ #define TOKEN_STR_LAST_LEVEL_SERIES "last_level_series" +#define TOKEN_STR_LAST_PLAYED_MENU_USED "last_played_menu_used" #define TOKEN_STR_LAST_PLAYED_LEVEL "last_played_level" #define TOKEN_STR_HANDICAP_LEVEL "handicap_level" #define TOKEN_STR_LAST_USER "last_user" @@ -5088,6 +5089,13 @@ void LoadLevelSetup_LastSeries(void) if (leveldir_current == NULL) leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); + char *last_played_menu_used = + getHashEntry(level_setup_hash, TOKEN_STR_LAST_PLAYED_MENU_USED); + + // store if last level set was selected from "last played" menu + if (strEqual(last_played_menu_used, "true")) + ForcedStoreLastPlayedLevels(leveldir_current); + for (i = 0; i < MAX_LEVELDIR_HISTORY; i++) { char token[strlen(TOKEN_STR_LAST_LEVEL_SERIES) + 10]; @@ -5150,7 +5158,14 @@ static void SaveLevelSetup_LastSeries_Ext(boolean deactivate_last_level_series) fprintf(file, "# %s\n# ", "the following level set may have caused a problem and was deactivated"); fprintf(file, "%s\n\n", getFormattedSetupEntry(TOKEN_STR_LAST_LEVEL_SERIES, - leveldir_current->identifier)); + leveldir_current->identifier)); + + // store if last level set was selected from "last played" menu + boolean last_played_menu_used = CheckLastPlayedLevels(); + char *setup_value = getSetupValue(TYPE_BOOLEAN, &last_played_menu_used); + + fprintf(file, "%s\n\n", getFormattedSetupEntry(TOKEN_STR_LAST_PLAYED_MENU_USED, + setup_value)); for (i = 0; last_level_series[i] != NULL; i++) { diff --git a/src/screens.c b/src/screens.c index d10b95d1..4d8f50e0 100644 --- a/src/screens.c +++ b/src/screens.c @@ -5118,6 +5118,9 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, { // store level set if chosen from "last played level set" menu StoreLastPlayedLevels(leveldir_current); + + // store if level set chosen from "last played level set" menu + SaveLevelSetup_LastSeries(); } else if (game_status == GAME_MODE_NAMES) {