Refactored dynamic cast to do internal error checking. Refactored all inventory and button slot update functions in menu components so they no longer require virtual dispatch when all we require is some passing of lamba functions to update inventories.

This commit is contained in:
2023-12-27 20:40:01 -06:00
parent f2e3405b5b
commit bd066ee787
22 changed files with 430 additions and 217 deletions
+2 -7
View File
@@ -244,13 +244,8 @@ private:
template<typename T>
T*Component(MenuType menu,std::string componentName){
T*tmp=dynamic_cast<T*>(Menu::menus[menu]->components[componentName]);
if(tmp!=nullptr){
return tmp;
}else{
ERR("WARNING! Attempting to cast a button that isn't a "<<typeid(T).name()<<"!");
}
return nullptr;
T*tmp=DYNAMIC_CAST<T*>(Menu::menus[menu]->components[componentName]);
return tmp;
}
struct MenuFuncData{