diff --git a/Adventures in Lestoria/InputHelper.cpp b/Adventures in Lestoria/InputHelper.cpp index 3b6d1dd1..0a88727f 100644 --- a/Adventures in Lestoria/InputHelper.cpp +++ b/Adventures in Lestoria/InputHelper.cpp @@ -48,6 +48,9 @@ INCLUDE_WINDOW_SIZE InputHelper::InputHelper(){} void InputHelper::Initialize(MenuInputGroups&inputGroups){ + groupData.clear(); //HACK ALERT: WTF, somehow we must clear this map because there are references to things that are mixed up where they shouldn't be + // ONLY for the emscripten build. Clearing this map ensures that we start with fresh copies to things and it appears that emscripten + // likes this...? groupData=inputGroups; } @@ -70,25 +73,24 @@ void InputHelper::Draw(){ #pragma region Populate all buttons to display inputGroups.clear(); groupedInputs.clear(); - for(auto&data:groupData){ - if(data.first.GetLabelVisible()){ //If the label is not visible, we don't care to include it in our list. - if(std::holds_alternative(data.second.first)){ - const ButtonName&name=std::get(data.second.first); - groupedInputs[name].push_back(data.first.GetGroup()); - + for(auto&[group,action]:groupData){ + if(group.GetLabelVisible()){ //If the label is not visible, we don't care to include it in our list. + if(std::holds_alternative(action.first)){ + const ButtonName&name=std::get(action.first); + groupedInputs[name].push_back(group.GetGroup()); if(groupedInputs[name].size()>1)continue; //Skip adding to the list of input groups because this input already has been added. }else - if(std::holds_alternative>(data.second.first)){ + if(std::holds_alternative>(action.first)){ std::weak_ptrparentComponent; if(!Menu::stack.back()->GetSelection().expired()){ parentComponent=Menu::stack.back()->GetSelection().lock()->parentComponent; } - std::string name=std::get>(data.second.first)(MenuFuncData{*Menu::stack.back(),game,Menu::stack.back()->GetSelection(),parentComponent}); - groupedInputs[name].push_back(data.first.GetGroup()); + std::string name=std::get>(action.first)(MenuFuncData{*Menu::stack.back(),game,Menu::stack.back()->GetSelection(),parentComponent}); + groupedInputs[name].push_back(group.GetGroup()); if(groupedInputs[name].size()>1)continue; //Skip adding to the list of input groups because this input already has been added. } - this->inputGroups[data.first.GetGroup()]=data.second.first; + this->inputGroups[group.GetGroup()]=action.first; } } for(auto&[group,display]:inputGroups){ diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 171cfab2..bf1689f2 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -36,5 +36,3 @@ Original Nico Sprite Story I-I should not unlock Stage I-II. Initial Gold Crafting costs does not get subtracted properly. Menu controls are not properly saved in system settings (only for emscripten?) - -The keyboard display controls for the merchant are messed up? \ No newline at end of file