From c98d1ff08c8551d861c1434453ce60c211598e94 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 9 Jun 2019 22:29:51 +0900 Subject: [PATCH] Document some problems with nil While he's a pretty cool character in HZD, he seems to have some identity problems when in a compiler. --- ruamoko/cl_menu/plistmenu.r | 2 +- tools/qfcc/source/problem_with_nil.txt | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tools/qfcc/source/problem_with_nil.txt diff --git a/ruamoko/cl_menu/plistmenu.r b/ruamoko/cl_menu/plistmenu.r index 04d4355b7..d5e722377 100644 --- a/ruamoko/cl_menu/plistmenu.r +++ b/ruamoko/cl_menu/plistmenu.r @@ -142,7 +142,7 @@ string_from_plist (PLString *plstring) local @param ret; local string str = [plstring string]; - ret.quaternion_val = nil; //FIXME should be ret = nil; + ret = nil; //FIXME should be ret = nil; if (str_mid (str, 0, 1) == "[") return rect_from_plist (plstring); diff --git a/tools/qfcc/source/problem_with_nil.txt b/tools/qfcc/source/problem_with_nil.txt new file mode 100644 index 000000000..4172aea0e --- /dev/null +++ b/tools/qfcc/source/problem_with_nil.txt @@ -0,0 +1,12 @@ +The problem with nil is more a problem with @param and values. + +@param values used type_nil's low-level type, which is either quaternion +or vector (v6 progs). Thus returning (or passing?) nil through @param +creates a value that has type_param built low-level type quaternion. +Then assigning nil to a quaternion finds the param nil (because the +value and low-level type is checked) which has the wrong type for type +checks. + +one solution is to create an ev_param type (convert to quaternion or +vector for v6 progs) that the VM either ignores or can copy around +ev_param data.