From 65c4653f59b23d5ecc9de17360fbf42ba2ade66c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 23 Feb 2017 19:03:31 +0100 Subject: [PATCH] - restored some code in PClass::CreateDerivedClass that accidentally got removed. --- src/dobjtype.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 6684776da..75193b868 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -3219,16 +3219,24 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size) const PClass *existclass = FindClass(name); - // This is a placeholder so fill it in - if (existclass != NULL && existclass->Size == (unsigned)-1) + if (existclass != nullptr) { - type = const_cast(existclass); - if (!IsDescendantOf(type->ParentClass)) + // This is a placeholder so fill it in + if (existclass->Size == TentativeClass) { - I_Error("%s must inherit from %s but doesn't.", name.GetChars(), type->ParentClass->TypeName.GetChars()); + type = const_cast(existclass); + if (!IsDescendantOf(type->ParentClass)) + { + I_Error("%s must inherit from %s but doesn't.", name.GetChars(), type->ParentClass->TypeName.GetChars()); + } + DPrintf(DMSG_SPAMMY, "Defining placeholder class %s\n", name.GetChars()); + notnew = true; + } + else + { + // a different class with the same name already exists. Let the calling code deal with this. + return nullptr; } - DPrintf(DMSG_SPAMMY, "Defining placeholder class %s\n", name.GetChars()); - notnew = true; } else {