Minor fixes

--HG--
branch : item_group
This commit is contained in:
Guillaume Dupuy 2017-03-16 12:47:36 +01:00
parent 1d36ea9acc
commit 08306e6a69

View file

@ -117,7 +117,7 @@ void CItemGroup::readFrom(xmlNodePtr node)
std::string slot; std::string slot;
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);
nlinfo("Got a slot %s", slot.c_str()); slot = NLMISC::toUpper(slot);
if(SLOTTYPE::stringToSlotType(slot) != SLOTTYPE::UNDEFINED) if(SLOTTYPE::stringToSlotType(slot) != SLOTTYPE::UNDEFINED)
removeBeforeEquip.push_back(SLOTTYPE::stringToSlotType(slot)); removeBeforeEquip.push_back(SLOTTYPE::stringToSlotType(slot));
} }
@ -339,7 +339,6 @@ bool CItemGroupManager::equipGroup(std::string name, bool pullBefore)
for(int i=0; i < group->removeBeforeEquip.size(); i++) for(int i=0; i < group->removeBeforeEquip.size(); i++)
{ {
SLOTTYPE::TSlotType slot = group->removeBeforeEquip[i]; SLOTTYPE::TSlotType slot = group->removeBeforeEquip[i];
nlinfo("removing slot %d", slot);
std::string dbPath; std::string dbPath;
if(slot > SLOTTYPE::RIGHT_HAND) if(slot > SLOTTYPE::RIGHT_HAND)
dbPath = "LOCAL:INVENTORY:HAND:"; dbPath = "LOCAL:INVENTORY:HAND:";
@ -347,7 +346,6 @@ bool CItemGroupManager::equipGroup(std::string name, bool pullBefore)
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 //offset by 1 : TSlotType begins at 1 for actual items (because of UNDEFINED), whereas dbPath start at 0
dbPath += NLMISC::toString((uint8)slot - 1); dbPath += NLMISC::toString((uint8)slot - 1);
nlinfo("Removing path %s", dbPath.c_str());
CInventoryManager::getInstance()->unequip(dbPath); CInventoryManager::getInstance()->unequip(dbPath);
} }