From 4a1f36623b54a5eed733a2d91448fd4bc4531a9e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 9 Jun 2018 17:21:55 +0300 Subject: [PATCH] - fixed: flag CVars in ZScript referenced wrong addresses --- src/scripting/backend/codegen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 9aabc3f9e..352955d61 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -6858,10 +6858,10 @@ ExpEmit FxCVar::Emit(VMFunctionBuilder *build) { int *pVal; auto cv = static_cast(CVar); - auto &vcv = cv->ValueVar; - if (vcv == compatflags) pVal = &i_compatflags; - else if (vcv == compatflags2) pVal = &ii_compatflags2; - else pVal = &vcv.Value; + auto vcv = &cv->ValueVar; + if (vcv == &compatflags) pVal = &i_compatflags; + else if (vcv == &compatflags2) pVal = &ii_compatflags2; + else pVal = &vcv->Value; build->Emit(OP_LKP, addr.RegNum, build->GetConstantAddress(pVal)); build->Emit(OP_LW, dest.RegNum, addr.RegNum, nul); build->Emit(OP_SRL_RI, dest.RegNum, dest.RegNum, cv->BitNum);