Introduce g_things.findItemTypeByName
This commit is contained in:
parent
0451fd6b58
commit
5849136526
|
@ -283,6 +283,14 @@ const ItemTypePtr& ThingTypeManager::findItemTypeByClientId(uint16 id)
|
||||||
return m_nullItemType;
|
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)
|
const ThingTypePtr& ThingTypeManager::getThingType(uint16 id, ThingCategory category)
|
||||||
{
|
{
|
||||||
if(category >= ThingLastCategory || id >= m_thingTypes[category].size()) {
|
if(category >= ThingLastCategory || id >= m_thingTypes[category].size()) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
|
|
||||||
void addItemType(const ItemTypePtr& itemType);
|
void addItemType(const ItemTypePtr& itemType);
|
||||||
const ItemTypePtr& findItemTypeByClientId(uint16 id);
|
const ItemTypePtr& findItemTypeByClientId(uint16 id);
|
||||||
|
const ItemTypePtr& findItemTypeByName(std::string name);
|
||||||
|
|
||||||
const ThingTypePtr& getNullThingType() { return m_nullThingType; }
|
const ThingTypePtr& getNullThingType() { return m_nullThingType; }
|
||||||
const ItemTypePtr& getNullItemType() { return m_nullItemType; }
|
const ItemTypePtr& getNullItemType() { return m_nullItemType; }
|
||||||
|
|
Loading…
Reference in New Issue