Skip to content

Commit fff9c58

Browse files
committed
mkclass: inherit from Object like this: class T : virtual public Object
This allows .ti classes multiple inheritance from Object.
1 parent 69d2a04 commit fff9c58

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/config/configitem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ ConfigObject::Ptr ConfigItem::Commit(bool discard)
177177
if (IsAbstract())
178178
return nullptr;
179179

180-
ConfigObject::Ptr dobj = static_pointer_cast<ConfigObject>(type->Instantiate(std::vector<Value>()));
180+
ConfigObject::Ptr dobj = dynamic_pointer_cast<ConfigObject>(type->Instantiate(std::vector<Value>()));
181181

182182
dobj->SetDebugInfo(m_DebugInfo);
183183
dobj->SetZoneName(m_Zone);

tools/mkclass/classcompiler.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,15 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
452452

453453
/* ObjectImpl */
454454
m_Header << "template<>" << std::endl
455-
<< "class ObjectImpl<" << klass.Name << ">"
456-
<< " : public " << (klass.Parent.empty() ? "Object" : klass.Parent) << std::endl
455+
<< "class ObjectImpl<" << klass.Name << "> : ";
456+
457+
if (klass.Parent.empty()) {
458+
m_Header << "virtual public Object";
459+
} else {
460+
m_Header << "public " << klass.Parent;
461+
}
462+
463+
m_Header << std::endl
457464
<< "{" << std::endl
458465
<< "public:" << std::endl
459466
<< "\t" << "DECLARE_PTR_TYPEDEFS(ObjectImpl<" << klass.Name << ">);" << std::endl << std::endl;

0 commit comments

Comments
 (0)