From a24c7d3f1c394f5627cf31c1d8cac46f43c36923 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 23 Apr 2022 19:44:30 +0300 Subject: [PATCH 34/34] _freeciv_state_dump(): Save by rule_name() when possible The old code was saving all user data by id. That's not right for ruleset objects for which the id might change between version. Save the data based on the methods and properties available for the type. Reported by nef See osdn #44447 Signed-off-by: Marko Lindqvist --- common/scriptcore/tolua_common_a.pkg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/scriptcore/tolua_common_a.pkg b/common/scriptcore/tolua_common_a.pkg index 9c607e0c2b..1db30ce145 100644 --- a/common/scriptcore/tolua_common_a.pkg +++ b/common/scriptcore/tolua_common_a.pkg @@ -144,6 +144,10 @@ function _freeciv_state_dump() res = res .. k .. '=find.' .. method if method == 'city' or method == 'unit' then res = res .. '(nil,' .. string.format("%d", v.id) .. ')' + elseif method == 'disaster' or method == 'achievements' then + res = res .. '(' .. string.format("%d", v.id) .. ')' + elseif type(v.rule_name) == 'function' then + res = res .. '(' .. string.format("'%s'", v.rule_name(v)) .. ')' elseif v.id then res = res .. '(' .. string.format("%d", v.id) .. ')' else -- 2.35.1