Fix bug with emscripten involving bad references to other map items in InputHelper groupData? This makes zero sense and only occurs in the emscripten build, a clear fixes it.
This commit is contained in:
parent
d33d5bb4f0
commit
a4bc56b457
@ -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<ButtonName>(data.second.first)){
|
||||
const ButtonName&name=std::get<ButtonName>(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<ButtonName>(action.first)){
|
||||
const ButtonName&name=std::get<ButtonName>(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<std::function<std::string(MenuFuncData)>>(data.second.first)){
|
||||
if(std::holds_alternative<std::function<std::string(MenuFuncData)>>(action.first)){
|
||||
std::weak_ptr<ScrollableWindowComponent>parentComponent;
|
||||
if(!Menu::stack.back()->GetSelection().expired()){
|
||||
parentComponent=Menu::stack.back()->GetSelection().lock()->parentComponent;
|
||||
}
|
||||
std::string name=std::get<std::function<std::string(MenuFuncData)>>(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<std::function<std::string(MenuFuncData)>>(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){
|
||||
|
@ -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?
|
Loading…
x
Reference in New Issue
Block a user