From 7aa639138a1e7dafc6db6c410105c300dd740a68 Mon Sep 17 00:00:00 2001 From: bensaine Date: Mon, 7 Feb 2022 23:49:24 -0500 Subject: [PATCH] revert _IsHotbarSlot --- ryzom/client/src/interface_v3/dbctrl_sheet.cpp | 8 ++------ ryzom/client/src/interface_v3/dbctrl_sheet.h | 2 -- .../src/interface_v3/inventory_manager.cpp | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 6f6b9e519..7b957f33d 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -315,7 +315,6 @@ CCtrlSheetInfo::CCtrlSheetInfo() _ItemSlot= SLOTTYPE::UNDEFINED; _AutoGrayed= false; _HasTradeSlotType = false; - _IsHotbarSlot = false; _BrickOverable= false; _ReadQuantityFromSheet = false; _AHOnLeftClick = NULL; @@ -391,10 +390,6 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr prop = (char*) xmlGetProp( cur, (xmlChar*)"use_slot_type_db_entry" ); if (prop) _HasTradeSlotType= CInterfaceElement::convertBool(prop); - - prop = (char*) xmlGetProp( cur, (xmlChar*)"hotbar_slot" ); - if (prop) - _IsHotbarSlot= CInterfaceElement::convertBool(prop); // Read Action handlers CAHManager::getInstance()->parseAH(cur, "onclick_l", "params_l", _AHOnLeftClick, _AHLeftClickParams); @@ -3794,7 +3789,8 @@ bool CDBCtrlSheet::canDropItem(CDBCtrlSheet *src) const bf|= 1<getSheetId()) ) + string invPath = getInventory().getDBIndexPath(src); + if ( strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0 && getInventory().isUsableItem(src->getSheetId()) ) { return true; } diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index ec0104bcb..2ccbdf00a 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -169,7 +169,6 @@ public: // and another in the source slot. Useful for items to buy that are in infinite quantity. bool _AutoGrayed : 1; // if true then gray the ctrlSheeet if: 1/ Items: Is the Item Locked. 2/ Bricks: is the brick Latent. bool _HasTradeSlotType : 1; // true is the SLOT_TYPE DB field should be taken in account - bool _IsHotbarSlot : 1; // true if the slot is part of the hotbar bool _BrickOverable : 1; // if Type is Brick, display like a button (because LeftClickable). @@ -274,7 +273,6 @@ public: uint32 getItemNameId() const { return (uint32)_NameId.getSInt32();} // New Stack Size sint32 getStackable() const { return (_Stackable>1) ? 999 : 1; } - bool isHotbarSlot() const { return _IsHotbarSlot; } // get non locked quantity (can be zero) sint32 getNonLockedQuantity() const; diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index ccf75c77c..feebeb062 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -1030,6 +1030,11 @@ void CInventoryManager::equip(const std::string &bagPath, const std::string &inv inventory = INVENTORIES::equipment; fromString(invPath.substr(22,invPath.size()), invSlot); } + else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0) + { + inventory = INVENTORIES::hotbar; + fromString(invPath.substr(23,invPath.size()), invSlot); + } // Hands management : check if we have to unequip left hand because of incompatibility with right hand item sint16 oldRightIndexInBag = NLGUI::CDBManager::getInstance()->getDbProp(invPath + ":INDEX_IN_BAG")->getValue16(); @@ -1163,6 +1168,11 @@ void CInventoryManager::unequip(const std::string &invPath) inventory = INVENTORIES::equipment; fromString(invPath.substr(22,invPath.size()), invSlot); } + else if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) == 0) + { + inventory = INVENTORIES::hotbar; + fromString(invPath.substr(23,invPath.size()), invSlot); + } // Hands management : check if we have to unequip left hand because of incompatibility with right hand item if (inventory == INVENTORIES::handling && invSlot == 0) @@ -3113,7 +3123,7 @@ class CHandlerInvDropTo : public IActionHandler { CInterfaceGroup *pIG = CWidgetManager::getInstance()->getModalWindow(); if (pIG == NULL) return; - if (pIG->getId() != "ui:interface:bag_choose") return; + if (pIG->getId() != "ui:interface:bag_choose" || pIG->getId() != "ui:interface:hotbar_choose") return; getInventory().beginDrag(NULL, CInventoryManager::TextList); // Special case for choose in bag dialog @@ -3275,8 +3285,8 @@ class CHandlerInvCannotDrop : public IActionHandler if (!getInventory().isDraggingFromTextList()) { CDBCtrlSheet *pCSDst = dynamic_cast(pCaller); - if (!pCSDst->isHotbarSlot()) { - string invPath = getInventory().getDBIndexPath(pCSDst); + string invPath = getInventory().getDBIndexPath(pCSDst); + if (strnicmp(invPath.c_str(),"LOCAL:INVENTORY:HOTBAR",22) != 0) { getInventory().unequip(invPath); } }