Fix closing Load Save dialog without game selected

Pressing Load when no savegame is selected resumes game but Load Save window stays open.
1164-fix
Krzysztof Dermont 2020-07-05 21:46:45 +02:00 committed by Mateusz Przybył
parent 55c0c3221d
commit 1cffbb2bd3
3 changed files with 8 additions and 7 deletions

View File

@ -244,22 +244,24 @@ void CScreenIO::IOWriteScene()
// Reads the scene.
void CScreenIO::IOReadScene()
bool CScreenIO::IOReadScene()
{
CWindow* pw;
CList* pl;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
if ( pw == nullptr ) return false;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
if ( pl == nullptr ) return;
if ( pl == nullptr ) return false;
int sel = pl->GetSelect();
if (sel < 0 || sel >= static_cast<int>(m_saveList.size())) return;
if (sel < 0 || sel >= static_cast<int>(m_saveList.size())) return false;
m_main->GetPlayerProfile()->LoadScene(m_saveList.at(sel));
m_screenLevelList->SetSelection(m_main->GetLevelCategory(), m_main->GetLevelChap()-1, m_main->GetLevelRank()-1);
return true;
}
} // namespace Ui

View File

@ -39,7 +39,7 @@ protected:
void IOUpdateList(bool isWrite);
void IODeleteScene();
void IOWriteScene();
void IOReadScene();
bool IOReadScene();
protected:
CScreenLevelList* m_screenLevelList;

View File

@ -168,8 +168,7 @@ bool CScreenIORead::EventProcess(const Event &event)
if ( event.type == EVENT_INTERFACE_IOREAD )
{
IOReadScene();
if(m_inSimulation)
if(IOReadScene() && m_inSimulation)
{
m_main->StopSuspend();
m_main->ChangePhase(PHASE_SIMUL);