Skip to content

Commit

Permalink
#5813: Implement EntityClass::getAttributeType
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 21, 2021
1 parent 6d143d3 commit e4a11d4
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions radiantcore/eclass/EntityClass.cpp
Expand Up @@ -342,7 +342,21 @@ const EntityClassAttribute& EntityClass::getAttribute(const std::string& name, b

const std::string& EntityClass::getAttributeType(const std::string& name) const
{
return _emptyAttribute.getType();
// Check the attributes on this class
const auto& attribute = _attributes.find(name);

if (attribute != _attributes.end())
{
const auto& type = attribute->second.getType();

if (!type.empty())
{
return type;
}
}

// Walk up the inheritance tree until we spot a non-empty type
return _parent ? _parent->getAttributeType(name) : _emptyAttribute.getType();
}

void EntityClass::clear()
Expand Down Expand Up @@ -406,11 +420,6 @@ void EntityClass::parseFromTokens(parser::DefTokeniser& tokeniser)
// Required open brace (the name has already been parsed by the EClassManager)
tokeniser.assertNextToken("{");

if (getName() == "atdm:security_camera01")
{
int i = 6;
}

// Loop over all of the keys in this entitydef
std::string key;
while ((key = tokeniser.nextToken()) != "}")
Expand Down

0 comments on commit e4a11d4

Please sign in to comment.