Introduce g_things.findItemTypeByName

master
Allan Ference 11 years ago
parent 0451fd6b58
commit 5849136526

@ -283,6 +283,14 @@ const ItemTypePtr& ThingTypeManager::findItemTypeByClientId(uint16 id)
return m_nullItemType;
}
const ItemTypePtr& ThingTypeManager::findItemTypeByName(std::string name)
{
for(const ItemTypePtr& it : m_itemTypes)
if(it->getName() == name)
return it;
return m_nullItemType;
}
const ThingTypePtr& ThingTypeManager::getThingType(uint16 id, ThingCategory category)
{
if(category >= ThingLastCategory || id >= m_thingTypes[category].size()) {

@ -43,6 +43,7 @@ public:
void addItemType(const ItemTypePtr& itemType);
const ItemTypePtr& findItemTypeByClientId(uint16 id);
const ItemTypePtr& findItemTypeByName(std::string name);
const ThingTypePtr& getNullThingType() { return m_nullThingType; }
const ItemTypePtr& getNullItemType() { return m_nullItemType; }

Loading…
Cancel
Save