mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #674 from ShubusCorporation/do/fix/game_interface/load_and_main_menu_buttons
Fix: 'Load' and 'Main Menu' in-game buttons should work properly
This commit is contained in:
@@ -1291,6 +1291,7 @@ static void handleEvent(SDL_Event & ev)
|
|||||||
{
|
{
|
||||||
CSH->endGameplay();
|
CSH->endGameplay();
|
||||||
GH.defActionsDef = 63;
|
GH.defActionsDef = 63;
|
||||||
|
CMM->menu->switchToTab("main");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EUserEvent::RESTART_GAME:
|
case EUserEvent::RESTART_GAME:
|
||||||
|
@@ -139,6 +139,11 @@ void CMenuScreen::switchToTab(std::string name)
|
|||||||
switchToTab(vstd::find_pos(menuNameToEntry, name));
|
switchToTab(vstd::find_pos(menuNameToEntry, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t CMenuScreen::getActiveTab() const
|
||||||
|
{
|
||||||
|
return tabs->getActive();
|
||||||
|
}
|
||||||
|
|
||||||
//funciton for std::string -> std::function conversion for main menu
|
//funciton for std::string -> std::function conversion for main menu
|
||||||
static std::function<void()> genCommand(CMenuScreen * menu, std::vector<std::string> menuType, const std::string & string)
|
static std::function<void()> genCommand(CMenuScreen * menu, std::vector<std::string> menuType, const std::string & string)
|
||||||
{
|
{
|
||||||
@@ -301,7 +306,7 @@ void CMainMenu::update()
|
|||||||
{
|
{
|
||||||
GH.pushInt(CMM);
|
GH.pushInt(CMM);
|
||||||
GH.pushInt(menu);
|
GH.pushInt(menu);
|
||||||
menu->switchToTab(0);
|
menu->switchToTab(menu->getActiveTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles mouse and key input
|
// Handles mouse and key input
|
||||||
|
@@ -55,6 +55,7 @@ public:
|
|||||||
|
|
||||||
void switchToTab(size_t index);
|
void switchToTab(size_t index);
|
||||||
void switchToTab(std::string name);
|
void switchToTab(std::string name);
|
||||||
|
size_t getActiveTab() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMenuEntry : public CIntObject
|
class CMenuEntry : public CIntObject
|
||||||
|
@@ -58,6 +58,11 @@ void CTabbedInt::setActive(size_t which)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t CTabbedInt::getActive() const
|
||||||
|
{
|
||||||
|
return activeID;
|
||||||
|
}
|
||||||
|
|
||||||
void CTabbedInt::reset()
|
void CTabbedInt::reset()
|
||||||
{
|
{
|
||||||
deleteItem(activeTab);
|
deleteItem(activeTab);
|
||||||
|
@@ -49,6 +49,7 @@ public:
|
|||||||
CTabbedInt(CreateFunc create, Point position=Point(), size_t ActiveID=0);
|
CTabbedInt(CreateFunc create, Point position=Point(), size_t ActiveID=0);
|
||||||
|
|
||||||
void setActive(size_t which);
|
void setActive(size_t which);
|
||||||
|
size_t getActive() const;
|
||||||
//recreate active tab
|
//recreate active tab
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user