Jeck - Fix for two obscure edge case bugs in the options menu.
* Confirmable options used to only check for confirmation when selecting another option. They now autoconfirm when saving & exiting. This bug could possibly result in loading the wrong theme. Fixed. * Changing profiles, canceling, then changing to the profile again could also result in improper theme loading. Fixed.
This commit is contained in:
@@ -297,6 +297,7 @@ class WGuiList: public WGuiItem{
|
|||||||
virtual bool Leaving(u32 key);
|
virtual bool Leaving(u32 key);
|
||||||
virtual void Entering(u32 key);
|
virtual void Entering(u32 key);
|
||||||
virtual void Render();
|
virtual void Render();
|
||||||
|
virtual void confirmChange(bool confirmed);
|
||||||
virtual void renderBack(WGuiBase * it);
|
virtual void renderBack(WGuiBase * it);
|
||||||
virtual void Reload();
|
virtual void Reload();
|
||||||
virtual void ButtonPressed(int controllerId, int controlId);
|
virtual void ButtonPressed(int controllerId, int controlId);
|
||||||
|
|||||||
@@ -116,9 +116,8 @@ void GameStateOptions::Update(float dt)
|
|||||||
optionsMenu->Update(dt);
|
optionsMenu->Update(dt);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mReload){
|
if(mReload){
|
||||||
options.reloadProfile(false);
|
options.reloadProfile(true);
|
||||||
optionsTabs->Reload();
|
optionsTabs->Reload();
|
||||||
mReload = false;
|
mReload = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,8 +174,8 @@ OptionProfile::OptionProfile(GameApp * _app, JGuiListener * jgl): OptionDirector
|
|||||||
addSelection("Default");
|
addSelection("Default");
|
||||||
sort(selections.begin(),selections.end());
|
sort(selections.begin(),selections.end());
|
||||||
mFocus = false;
|
mFocus = false;
|
||||||
populate();
|
|
||||||
initSelections();
|
initSelections();
|
||||||
|
populate();
|
||||||
};
|
};
|
||||||
|
|
||||||
void OptionProfile::addSelection(string s){
|
void OptionProfile::addSelection(string s){
|
||||||
@@ -201,12 +201,10 @@ void OptionProfile::Reload(){
|
|||||||
populate();
|
populate();
|
||||||
}
|
}
|
||||||
void OptionProfile::populate(){
|
void OptionProfile::populate(){
|
||||||
|
|
||||||
string temp = options[Options::ACTIVE_PROFILE].str;
|
string temp = options[Options::ACTIVE_PROFILE].str;
|
||||||
if (value >= selections.size()){ //TODO fail gracefully.
|
if (value >= selections.size()){ //TODO fail gracefully.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
options[Options::ACTIVE_PROFILE].str = selections[value];
|
options[Options::ACTIVE_PROFILE].str = selections[value];
|
||||||
PlayerData * pdata = NEW PlayerData(app->collection);
|
PlayerData * pdata = NEW PlayerData(app->collection);
|
||||||
options[Options::ACTIVE_PROFILE] = temp;
|
options[Options::ACTIVE_PROFILE] = temp;
|
||||||
@@ -267,15 +265,17 @@ void OptionProfile::confirmChange(bool confirmed){
|
|||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if(confirmed) result = value;
|
if(confirmed) result = value;
|
||||||
else result = initialValue;
|
else result = initialValue;
|
||||||
|
|
||||||
options[Options::ACTIVE_PROFILE] = selections[result];
|
options[Options::ACTIVE_PROFILE] = selections[result];
|
||||||
value = result;
|
value = result;
|
||||||
|
|
||||||
populate();
|
populate();
|
||||||
if(listener && confirmed)
|
if(listener && confirmed){
|
||||||
listener->ButtonPressed(-102,5);
|
listener->ButtonPressed(-102,5);
|
||||||
|
initialValue = value;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,6 +416,11 @@ void WGuiList::renderBack(WGuiBase * it){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void WGuiList::confirmChange(bool confirmed){
|
||||||
|
for(int x=0;x<nbitems;x++){
|
||||||
|
listItems[x]->confirmChange(confirmed);
|
||||||
|
}
|
||||||
|
}
|
||||||
void WGuiList::Render(){
|
void WGuiList::Render(){
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
int listHeight=40;
|
int listHeight=40;
|
||||||
@@ -685,8 +690,8 @@ void OptionTheme::confirmChange(bool confirmed){
|
|||||||
value = prior_value;
|
value = prior_value;
|
||||||
else{
|
else{
|
||||||
setData();
|
setData();
|
||||||
prior_value = value;
|
|
||||||
resources.Refresh(); //Update images
|
resources.Refresh(); //Update images
|
||||||
|
prior_value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string WDecoEnum::lookupVal(int value){
|
string WDecoEnum::lookupVal(int value){
|
||||||
@@ -1031,10 +1036,8 @@ void WGuiSplit::Reload(){
|
|||||||
right->Reload();
|
right->Reload();
|
||||||
}
|
}
|
||||||
void WGuiSplit::confirmChange(bool confirmed){
|
void WGuiSplit::confirmChange(bool confirmed){
|
||||||
if(bRight)
|
right->confirmChange(confirmed);
|
||||||
right->confirmChange(confirmed);
|
left->confirmChange(confirmed);
|
||||||
else
|
|
||||||
left->confirmChange(confirmed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//WGuiMenu
|
//WGuiMenu
|
||||||
|
|||||||
Reference in New Issue
Block a user