Incorporate dynamic pointer cast fix
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
@@ -149,7 +149,7 @@ void Menu::HoverMenuSelect(AiL*game){
|
||||
|
||||
void Menu::MenuSelect(AiL*game){
|
||||
if(!game->IsFocused()||selection.expired()||(selection.lock()->disabled||selection.lock()->grayedOut))return;
|
||||
bool buttonStillValid=selection.lock()->onClick(MenuFuncData{*this,game,selection,dynamic_pointer_cast<ScrollableWindowComponent>(selection.lock()->parentComponent.lock())});
|
||||
bool buttonStillValid=selection.lock()->onClick(MenuFuncData{*this,game,selection,DYNAMIC_POINTER_CAST<ScrollableWindowComponent>(selection.lock()->parentComponent.lock())});
|
||||
if(buttonStillValid){
|
||||
if(selection.lock()->menuDest!=MenuType::ENUM_END){
|
||||
if(stack.size()<32){
|
||||
@@ -275,7 +275,7 @@ void Menu::Draw(AiL*game){
|
||||
vf2d drawOffset{};
|
||||
if(!selection.expired()){
|
||||
if(!selection.lock()->parentComponent.expired()){
|
||||
std::weak_ptr<ScrollableWindowComponent>scrollableComponent=dynamic_pointer_cast<ScrollableWindowComponent>(selection.lock()->parentComponent.lock());
|
||||
std::weak_ptr<ScrollableWindowComponent>scrollableComponent=DYNAMIC_POINTER_CAST<ScrollableWindowComponent>(selection.lock()->parentComponent.lock());
|
||||
drawOffset+=scrollableComponent.lock()->GetScrollAmount();
|
||||
}
|
||||
draggingComponent->V(A::DRAW_OFFSET)=drawOffset+pos-offsetPos+selection.lock()->rect.pos+vi2d{1,-4};
|
||||
@@ -425,7 +425,7 @@ void Menu::SetMouseNavigation(bool mouseNavigation){
|
||||
void Menu::InventorySlotsUpdated(ITCategory cat){
|
||||
//Update the inventory with a new inventory slot, since there's one additional item to interact with now.
|
||||
for(std::weak_ptr<MenuComponent>component:inventoryListeners.at(cat)){
|
||||
std::weak_ptr<InventoryScrollableWindowComponent>comp=dynamic_pointer_cast<InventoryScrollableWindowComponent>(component.lock()); //HACK ALERT! We're assuming that these must be these classes otherwise they have no reason to even be using these listeners. Make sure that the lowest base class that requires these implements these functions!!!
|
||||
std::weak_ptr<InventoryScrollableWindowComponent>comp=DYNAMIC_POINTER_CAST<InventoryScrollableWindowComponent>(component.lock()); //HACK ALERT! We're assuming that these must be these classes otherwise they have no reason to even be using these listeners. Make sure that the lowest base class that requires these implements these functions!!!
|
||||
comp.lock()->OnInventorySlotsUpdate(cat);
|
||||
}
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void Menu::InventorySlotsUpdated(ITCategory cat){
|
||||
void Menu::MerchantInventorySlotsUpdated(ITCategory cat){
|
||||
//Update the inventory with a new inventory slot, since there's one additional item to interact with now.
|
||||
for(std::weak_ptr<MenuComponent>component:merchantInventoryListeners.at(cat)){
|
||||
std::weak_ptr<InventoryScrollableWindowComponent>comp=dynamic_pointer_cast<InventoryScrollableWindowComponent>(component.lock()); //HACK ALERT! We're assuming that these must be these classes otherwise they have no reason to even be using these listeners. Make sure that the lowest base class that requires these implements these functions!!!
|
||||
std::weak_ptr<InventoryScrollableWindowComponent>comp=DYNAMIC_POINTER_CAST<InventoryScrollableWindowComponent>(component.lock()); //HACK ALERT! We're assuming that these must be these classes otherwise they have no reason to even be using these listeners. Make sure that the lowest base class that requires these implements these functions!!!
|
||||
comp.lock()->OnInventorySlotsUpdate(cat);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user