1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

API for custom events no longer requires SDL access

This commit is contained in:
Ivan Savenko
2023-02-02 18:15:05 +02:00
parent d4fba3787c
commit e1bd0d2a04
10 changed files with 26 additions and 30 deletions

View File

@@ -2139,12 +2139,7 @@ void CPlayerInterface::requestReturningToMainMenu(bool won)
if(won && cb->getStartInfo()->campState)
CSH->startCampaignScenario(cb->getStartInfo()->campState);
else
sendCustomEvent(EUserEvent::RETURN_TO_MAIN_MENU);
}
void CPlayerInterface::sendCustomEvent( int code )
{
CGuiHandler::pushSDLEvent(SDL_USEREVENT, code);
GH.pushUserEvent(EUserEvent::RETURN_TO_MAIN_MENU);
}
void CPlayerInterface::askToAssembleArtifact(const ArtifactLocation &al)
@@ -2268,7 +2263,7 @@ void CPlayerInterface::waitForAllDialogs(bool unlockPim)
void CPlayerInterface::proposeLoadingGame()
{
showYesNoDialog(CGI->generaltexth->allTexts[68], [this](){ sendCustomEvent(EUserEvent::RETURN_TO_MENU_LOAD); }, nullptr);
showYesNoDialog(CGI->generaltexth->allTexts[68], [this](){ GH.pushUserEvent(EUserEvent::RETURN_TO_MENU_LOAD); }, nullptr);
}
CPlayerInterface::SpellbookLastSetting::SpellbookLastSetting()