From 30a21710801b367e904cceb5b15e636173593d05 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 12 Nov 2016 10:06:26 +0100 Subject: [PATCH] - let "" be synonymous with 'none' in ZScript. --- src/scripting/codegeneration/codegen.h | 6 +++++- src/scripting/vm/vmexec.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/scripting/codegeneration/codegen.h b/src/scripting/codegeneration/codegen.h index d5f812d52..2f82dba57 100644 --- a/src/scripting/codegeneration/codegen.h +++ b/src/scripting/codegeneration/codegen.h @@ -192,7 +192,11 @@ struct ExpVal FName GetName() const { - if (Type == TypeString) return FName(*(FString *)&pointer); + if (Type == TypeString) + { + if (((FString *)&pointer)->Len() == 0) return NAME_None; + return FName(*(FString *)&pointer); + } return Type == TypeName ? ENamedName(Int) : NAME_None; } }; diff --git a/src/scripting/vm/vmexec.h b/src/scripting/vm/vmexec.h index a6eda2a24..02e0db3de 100644 --- a/src/scripting/vm/vmexec.h +++ b/src/scripting/vm/vmexec.h @@ -1686,7 +1686,7 @@ static void DoCast(const VMRegisters ®, const VMFrame *f, int a, int b, int c case CAST_S2N: ASSERTD(a); ASSERTS(b); - reg.d[a] = FName(reg.s[b]); + reg.d[a] = reg.s[b].Len() == 0? FName(NAME_None) : FName(reg.s[b]); break; case CAST_N2S: