[BUG] Current build does not properly start and has two stub functions MenuComponent.cpp lines 214 and 224

This commit is contained in:
2024-01-16 00:53:29 -06:00
parent c0ae0697b7
commit e669968bc3
19 changed files with 43 additions and 57 deletions
+9 -9
View File
@@ -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){
@@ -255,7 +255,7 @@ void Menu::Draw(AiL*game){
std::vector<std::weak_ptr<MenuComponent>>allComponents;
std::for_each(components.begin(),components.end(),[&](auto&pair){allComponents.push_back(pair.second);});
std::sort(allComponents.begin(),allComponents.end(),[](MenuComponent*c1,MenuComponent*c2){return c1->depth>c2->depth;});
std::sort(allComponents.begin(),allComponents.end(),[](std::weak_ptr<MenuComponent>c1,std::weak_ptr<MenuComponent>c2){return c1.lock()->depth>c2.lock()->depth;});
if(GetCurrentTheme().IsScaled()){
DrawScaledWindowBorder(game,pos,size,GetRenderColor());
@@ -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);
}
}
@@ -441,7 +441,7 @@ void Menu::MerchantInventorySlotsUpdated(ITCategory cat){
void Menu::AddInventoryListener(std::weak_ptr<MenuComponent>component,ITCategory category){
if(inventoryListeners.count(category)){
std::vector<std::weak_ptr<MenuComponent>>&listenerList=inventoryListeners.at(category);
if(std::find(listenerList.begin(),listenerList.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=listenerList.end()){
if(std::find_if(listenerList.begin(),listenerList.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=listenerList.end()){
ERR("WARNING! Component "<<component.lock()->name<<" has already been added to the "<<category<<" listener list! There should not be any duplicates!!")
}
listenerList.push_back(component);
@@ -458,7 +458,7 @@ void Menu::InitializeMenuListenerCategory(const std::string&category){
void Menu::AddMerchantInventoryListener(std::weak_ptr<MenuComponent>component,ITCategory category){
if(merchantInventoryListeners.count(category)){
std::vector<std::weak_ptr<MenuComponent>>&listenerList=merchantInventoryListeners.at(category);
if(std::find(listenerList.begin(),listenerList.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=listenerList.end()){
if(std::find_if(listenerList.begin(),listenerList.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=listenerList.end()){
ERR("WARNING! Component "<<component.lock()->name<<" has already been added to the "<<category<<" merchant listener list! There should not be any duplicates!!")
}
listenerList.push_back(component);
@@ -468,7 +468,7 @@ void Menu::AddMerchantInventoryListener(std::weak_ptr<MenuComponent>component,IT
}
void Menu::AddEquipStatListener(std::weak_ptr<MenuComponent>component){
if(std::find(equipStatListeners.begin(),equipStatListeners.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=equipStatListeners.end()){
if(std::find_if(equipStatListeners.begin(),equipStatListeners.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=equipStatListeners.end()){
ERR("WARNING! Component "<<component.lock()->name<<" has already been added to the Equip Stat listener list! There should not be any duplicates!!")
}
equipStatListeners.push_back(component);
@@ -542,7 +542,7 @@ void Menu::LockInListeners(){
}
void Menu::AddChapterListener(std::weak_ptr<MenuComponent>component){
if(std::find(chapterListeners.begin(),chapterListeners.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=chapterListeners.end()){
if(std::find_if(chapterListeners.begin(),chapterListeners.end(),[&](auto&ptr){return &*ptr.lock()==&*component.lock();})!=chapterListeners.end()){
ERR("WARNING! Component "<<component.lock()->name<<" has already been added to the Chapter listener list! There should not be any duplicates!!")
}
chapterListeners.push_back(component);