Add ScriptingTypeHandle::IsSubclassOf

This commit is contained in:
Wojtek Figat
2021-10-23 16:42:41 +02:00
parent 7a0e2c01d4
commit f87544bbaf
2 changed files with 14 additions and 0 deletions

View File

@@ -53,6 +53,19 @@ const ScriptingType& ScriptingTypeHandle::GetType() const
return Module->Types[TypeIndex];
}
bool ScriptingTypeHandle::IsSubclassOf(ScriptingTypeHandle c) const
{
auto type = *this;
if (type == c)
return false;
for (; type; type = type.GetType().GetBaseType())
{
if (type == c)
return true;
}
return false;
}
bool ScriptingTypeHandle::IsAssignableFrom(ScriptingTypeHandle c) const
{
while (c)