From 06da7545acd6caf13abaf2940078500e81837e93 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 24 Mar 2021 23:52:51 +0200 Subject: [PATCH 38/38] Introduce RSFORMAT_3_2 macro to use instead of Magic Number Use macro RSFORMAT_3_2 instead of value 30 when referring to format version of the current freeciv version. See osdn #41853 Signed-off-by: Marko Lindqvist --- server/rscompat.c | 4 ++-- server/ruleset.h | 2 ++ tools/ruleutil/rulesave.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/rscompat.c b/server/rscompat.c index 020d6f95f3..064f29f904 100644 --- a/server/rscompat.c +++ b/server/rscompat.c @@ -294,7 +294,7 @@ void rscompat_postprocess(struct rscompat_info *info) * the new effects from being upgraded by accident. */ iterate_effect_cache(effect_list_compat_cb, info); - if (info->ver_effects < 30) { + if (info->ver_effects < RSFORMAT_3_2) { struct effect *peffect; /* Nuke blast radius has moved to the ruleset. */ @@ -335,7 +335,7 @@ enum impr_genus_id rscompat_genus_3_2(struct rscompat_info *compat, const bv_impr_flags flags, enum impr_genus_id old_genus) { - if (compat->compat_mode && compat->ver_buildings < 30) { + if (compat->compat_mode && compat->ver_buildings < RSFORMAT_3_2) { if (BV_ISSET(flags, IF_GOLD) && IG_SPECIAL == old_genus) { return IG_CONVERT; } diff --git a/server/ruleset.h b/server/ruleset.h index 13d62ebd29..09cf04ceb5 100644 --- a/server/ruleset.h +++ b/server/ruleset.h @@ -33,6 +33,8 @@ extern "C" { * - ruleset of the development version at the given data */ +#define RSFORMAT_3_2 30 + struct conn_list; typedef void (*rs_conversion_logger)(const char *msg); diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index d803cf0403..9eab9123b6 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -47,7 +47,7 @@ * 20 - Freeciv-3.1 * 30 - Freeciv-3.2 */ -#define FORMAT_VERSION 30 +#define FORMAT_VERSION RSFORMAT_3_2 /**********************************************************************//** Create new ruleset section file with common header. -- 2.30.2