From 5aac77784a002e30209db3e7bdf7cbadbc87e737 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 14 Nov 2022 18:15:58 +0100 Subject: [PATCH] - fix construction of FActorInfo. For some reason this lost the copy constructing part from GZDoom resulting in bad data. --- source/core/actorinfo.cpp | 9 ++++++++- source/core/actorinfo.h | 12 +++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/source/core/actorinfo.cpp b/source/core/actorinfo.cpp index 0cacb321b..9416ff662 100644 --- a/source/core/actorinfo.cpp +++ b/source/core/actorinfo.cpp @@ -77,7 +77,14 @@ public: void InitializeValue(void *addr, const void *def) const override { - new(addr) FActorInfo; + if (def == nullptr) + { + new(addr) FActorInfo; + } + else + { + new(addr) FActorInfo(*(const FActorInfo*)def); + } } void DestroyValue(void *addr) const override diff --git a/source/core/actorinfo.h b/source/core/actorinfo.h index db19e1f31..3c1cc67d5 100644 --- a/source/core/actorinfo.h +++ b/source/core/actorinfo.h @@ -50,7 +50,17 @@ struct FActorInfo TArray SpriteSetNames; FActorInfo() = default; - FActorInfo(const FActorInfo & other) = delete; + FActorInfo(const FActorInfo& other) + { + // only copy the fields that get inherited + TypeNum = other.TypeNum; + DefaultFlags = other.DefaultFlags; + DefaultCstat = other.DefaultCstat; + defsprite = other.defsprite; + PicName = other.PicName; + SpriteSetNames = other.SpriteSetNames; + } + void ResolveTextures(const char* clsname); };