Use SLOT_EQUIPEMENT instead of SLOTTYPE

--HG--
branch : item_group
This commit is contained in:
Guillaume Dupuy 2017-03-16 13:36:56 +01:00
parent 08306e6a69
commit 6af0fd168c
2 changed files with 7 additions and 8 deletions

View file

@ -118,8 +118,8 @@ void CItemGroup::readFrom(xmlNodePtr node)
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"slot"); ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"slot");
if (ptrName) NLMISC::fromString((const char*)ptrName, slot); if (ptrName) NLMISC::fromString((const char*)ptrName, slot);
slot = NLMISC::toUpper(slot); slot = NLMISC::toUpper(slot);
if(SLOTTYPE::stringToSlotType(slot) != SLOTTYPE::UNDEFINED) if(SLOT_EQUIPMENT::stringToSlotEquipment(slot) != SLOT_EQUIPMENT::UNDEFINED)
removeBeforeEquip.push_back(SLOTTYPE::stringToSlotType(slot)); removeBeforeEquip.push_back(SLOT_EQUIPMENT::stringToSlotEquipment(slot));
} }
curNode = curNode->next; curNode = curNode->next;
@ -338,14 +338,13 @@ bool CItemGroupManager::equipGroup(std::string name, bool pullBefore)
//Start by unequipping all slot that user wants to unequip //Start by unequipping all slot that user wants to unequip
for(int i=0; i < group->removeBeforeEquip.size(); i++) for(int i=0; i < group->removeBeforeEquip.size(); i++)
{ {
SLOTTYPE::TSlotType slot = group->removeBeforeEquip[i]; SLOT_EQUIPMENT::TSlotEquipment slot = group->removeBeforeEquip[i];
std::string dbPath; std::string dbPath;
if(slot > SLOTTYPE::RIGHT_HAND) if(slot == SLOT_EQUIPMENT::HANDL || slot == SLOT_EQUIPMENT::HANDR)
dbPath = "LOCAL:INVENTORY:HAND:"; dbPath = "LOCAL:INVENTORY:HAND:";
else else
dbPath = "LOCAL:INVENTORY:EQUIP:"; dbPath = "LOCAL:INVENTORY:EQUIP:";
//offset by 1 : TSlotType begins at 1 for actual items (because of UNDEFINED), whereas dbPath start at 0 dbPath += NLMISC::toString((uint8)slot);
dbPath += NLMISC::toString((uint8)slot - 1);
CInventoryManager::getInstance()->unequip(dbPath); CInventoryManager::getInstance()->unequip(dbPath);
} }

View file

@ -21,7 +21,7 @@
#include "interface_v3/inventory_manager.h" #include "interface_v3/inventory_manager.h"
#include "interface_v3/dbctrl_sheet.h" #include "interface_v3/dbctrl_sheet.h"
#include "game_share/inventories.h" #include "game_share/inventories.h"
#include "game_share/slot_types.h" #include "game_share/slot_equipment.h"
struct CInventoryItem { struct CInventoryItem {
public: public:
@ -62,7 +62,7 @@ public:
std::string name; std::string name;
std::vector<CItem> Items; std::vector<CItem> Items;
std::vector<SLOTTYPE::TSlotType> removeBeforeEquip; std::vector<SLOT_EQUIPMENT::TSlotEquipment> removeBeforeEquip;
}; };
class CItemGroupManager { class CItemGroupManager {