Added: Option to turn icon buff markers on/off

--HG--
branch : feature-item-icon-buffs
hg/atys
Nimetu 5 years ago
parent 7a2608e38c
commit 131f05387a

@ -4609,3 +4609,17 @@ public:
}; };
REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame");
// ***************************************************************************
class CHandlerTriggerIconBuffs : public IActionHandler
{
public:
void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */)
{
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_ICON_BUFFS", false);
// no node - show,
// node == false - hide
CDBCtrlSheet::setShowIconBuffs(!node || node->getValueBool());
}
};
REGISTER_ACTION_HANDLER(CHandlerTriggerIconBuffs, "trigger_show_icon_buffs");

@ -73,6 +73,9 @@ REGISTER_UI_CLASS(CDBCtrlSheet)
const uint64 NOTIFY_ANIM_MS_DURATION = 1000; const uint64 NOTIFY_ANIM_MS_DURATION = 1000;
// state kept and changed by UI:SAVE:SHOW_ICON_BUFFS
bool CDBCtrlSheet::_ShowIconBuffs = true;
// *************************************************************************** // ***************************************************************************
void CControlSheetInfoWaiter::sendRequest() void CControlSheetInfoWaiter::sendRequest()
@ -2323,7 +2326,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
rVR.draw11RotFlipBitmap (_RenderLayer+1, x, y, 0, false, _DispOver2BmpId, fastMulRGB(curSheetColor, _IconOver2Color)); rVR.draw11RotFlipBitmap (_RenderLayer+1, x, y, 0, false, _DispOver2BmpId, fastMulRGB(curSheetColor, _IconOver2Color));
} }
if (!_BuffIcons.empty()) if (_ShowIconBuffs && !_BuffIcons.empty())
{ {
// there is max 4 icons // there is max 4 icons
sint32 hArea = (hSheet / 4); sint32 hArea = (hSheet / 4);
@ -2358,7 +2361,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
drawNumber(x+1, y-2+hSheet-rVR.getFigurTextureH(), wSheet, hSheet, numberColor, enchant, false); drawNumber(x+1, y-2+hSheet-rVR.getFigurTextureH(), wSheet, hSheet, numberColor, enchant, false);
} }
if (!_EnchantIcons.empty()) if (_ShowIconBuffs && !_EnchantIcons.empty())
{ {
// should only only 2 icons at most // should only only 2 icons at most
// draw them in single line, top-right // draw them in single line, top-right
@ -4691,7 +4694,3 @@ void CDBCtrlSheet::startNotifyAnim()
_NotifyAnimEndTime = T1 + NOTIFY_ANIM_MS_DURATION; _NotifyAnimEndTime = T1 + NOTIFY_ANIM_MS_DURATION;
} }

@ -602,6 +602,9 @@ public:
// callback from info waiter // callback from info waiter
void infoReceived(); void infoReceived();
// set enchant/buff marker visiblility
static void setShowIconBuffs(bool b) { _ShowIconBuffs = b; }
protected: protected:
inline bool useItemInfoForFamily(ITEMFAMILY::EItemFamily family) const; inline bool useItemInfoForFamily(ITEMFAMILY::EItemFamily family) const;
@ -799,6 +802,8 @@ private:
static CDBCtrlSheet *_CurrSelection; static CDBCtrlSheet *_CurrSelection;
static CDBCtrlSheet *_CurrMenuSheet; static CDBCtrlSheet *_CurrMenuSheet;
static bool _ShowIconBuffs;
private: private:
void updateActualType() const; void updateActualType() const;
void updateIconSize(); void updateIconSize();

Loading…
Cancel
Save