Incorporate dynamic pointer cast fix
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
2ba989c6b5
commit
965d0afdb1
Binary file not shown.
|
Before Width: | Height: | Size: 35 MiB After Width: | Height: | Size: 36 MiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2023 The FreeType
|
||||
Portions of this software are copyright <EFBFBD> 2023 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
@ -93,7 +93,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
|
||||
#pragma region Weapon Inventory Display
|
||||
auto weaponsDisplay=blacksmithWindow->ADD("Weapon Inventory Display",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{2,28},{220,blacksmithWindow->size.y-44}},"Item Name Label","Item Description Label",
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>comp=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>comp=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
const std::weak_ptr<Item>item=comp.lock()->GetItem();
|
||||
|
||||
std::string label="";
|
||||
@ -109,7 +109,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>rowItem=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>rowItem=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
Component<MenuItemItemButton>(BLACKSMITH,"Item Icon")->SetItem(rowItem.lock()->GetItem());
|
||||
return true;
|
||||
},
|
||||
@ -128,7 +128,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
|
||||
auto armorDisplay=blacksmithWindow->ADD("Armor Inventory Display",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{2,28},{220,blacksmithWindow->size.y-44}},"Item Name Label","Item Description Label",
|
||||
[](MenuFuncData data){
|
||||
Menu::OpenMenu(CRAFT_ITEM);
|
||||
std::weak_ptr<RowItemDisplay>comp=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>comp=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
const std::weak_ptr<Item>item=comp.lock()->GetItem();
|
||||
|
||||
std::string label="";
|
||||
@ -143,7 +143,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>rowItem=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>rowItem=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
Component<MenuItemItemButton>(BLACKSMITH,"Item Icon")->SetItem(rowItem.lock()->GetItem());
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2023 The FreeType
|
||||
Portions of this software are copyright <EFBFBD> 2023 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
@ -145,13 +145,13 @@ void Menu::InitializeCharacterMenuWindow(){
|
||||
|
||||
auto equip=equipList->ADD("Equip Item "+std::to_string(counter),RowItemDisplay)(geom2d::rect<float>{{2,2+counter*29.f},{120-15,28}},it,
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>comp=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>comp=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
if(!comp.expired()){
|
||||
if(OppositeRingSlotDoesNotMatchCurrentEquip(comp.lock())){ //If we find that the opposite ring slot is equipped to us, this would be an item swap or the exact same ring, therefore no stat calculations apply.
|
||||
Inventory::EquipItem(comp.lock()->GetItem(),EquipSlot(comp.lock()->I(Attribute::EQUIP_TYPE)));
|
||||
SoundEffect::PlaySFX(comp.lock()->GetItem().lock()->UseSound(),SoundEffect::CENTERED);
|
||||
for(std::weak_ptr<MenuComponent>button:dynamic_pointer_cast<ScrollableWindowComponent>(data.parentComponent.lock())->GetComponents()){
|
||||
std::weak_ptr<RowItemDisplay>comp=dynamic_pointer_cast<RowItemDisplay>(button.lock());
|
||||
for(std::weak_ptr<MenuComponent>button:DYNAMIC_POINTER_CAST<ScrollableWindowComponent>(data.parentComponent.lock())->GetComponents()){
|
||||
std::weak_ptr<RowItemDisplay>comp=DYNAMIC_POINTER_CAST<RowItemDisplay>(button.lock());
|
||||
comp.lock()->SetSelected(false);
|
||||
}
|
||||
comp.lock()->SetSelected(true);
|
||||
@ -170,7 +170,7 @@ void Menu::InitializeCharacterMenuWindow(){
|
||||
|
||||
equip->SetHoverFunc(
|
||||
[&](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>button=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>button=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
if(!button.expired()){
|
||||
const std::weak_ptr<Item>buttonItem=button.lock()->GetItem();
|
||||
std::vector<float>statsBeforeEquip;
|
||||
@ -237,7 +237,7 @@ void Menu::InitializeCharacterMenuWindow(){
|
||||
equipmentWindowOpened=true;
|
||||
return true;
|
||||
},[](MenuFuncData data){//On Mouse Hover
|
||||
EquipSlot slot=dynamic_pointer_cast<EquipSlotButton>(data.component.lock())->GetSlot();
|
||||
EquipSlot slot=DYNAMIC_POINTER_CAST<EquipSlotButton>(data.component.lock())->GetSlot();
|
||||
const std::weak_ptr<Item>equip=Inventory::GetEquip(slot);
|
||||
if(!ISBLANK(equip)){
|
||||
Component<CharacterRotatingDisplay>(data.component.lock()->parentMenu,"Character Rotating Display")->Enable(false);
|
||||
|
||||
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2023 The FreeType
|
||||
Portions of this software are copyright <EFBFBD> 2023 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
@ -55,7 +55,7 @@ void Menu::InitializeConsumableCraftingWindow(){
|
||||
#pragma region Craftables Inventory Display
|
||||
auto craftingItemsDisplay=consumableCraftingWindow->ADD("Crafting Inventory Display",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{2,28},{220,consumableCraftingWindow->size.y-44}},"Item Name Label","Item Description Label",
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>comp=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>comp=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
const std::weak_ptr<Item>item=comp.lock()->GetItem();
|
||||
Component<MenuLabel>(CONSUMABLE_CRAFT_ITEM,"Item Name Header")->GetString(A::ITEM_NAME)=item.lock()->ActualName();
|
||||
Component<MenuLabel>(CONSUMABLE_CRAFT_ITEM,"Amount to Craft Amount Label")->SetLabel("1");
|
||||
@ -68,7 +68,7 @@ void Menu::InitializeConsumableCraftingWindow(){
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>rowItem=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>rowItem=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
if(rowItem.lock()->GetItem().lock()->GetEnhancementInfo().AvailableChapter()<=game->GetCurrentChapter()){
|
||||
Component<MenuItemItemButton>(CRAFT_CONSUMABLE,"Item Icon")->SetHideDetails(false);
|
||||
}else{
|
||||
|
||||
@ -85,10 +85,16 @@ type DYNAMIC_CAST(auto variable){
|
||||
return pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
template<typename type>
|
||||
std::shared_ptr<type>DYNAMIC_POINTER_CAST(auto variable){
|
||||
std::shared_ptr<type>pointer=std::dynamic_pointer_cast<type>(variable);
|
||||
if(pointer)ERR("Could not dynamic cast to type "<<typeid(variable).name()<<"!");
|
||||
return pointer;
|
||||
}*/
|
||||
template<typename T,typename U>
|
||||
std::shared_ptr<T>DYNAMIC_POINTER_CAST(const std::shared_ptr<U>&variable){
|
||||
std::shared_ptr<T> newVariable=dynamic_pointer_cast<T>(variable);
|
||||
if(!newVariable)ERR("Could not dynamic cast to pointer type "<<typeid(variable).name()<<"!");
|
||||
return newVariable;
|
||||
}
|
||||
|
||||
template<typename T,typename U>
|
||||
std::shared_ptr<T>DYNAMIC_POINTER_CAST(const std::weak_ptr<U>&variable){
|
||||
std::shared_ptr<T> newVariable=dynamic_pointer_cast<T>(variable.lock());
|
||||
if(!newVariable)ERR("Could not dynamic cast to pointer type "<<typeid(variable).name()<<"!");
|
||||
return newVariable;
|
||||
}
|
||||
@ -56,11 +56,11 @@ void Menu::InitializeConsumableInventoryWindow(){
|
||||
|
||||
auto consumableWindow=inventoryWindow->ADD("inventory",InventoryScrollableWindowComponent)(geom2d::rect<float>{{0,15},{windowSize.x,96.f}},"itemName","itemDescription",
|
||||
[&](MenuFuncData data){
|
||||
std::weak_ptr<MenuItemButton>button=dynamic_pointer_cast<MenuItemButton>(data.component.lock());
|
||||
std::weak_ptr<MenuItemButton>button=DYNAMIC_POINTER_CAST<MenuItemButton>(data.component.lock());
|
||||
data.game->ClearLoadoutItem(data.menu.I(A::LOADOUT_SLOT));
|
||||
for(std::weak_ptr<MenuComponent>component:data.parentComponent.lock()->GetComponents()){ //HACK ALERT! If we are accessing a parent component, it's because we are dealing with a scrolling window component, which has sub-components. So this should be a safe cast to make.
|
||||
if(component.lock()->GetName().starts_with("item")){
|
||||
std::weak_ptr<MenuItemButton>button2=dynamic_pointer_cast<MenuItemButton>(component.lock());//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.
|
||||
std::weak_ptr<MenuItemButton>button2=DYNAMIC_POINTER_CAST<MenuItemButton>(component.lock());//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.expired())ERR("Could not cast item to a MenuItemButton*!");
|
||||
if(&*button2.lock()==&*button.lock()){
|
||||
if(button2.lock()->selected!=-1){
|
||||
|
||||
@ -94,7 +94,7 @@ public:
|
||||
virtual inline void SetCompactDescriptions(CompactText compact){
|
||||
this->compact=compact;
|
||||
for(std::weak_ptr<MenuComponent>component:components){
|
||||
std::weak_ptr<MenuItemButton>itemButton=dynamic_pointer_cast<MenuItemButton>(component.lock());
|
||||
std::weak_ptr<MenuItemButton>itemButton=DYNAMIC_POINTER_CAST<MenuItemButton>(component.lock());
|
||||
itemButton.lock()->SetCompactDescriptions(compact);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2023 The FreeType
|
||||
Portions of this software are copyright <EFBFBD> 2023 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
@ -90,7 +90,7 @@ void Menu::InitializeInventoryWindow(){
|
||||
|
||||
auto inventoryDisplay=inventoryWindow->ADD("Inventory Display - "+category,RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{72,28},{150,inventoryWindow->size.y-44}},"Item Name Label","Item Description Label",DO_NOTHING,
|
||||
[](MenuFuncData data){
|
||||
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(dynamic_pointer_cast<RowItemDisplay>(data.component.lock())->GetItem());
|
||||
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock())->GetItem());
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ private:
|
||||
|
||||
template<typename T>
|
||||
std::shared_ptr<T>Component(MenuType menu,std::string componentName){
|
||||
return dynamic_pointer_cast<T>(Menu::menus[menu]->components[componentName]);
|
||||
return DYNAMIC_POINTER_CAST<T>(Menu::menus[menu]->components[componentName]);
|
||||
}
|
||||
|
||||
struct MenuFuncData{
|
||||
|
||||
@ -51,7 +51,7 @@ private:
|
||||
public:
|
||||
inline MenuAnimatedIconToggleButton(geom2d::rect<float>rect,std::string animation,MenuFunc onClick)
|
||||
:MenuAnimatedIconButton(rect,animation,[](MenuFuncData data){
|
||||
std::weak_ptr<MenuAnimatedIconToggleButton>button=dynamic_pointer_cast<MenuAnimatedIconToggleButton>(data.component.lock());
|
||||
std::weak_ptr<MenuAnimatedIconToggleButton>button=DYNAMIC_POINTER_CAST<MenuAnimatedIconToggleButton>(data.component.lock());
|
||||
button.lock()->Select();
|
||||
button.lock()->_onClick(data);
|
||||
return true;
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2023 The FreeType
|
||||
Portions of this software are copyright <EFBFBD> 2023 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
@ -94,7 +94,7 @@ void Menu::InitializeMerchantWindow(){
|
||||
|
||||
auto inventoryDisplay=merchantWindow->ADD("Merchant Inventory Display",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{2,28},{220,merchantWindow->size.y-44}},"Item Name Label","Item Description Label",
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>item=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>item=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
Component<MenuLabel>(BUY_ITEM,"Item Purchase Header")->S(A::ITEM_NAME)=item.lock()->GetItem().lock()->ActualName();
|
||||
Component<MenuLabel>(BUY_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->BuyValue()));
|
||||
Component<MenuLabel>(BUY_ITEM,"Amount to buy Amount Label")->SetLabel("1");
|
||||
@ -111,7 +111,7 @@ void Menu::InitializeMerchantWindow(){
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(dynamic_pointer_cast<RowItemDisplay>(data.component.lock())->GetItem());
|
||||
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock())->GetItem());
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
@ -152,7 +152,7 @@ void Menu::InitializeMerchantWindow(){
|
||||
|
||||
auto inventoryDisplay=merchantWindow->ADD("Inventory Display - "+category,RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{72,28},{150,merchantWindow->size.y-44}},"Item Name Label","Item Description Label",
|
||||
[](MenuFuncData data){
|
||||
std::weak_ptr<RowItemDisplay>item=dynamic_pointer_cast<RowItemDisplay>(data.component.lock());
|
||||
std::weak_ptr<RowItemDisplay>item=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
|
||||
if(item.lock()->GetItem().lock()->CanBeSold()){
|
||||
Component<ItemMenuLabel>(SELL_ITEM,"Item Sell Header")->SetItem(item.lock()->GetItem());
|
||||
Component<MenuLabel>(SELL_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue()));
|
||||
@ -171,7 +171,7 @@ void Menu::InitializeMerchantWindow(){
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(dynamic_pointer_cast<RowItemDisplay>(data.component.lock())->GetItem());
|
||||
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock())->GetItem());
|
||||
return true;
|
||||
},
|
||||
[](MenuFuncData data){
|
||||
|
||||
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2023 The FreeType
|
||||
Portions of this software are copyright <EFBFBD> 2023 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
@ -52,7 +52,7 @@ public:
|
||||
virtual inline void SetCompactDescriptions(CompactText compact)override final{
|
||||
this->compact=compact;
|
||||
for(std::weak_ptr<MenuComponent>component:components){
|
||||
std::weak_ptr<RowItemDisplay>itemButton=dynamic_pointer_cast<RowItemDisplay>(component.lock());
|
||||
std::weak_ptr<RowItemDisplay>itemButton=DYNAMIC_POINTER_CAST<RowItemDisplay>(component.lock());
|
||||
itemButton.lock()->SetCompactDescriptions(compact);
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ public:
|
||||
virtual inline void SetPriceLabelType(PriceLabel::PriceLabel labelType)final{
|
||||
this->priceLabel=labelType;
|
||||
for(std::weak_ptr<MenuComponent>component:components){
|
||||
std::weak_ptr<RowItemDisplay>itemButton=dynamic_pointer_cast<RowItemDisplay>(component.lock());
|
||||
std::weak_ptr<RowItemDisplay>itemButton=DYNAMIC_POINTER_CAST<RowItemDisplay>(component.lock());
|
||||
itemButton.lock()->SetPriceLabelType(labelType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ const void SaveFile::UpdateSaveGameData(){
|
||||
for(size_t i=0;i<saveFileCount;i++){
|
||||
if(metadata.HasProperty(std::format("save{}",i))){
|
||||
gameFilesList->ADD(std::format("Load File Button - Save {}",i),LoadFileButton)(geom2d::rect<float>{{0,offsetY},{gameFilesList->GetSize().x-13,48}},metadata[std::format("save{}",i)],i,[](MenuFuncData data){
|
||||
std::weak_ptr<LoadFileButton>comp=dynamic_pointer_cast<LoadFileButton>(data.component.lock());
|
||||
std::weak_ptr<LoadFileButton>comp=DYNAMIC_POINTER_CAST<LoadFileButton>(data.component.lock());
|
||||
saveFileID=comp.lock()->getSaveFileID();
|
||||
SaveFile::LoadGame();
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user