Emscripten powershell build script updated to properly terminate on errors. Add in proper throws when an invalid response is given from the server. Add in function response callbacks to all server request functions.

This commit is contained in:
2024-01-02 20:58:04 -06:00
parent 497db80b9b
commit 7bfa728ccb
10 changed files with 55 additions and 24 deletions
+13 -1
View File
@@ -58,7 +58,19 @@ void Menu::InitializeMainMenuWindow(){
})END;
mainMenuWindow->ADD("Load Game Button",MenuComponent)({{12,36},{72,24}},"Load Game",[](MenuFuncData data){
SaveFile::UpdateSaveGameData();
Menu::OpenMenu(LOAD_GAME);
#ifdef __EMSCRIPTEN__
SaveFile::Server_GetLoadInfo([](std::string_view response){
if(response!="ERR"){
std::ofstream file("save_file_path"_S+"metadata.dat");
file<<response;
Menu::OpenMenu(LOAD_GAME);
}else{
std::cout<<"WARNING! Failed to retrieve load game information from the server!"<<std::endl;
}
});
#else
Menu::OpenMenu(LOAD_GAME);
#endif
return true;
})END;
mainMenuWindow->ADD("Quit Game Button",MenuComponent)({{12,68},{72,24}},"Quit Game",[](MenuFuncData data){