From edf17a44cac2b6a0265cf4f8ed0b8d444b853997 Mon Sep 17 00:00:00 2001 From: Ahmed Samy Date: Mon, 6 Jan 2014 14:35:37 +0200 Subject: [PATCH] Code cleanup --- src/client/thingtypemanager.cpp | 35 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/client/thingtypemanager.cpp b/src/client/thingtypemanager.cpp index 00baebf1..e7bf4ce7 100644 --- a/src/client/thingtypemanager.cpp +++ b/src/client/thingtypemanager.cpp @@ -227,30 +227,29 @@ void ThingTypeManager::loadXml(const std::string& file) } } -void ThingTypeManager::parseItemType(uint16 id, TiXmlElement* elem) +void ThingTypeManager::parseItemType(uint16 serverId, TiXmlElement* elem) { - uint16 serverId = id; ItemTypePtr itemType = nullptr; + + bool s; + int d; + if(g_game.getProtocolVersion() < 960) { - if(serverId > 20000 && serverId < 20100) { - serverId -= 20000; - - itemType = ItemTypePtr(new ItemType); - itemType->setServerId(serverId); - addItemType(itemType); - } else - itemType = getItemType(serverId); + s = serverId > 20000 && serverId < 20100; + d = 20000; } else { - if(serverId > 30000 && serverId < 30100) { - serverId -= 30000; - - itemType = ItemTypePtr(new ItemType); - itemType->setServerId(serverId); - addItemType(itemType); - } else - itemType = getItemType(serverId); + s = serverId > 30000 && serverId < 30100; + d = 30000; } + if(s) { + serverId -= d; + itemType = ItemTypePtr(new ItemType); + itemType->setServerId(serverId); + addItemType(itemType); + } else + itemType = getItemType(serverId); + itemType->setName(elem->Attribute("name")); for(TiXmlElement* attrib = elem->FirstChildElement(); attrib; attrib = attrib->NextSiblingElement()) { std::string key = attrib->Attribute("key");