mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 07:22:05 +00:00
- Compatibility fix: Classes redefined in DECORATE should cause the newer one to replace the
older one in the type table. SVN r3913 (scripting)
This commit is contained in:
parent
5b8a54e5ee
commit
7171281507
2 changed files with 27 additions and 0 deletions
|
@ -1180,6 +1180,7 @@ void PClass::InsertIntoHash ()
|
||||||
{ // This type has already been inserted
|
{ // This type has already been inserted
|
||||||
// ... but there is no need whatsoever to make it a fatal error!
|
// ... but there is no need whatsoever to make it a fatal error!
|
||||||
Printf (TEXTCOLOR_RED"Tried to register class '%s' more than once.\n", TypeName.GetChars());
|
Printf (TEXTCOLOR_RED"Tried to register class '%s' more than once.\n", TypeName.GetChars());
|
||||||
|
TypeTable.ReplaceType(this, found, bucket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1471,6 +1472,31 @@ PType *FTypeTable::FindType(PClass *metatype, intptr_t parm1, intptr_t parm2, si
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// FTypeTable :: ReplaceType
|
||||||
|
//
|
||||||
|
// Replaces an existing type in the table with a new version of the same
|
||||||
|
// type. For use when redefining actors in DECORATE. Does nothing if the
|
||||||
|
// old version is not in the table.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void FTypeTable::ReplaceType(PType *newtype, PType *oldtype, size_t bucket)
|
||||||
|
{
|
||||||
|
for (PType **type_p = &TypeHash[bucket]; *type_p != NULL; type_p = &(*type_p)->HashNext)
|
||||||
|
{
|
||||||
|
PType *type = *type_p;
|
||||||
|
if (type == oldtype)
|
||||||
|
{
|
||||||
|
newtype->HashNext = type->HashNext;
|
||||||
|
type->HashNext = NULL;
|
||||||
|
*type_p = newtype;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// FTypeTable :: AddType - Fully Parameterized Version
|
// FTypeTable :: AddType - Fully Parameterized Version
|
||||||
|
|
|
@ -561,6 +561,7 @@ struct FTypeTable
|
||||||
PType *TypeHash[HASH_SIZE];
|
PType *TypeHash[HASH_SIZE];
|
||||||
|
|
||||||
PType *FindType(PClass *metatype, intptr_t parm1, intptr_t parm2, size_t *bucketnum);
|
PType *FindType(PClass *metatype, intptr_t parm1, intptr_t parm2, size_t *bucketnum);
|
||||||
|
void ReplaceType(PType *newtype, PType *oldtype, size_t bucket);
|
||||||
void AddType(PType *type, PClass *metatype, intptr_t parm1, intptr_t parm2, size_t bucket);
|
void AddType(PType *type, PClass *metatype, intptr_t parm1, intptr_t parm2, size_t bucket);
|
||||||
void AddType(PType *type);
|
void AddType(PType *type);
|
||||||
void Mark();
|
void Mark();
|
||||||
|
|
Loading…
Reference in a new issue