boe, OSX and menu[hack]: try to avoid crashes by postponing the creation of dialogs in the main loop.

This commit is contained in:
Laurent Alonso(fr)
2020-05-12 08:16:05 +02:00
committed by Celtic Minstrel
parent c558518a60
commit 3d7d465c7e
4 changed files with 50 additions and 3 deletions

View File

@@ -108,6 +108,11 @@ extern long anim_ticks;
static void init_boe(int, char*[]);
#ifdef __APPLE__
eMenuChoice menuChoice=eMenuChoice::MENU_CHOICE_NONE;
short menuChoiceId=-1;
#endif
int main(int argc, char* argv[]) {
#if 0
void debug_oldstructs();
@@ -252,6 +257,26 @@ void handle_events() {
cFramerateLimiter fps_limiter;
while(!All_Done) {
#ifdef __APPLE__
if (menuChoiceId>=0) {
eMenuChoice aMenuChoice=menuChoice;
menuChoice=eMenuChoice::MENU_CHOICE_NONE;
switch(aMenuChoice) {
case eMenuChoice::MENU_CHOICE_GENERIC:
handle_menu_choice(eMenu(menuChoiceId));
break;
case eMenuChoice::MENU_CHOICE_SPELL:
handle_menu_spell(eSpell(menuChoiceId));
break;
case eMenuChoice::MENU_CHOICE_MONSTER_INFO:
handle_monster_info_menu(menuChoiceId);
break;
case eMenuChoice::MENU_CHOICE_NONE:
break;
}
menuChoiceId=-1;
}
#endif
while(mainPtr.pollEvent(currentEvent)) handle_one_event(currentEvent);
// It would be nice to have minimap inside the main game window (we have lots of screen space in fullscreen mode).