summaryrefslogtreecommitdiff
path: root/src/game-server/itemmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server/itemmanager.cpp')
-rw-r--r--src/game-server/itemmanager.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp
index 074b8343..6840368a 100644
--- a/src/game-server/itemmanager.cpp
+++ b/src/game-server/itemmanager.cpp
@@ -132,16 +132,18 @@ void ItemManager::readEquipSlotsFile()
continue;
}
- bool visible = XML::getBoolProperty(node, "visible", false);
- if (visible)
+ if (slotId > 255)
{
- if (++mVisibleEquipSlotCount > 7)
- {
- LOG_WARN("Item Manager: More than 7 visible equip slot!"
- "This will not work with current netcode!");
- }
+ LOG_WARN("Item Manager: equip slot " << slotId
+ << ": (" << name << ") is superior to 255 "
+ "and has been ignored.");
+ continue;
}
+ bool visible = XML::getBoolProperty(node, "visible", false);
+ if (visible)
+ ++mVisibleEquipSlotCount;
+
EquipSlotsInfo::iterator i = mEquipSlotsInfo.find(slotId);
if (i != mEquipSlotsInfo.end())
@@ -264,6 +266,13 @@ void ItemManager::readEquipNode(xmlNodePtr equipNode, ItemClass *item)
{
if (xmlStrEqual(subNode->name, BAD_CAST "slot"))
{
+ if (item->mEquipReq.equipSlotId)
+ {
+ LOG_WARN("Item Manager: duplicate equip slot definitions!"
+ " Only the first will apply.");
+ break;
+ }
+
std::string slot = XML::getProperty(subNode, "type", std::string());
if (slot.empty())
{
@@ -273,21 +282,23 @@ void ItemManager::readEquipNode(xmlNodePtr equipNode, ItemClass *item)
if (utils::isNumeric(slot))
{
// When the slot id is given
- item->mEquip.push_back(std::make_pair(utils::stringToInt(slot),
- XML::getProperty(subNode, "required", 1)));
+ item->mEquipReq.equipSlotId = utils::stringToInt(slot);
}
else
{
// When its name is given
- item->mEquip.push_back(std::make_pair(getEquipSlotIdFromName(slot),
- XML::getProperty(subNode, "required", 1)));
+ item->mEquipReq.equipSlotId = getEquipSlotIdFromName(slot);
}
+ item->mEquipReq.capacityRequired =
+ XML::getProperty(subNode, "required", 1);
}
}
- if (item->mEquip.empty())
+
+ if (!item->mEquipReq.equipSlotId)
{
LOG_WARN("Item Manager: empty equip requirement "
- "definition for item " << item->getDatabaseID() << "!");
+ "definition for item " << item->getDatabaseID() << "!"
+ " The item will be unequippable.");
return;
}
}