Skip to content

Commit 218dacf

Browse files
revolucasXottab-DUTY
authored andcommitted
= fixed inventory cell items not updating progress bar
= Corrected some issues with Axel's feature
1 parent afc85df commit 218dacf

File tree

10 files changed

+33
-9
lines changed

10 files changed

+33
-9
lines changed

src/xrGame/Inventory.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,9 +1075,12 @@ bool CInventory::Eat(PIItem pIItem)
10751075

10761076
if (pItemToEat->CanDelete())
10771077
{
1078-
pIItem->SetDropManual(TRUE);
1079-
return false;
1078+
if (!pItemToEat->CanDelete())
1079+
return false;
1080+
1081+
pIItem->SetDropManual(true);
10801082
}
1083+
10811084
return true;
10821085
}
10831086

src/xrGame/alife_trader_abstract.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,14 @@ void add_online_impl(CSE_ALifeDynamicObject* object, const bool& update_registri
171171
//-Alundaio
172172

173173
CSE_ALifeDynamicObject* l_tpALifeDynamicObject = ai().alife().objects().object(*I);
174+
if (!l_tpALifeDynamicObject)
175+
continue;
176+
174177
CSE_ALifeInventoryItem* l_tpALifeInventoryItem = smart_cast<CSE_ALifeInventoryItem*>(l_tpALifeDynamicObject);
175-
R_ASSERT2(l_tpALifeInventoryItem, "Non inventory item object has parent?!");
178+
if (!l_tpALifeInventoryItem)
179+
continue;
180+
181+
//R_ASSERT2(l_tpALifeInventoryItem, "Non inventory item object has parent?!");
176182
l_tpALifeInventoryItem->base()->s_flags.or (M_SPAWN_UPDATE);
177183
CSE_Abstract* l_tpAbstract = smart_cast<CSE_Abstract*>(l_tpALifeInventoryItem);
178184
object->alife().server().entity_Destroy(l_tpAbstract);

src/xrGame/eatable_item.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ bool CEatableItem::UseBy(CEntityAlive* entity_alive)
137137
m_iRemainingUses = 0;
138138

139139
SetCondition((float)m_iRemainingUses / (float)m_iMaxUses);
140-
CurrentGameUI()->HideActorMenu();
141-
CurrentGameUI()->ShowActorMenu();
142140

143141
return true;
144142
}

src/xrGame/ui/UIActorMenu.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ class CUIActorMenu : public CUIDialogWnd, public CUIWndCallback
224224
void BindDragDropListEvents(CUIDragDropListEx* lst);
225225

226226
EDDListType GetListType(CUIDragDropListEx* l);
227-
CUIDragDropListEx* GetListByType(EDDListType t);
227+
228+
public:
229+
CUIDragDropListEx* GetListByType(EDDListType t); //Alundaio: Make public
230+
231+
protected:
228232
CUIDragDropListEx* GetSlotList(u16 slot_idx);
229233
bool CanSetItemToList(PIItem item, CUIDragDropListEx* l, u16& ret_slot);
230234

src/xrGame/ui/UIActorMenuInventory.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,9 @@ bool CUIActorMenu::TryUseItem(CUICellItem* cell_itm)
718718
{
719719
return false;
720720
}
721+
722+
cell_itm->UpdateConditionProgressBar(); //Alundaio
723+
721724
u16 recipient = m_pActorInvOwner->object_id();
722725
if (item->parent_id() != recipient)
723726
{

src/xrGame/ui/UIActorMenu_action.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ bool CUIActorMenu::OnItemDrop(CUICellItem* itm)
143143

144144
OnItemDropped(CurrentIItem(), new_owner, old_owner);
145145

146-
UpdateItemsPlace();
147146
UpdateConditionProgressBars();
147+
UpdateItemsPlace();
148148

149149
return true;
150150
}
@@ -232,8 +232,8 @@ bool CUIActorMenu::OnItemDbClick(CUICellItem* itm)
232232

233233
}; // switch
234234

235-
UpdateItemsPlace();
236235
UpdateConditionProgressBars();
236+
UpdateItemsPlace();
237237

238238
return true;
239239
}

src/xrGame/ui/UICellCustomItems.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ void CUIInventoryCellItem::SetIsHelper(bool is_helper) { object()->set_is_helper
7070
void CUIInventoryCellItem::Update()
7171
{
7272
inherited::Update();
73+
inherited:UpdateConditionProgressBar(); //Alundaio
7374
UpdateItemText();
7475

7576
u32 color = GetTextureColor();

src/xrGame/ui/UICellItem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void CUICellItem::UpdateConditionProgressBar()
227227
m_pConditionState->ShowBackground(false);
228228
}
229229

230-
m_pConditionState->m_bUseColor = false;
230+
m_pConditionState->m_bNoLerp = true;
231231
}
232232
}
233233

src/xrGame/ui/UIProgressBar.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CUIProgressBar::CUIProgressBar(void)
1010

1111
m_bBackgroundPresent = false;
1212
m_bUseColor = false;
13+
m_bNoLerp = false; //Alundaio
1314

1415
AttachChild(&m_UIBackgroundItem);
1516
AttachChild(&m_UIProgressItem);
@@ -53,6 +54,12 @@ void CUIProgressBar::UpdateProgressBar()
5354

5455
if (m_bUseColor)
5556
{
57+
if (m_bNoLerp)
58+
{
59+
m_UIProgressItem.SetTextureColor(m_maxColor.get());
60+
return;
61+
}
62+
5663
Fcolor curr;
5764
curr.lerp(m_minColor, m_middleColor, m_maxColor, fCurrentLength);
5865
m_UIProgressItem.SetTextureColor(curr.get());

src/xrGame/ui/UIProgressBar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ class CUIProgressBar : public CUIWindow
3232

3333
public:
3434
bool m_bUseColor;
35+
bool m_bNoLerp; //Alundaio: use only solid color with m_maxColor
3536
Fcolor m_minColor;
3637
Fcolor m_middleColor;
3738
Fcolor m_maxColor;
3839
float m_inertion; //
40+
3941
public:
4042
CUIStatic m_UIProgressItem;
4143
CUIStatic m_UIBackgroundItem;

0 commit comments

Comments
 (0)