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

pull/28/head
sigonasr2 1 year ago
parent f427928ca6
commit c05f76cdfd
  1. 24
      Crawler/InventoryScrollableWindowComponent.h
  2. 2
      Crawler/Version.h

@ -105,20 +105,18 @@ protected:
MenuFunc useItemFunc=[&](MenuFuncData data){ MenuFunc useItemFunc=[&](MenuFuncData data){
MenuItemButton*button=(MenuItemButton*)data.component; 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));
data.game->ClearLoadoutItem(data.menu.I(A::LOADOUT_SLOT)); for(MenuComponent*component:components){
for(MenuComponent*component:components){ if(component->GetName().starts_with("item")){
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.
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==button){ if(button2->selected!=-1){
if(button2->selected!=-1){ data.game->ClearLoadoutItem(button2->selected);
data.game->ClearLoadoutItem(button2->selected);
}
button2->selected=-1;
}
if(button2->selected==data.menu.I(A::LOADOUT_SLOT)){
button2->selected=-1;
} }
button2->selected=-1;
}
if(button2->selected==data.menu.I(A::LOADOUT_SLOT)){
button2->selected=-1;
} }
} }
} }

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

Loading…
Cancel
Save