Fix more dynamic pointer strict casts to parent components (when they shouldn't be). Fixed double updating bug for components in ScrollableWindowComponents.
This commit is contained in:
parent
848d0e4816
commit
bc1a1c6876
@ -239,10 +239,14 @@ void Menu::Update(AiL*game){
|
||||
}
|
||||
|
||||
for(auto&[key,component]:components){
|
||||
component->_BeforeUpdate(game);
|
||||
if(component->renderInMain){
|
||||
component->_BeforeUpdate(game);
|
||||
}
|
||||
}
|
||||
for(auto&[key,component]:components){
|
||||
component->_Update(game);
|
||||
if(component->renderInMain){
|
||||
component->_Update(game);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -212,7 +212,7 @@ void MenuComponent::_OnMouseOut(){
|
||||
if(runHoverFunctions){
|
||||
if(hoverState){
|
||||
hoverState=false;
|
||||
onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),DYNAMIC_POINTER_CAST<ScrollableWindowComponent>(parentComponent.lock())});
|
||||
onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),dynamic_pointer_cast<ScrollableWindowComponent>(parentComponent.lock())});
|
||||
OnMouseOut();
|
||||
}
|
||||
}
|
||||
@ -222,7 +222,7 @@ void MenuComponent::_OnHover(){
|
||||
if(hovered){
|
||||
if(runHoverFunctions&&!hoverState){
|
||||
hoverState=true;
|
||||
onHover(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),DYNAMIC_POINTER_CAST<ScrollableWindowComponent>(parentComponent.lock())});
|
||||
onHover(MenuFuncData{*Menu::menus[parentMenu],game,std::make_shared<MenuComponent>(*this),dynamic_pointer_cast<ScrollableWindowComponent>(parentComponent.lock())});
|
||||
OnHover();
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,9 @@ protected:
|
||||
virtual inline void BeforeUpdate(AiL*game)override{
|
||||
MenuComponent::BeforeUpdate(game);
|
||||
for(std::weak_ptr<MenuComponent>component:components){
|
||||
component.lock()->_BeforeUpdate(game);
|
||||
std::shared_ptr<MenuComponent>componentPtr=component.lock();
|
||||
if(componentPtr->renderInMain)ERR(std::format("WARNING! Component {} is inside a ScrollableWindowComponent but renders in main instead! Parent Component: {}",componentPtr->GetName(),GetName()));
|
||||
componentPtr->_BeforeUpdate(game);
|
||||
}
|
||||
}
|
||||
virtual inline void Update(AiL*game)override{
|
||||
|
||||
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 5947
|
||||
#define VERSION_BUILD 5950
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user