From 1a0faf47619c15575109fd315e5770cd3862e89f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 29 Nov 2015 11:41:14 +0100 Subject: [PATCH] - allow optional decal generator definitions. --- src/decallib.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/decallib.cpp b/src/decallib.cpp index 08b4dfda20..14b824a7b7 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -603,16 +603,17 @@ void FDecalLib::ParseGenerator (FScanner &sc) { const PClass *type; FDecalBase *decal; - AActor *actor; + bool optional = false; // Get name of generator (actor) sc.MustGetString (); + optional = sc.Compare("optional"); + type = PClass::FindClass (sc.String); if (type == NULL || type->ActorInfo == NULL) { - sc.ScriptError ("%s is not an actor.", sc.String); + if (!optional) sc.ScriptError ("%s is not an actor.", sc.String); } - actor = (AActor *)type->Defaults; // Get name of generated decal sc.MustGetString (); @@ -628,11 +629,14 @@ void FDecalLib::ParseGenerator (FScanner &sc) sc.ScriptError ("%s has not been defined.", sc.String); } } - - actor->DecalGenerator = decal; - if (decal != NULL) + if (type != NULL) { - decal->Users.Push (type); + AActor *actor = (AActor *)type->Defaults; + actor->DecalGenerator = decal; + if (decal != NULL) + { + decal->Users.Push(type); + } } }