gui::IGUIElement* parent,
IMenuManager *menumgr,
scene::ISceneManager* smgr,
- MainMenuData* data) :
+ MainMenuData* data,
+ bool& kill) :
m_device(dev),
m_parent(parent),
m_menumanager(menumgr),
m_formspecgui(0),
m_buttonhandler(0),
m_menu(0),
+ m_kill(kill),
m_startgame(false),
m_script(0),
m_scriptdir(""),
cloudInit();
- while(m_device->run() && (!m_startgame)) {
+ while(m_device->run() && (!m_startgame) && (!m_kill)) {
driver->beginScene(true, true, video::SColor(255,140,186,250));
if (m_clouds_enabled)
gui::IGUIElement* parent,
IMenuManager *menumgr,
scene::ISceneManager* smgr,
- MainMenuData* data);
+ MainMenuData* data,
+ bool& kill);
/** default destructor */
virtual ~GUIEngine();
/** the formspec menu */
GUIFormSpecMenu* m_menu;
+ /** reference to kill variable managed by SIGINT handler */
+ bool& m_kill;
+
/** variable used to abort menu and return back to main game handling */
bool m_startgame;
int selected_world;
bool simple_singleplayer_mode;
- // Actions
- bool kill;
-
//error handling
std::string errormessage;
MainMenuData():
// Initialize menu data
MainMenuData menudata;
- menudata.kill = kill;
menudata.address = address;
menudata.name = playername;
menudata.port = itos(port);
}
infostream<<"Waited for other menus"<<std::endl;
- GUIEngine* temp = new GUIEngine(device, guiroot, &g_menumgr,smgr,&menudata);
+ GUIEngine* temp = new GUIEngine(device, guiroot, &g_menumgr,smgr,&menudata,kill);
delete temp;
//once finished you'll never end up here
smgr->clear();
- kill = menudata.kill;
-
}
if(menudata.errormessage != ""){
GUIEngine* engine = getGuiEngine(L);
assert(engine != 0);
- engine->m_data->kill = true;
-
- //close menu next time
- engine->m_startgame = true;
- engine->m_menu->quitMenu();
+ engine->m_kill = true;
return 0;
}