diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2bbbc944a..8894bc936 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4767,25 +4767,19 @@ static void SetActorRoll(AActor *activator, int tid, int angle, bool interpolate } } -static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName telefogdest) +static void SetActorTeleFog(AActor *activator, int tid, FString telefogsrc, FString telefogdest) { - //Simply put, if it doesn't exist, it won't change. One can use "" in this scenario. - const PClass *check; + // Set the actor's telefog to the specified actor. Handle "" as "don't + // change" since "None" should work just fine for disabling the fog (given + // that it will resolve to NAME_None which is not a valid actor name). if (tid == 0) { if (activator != NULL) { - check = PClass::FindClass(telefogsrc); - if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null")) - activator->TeleFogSourceType = NULL; - else - activator->TeleFogSourceType = check; - - check = PClass::FindClass(telefogdest); - if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null")) - activator->TeleFogDestType = NULL; - else - activator->TeleFogDestType = check; + if (telefogsrc.IsNotEmpty()) + activator->TeleFogSourceType = PClass::FindClass(telefogsrc); + if (telefogdest.IsNotEmpty()) + activator->TeleFogDestType = PClass::FindClass(telefogdest); } } else @@ -4793,19 +4787,14 @@ static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName FActorIterator iterator(tid); AActor *actor; + const PClass * const src = telefogsrc.IsNotEmpty() ? PClass::FindClass(telefogsrc) : NULL; + const PClass * const dest = telefogdest.IsNotEmpty() ? PClass::FindClass(telefogdest) : NULL; while ((actor = iterator.Next())) { - check = PClass::FindClass(telefogsrc); - if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null")) - actor->TeleFogSourceType = NULL; - else - actor->TeleFogSourceType = check; - - check = PClass::FindClass(telefogdest); - if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null")) - actor->TeleFogDestType = NULL; - else - actor->TeleFogDestType = check; + if (telefogsrc.IsNotEmpty()) + actor->TeleFogSourceType = src; + if (telefogdest.IsNotEmpty()) + actor->TeleFogDestType = dest; } } } diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 677979276..33066828c 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1422,7 +1422,7 @@ DEFINE_PROPERTY(stamina, I, Actor) DEFINE_PROPERTY(telefogsourcetype, S, Actor) { PROP_STRING_PARM(str, 0); - if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) defaults->TeleFogSourceType = NULL; + if (!stricmp(str, "") || !stricmp(str, "none")) defaults->TeleFogSourceType = NULL; else defaults->TeleFogSourceType = FindClassTentative(str,"TeleportFog"); } @@ -1432,7 +1432,7 @@ DEFINE_PROPERTY(telefogsourcetype, S, Actor) DEFINE_PROPERTY(telefogdesttype, S, Actor) { PROP_STRING_PARM(str, 0); - if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) defaults->TeleFogDestType = NULL; + if (!stricmp(str, "") || !stricmp(str, "none")) defaults->TeleFogDestType = NULL; else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog"); }