Fix a bug with loadout item slots not being properly handled when items are selected while they're blank.

This commit is contained in:
sigonasr2 2023-11-16 17:15:13 -06:00
parent f427928ca6
commit c05f76cdfd
2 changed files with 12 additions and 14 deletions

View File

@ -105,20 +105,18 @@ protected:
MenuFunc useItemFunc=[&](MenuFuncData data){
MenuItemButton*button=(MenuItemButton*)data.component;
if(!data.game->GetLoadoutItem(data.menu.I(A::LOADOUT_SLOT)).IsBlank()){ //This loadout slot seems to have an item in it already, so deselect that one first.
data.game->ClearLoadoutItem(data.menu.I(A::LOADOUT_SLOT));
for(MenuComponent*component:components){
if(component->GetName().starts_with("item")){
MenuItemButton*button2=(MenuItemButton*)component;//HACK ALERT! This is probably an item since we populated item lists using this name for the components. So we assume these are MenuItemButton classes.
if(button2==button){
if(button2->selected!=-1){
data.game->ClearLoadoutItem(button2->selected);
}
button2->selected=-1;
}
if(button2->selected==data.menu.I(A::LOADOUT_SLOT)){
button2->selected=-1;
data.game->ClearLoadoutItem(data.menu.I(A::LOADOUT_SLOT));
for(MenuComponent*component:components){
if(component->GetName().starts_with("item")){
MenuItemButton*button2=(MenuItemButton*)component;//HACK ALERT! This is probably an item since we populated item lists using this name for the components. So we assume these are MenuItemButton classes.
if(button2==button){
if(button2->selected!=-1){
data.game->ClearLoadoutItem(button2->selected);
}
button2->selected=-1;
}
if(button2->selected==data.menu.I(A::LOADOUT_SLOT)){
button2->selected=-1;
}
}
}

View File

@ -33,7 +33,7 @@ SUCH DAMAGE.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 2854
#define VERSION_BUILD 2856
#define stringify(a) stringify_(a)
#define stringify_(a) #a