File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -2153,6 +2153,15 @@ int32_t saves_current_selection()
21532153 return currgame;
21542154}
21552155
2156+ bool saves_is_slot_loaded (int32_t index, bool full_data)
2157+ {
2158+ if (saves.size () <= index)
2159+ return false ;
2160+ if (full_data && saves[index].game == nullptr )
2161+ return false ;
2162+ return saves[index].header != nullptr ;
2163+ }
2164+
21562165const save_t * saves_get_slot (int32_t index, bool full_data)
21572166{
21582167 save_t * save;
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ int32_t saves_count();
4545int32_t saves_current_selection ();
4646bool saves_create_slot (gamedata* game, bool save_to_disk = true );
4747bool saves_create_slot (fs::path path);
48+ bool saves_is_slot_loaded (int32_t index, bool full_data = false );
4849const save_t * saves_get_slot (int32_t index, bool full_data = false );
4950const save_t * saves_get_current_slot ();
5051void saves_delete (int32_t index);
Original file line number Diff line number Diff line change @@ -283,11 +283,25 @@ static void list_saves()
283283{
284284 // Fourth Quest turns the menu red.
285285 bool red = false ;
286-
286+
287+ // First, make sure the presently listed quests are loaded.
287288 int savecnt = saves_count ();
289+ for (int32_t i=0 ; i<3 ; i++)
290+ {
291+ int j = listpos+i;
292+ if (j < savecnt)
293+ saves_get_slot (j);
294+ }
295+
296+ // Check if any loaded quests is the 4th quest.
288297 for (int32_t i=0 ; i<savecnt; i++)
289- if (saves_get_slot (i)->header && saves_get_slot (i)->header ->quest == 4 )
298+ {
299+ if (saves_is_slot_loaded (i) && saves_get_slot (i)->header ->quest == 4 )
300+ {
290301 red = true ;
302+ break ;
303+ }
304+ }
291305
292306 loadpalset (0 ,red ? pSprite (spPILE) : 0 );
293307
You can’t perform that action at this time.
0 commit comments