From 74f1309af5310fbfa346048f8ecfc7fe1e8a4571 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 11 Oct 2025 03:09:35 +0100 Subject: Improve gamedata codegen and fix spurious cases The old GAMESPECIFIC mechanism had worked in practice but was technically a little bit incorrect, oops. --- src/feature.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/feature.h') diff --git a/src/feature.h b/src/feature.h index aa3ab9d..af593cf 100644 --- a/src/feature.h +++ b/src/feature.h @@ -39,15 +39,19 @@ /* * Declares that this feature should only be loaded for games matching the given - * gametype tag (see gametype.h). Console variables and commands created using - * DEF_FEAT_* macros will not be registered if SST is loaded by some other game. - * - * As an optimisation, REQUIRE_GAMEDATA() checks (see below) can also be elided - * in cases where gamedata is always present for this particular game. As such, - * it is wise to still specify gamedata dependencies correctly, so that the - * definitions can be changed in the data files without breaking code. + * gametype tag. gametype.h must be included to use this as it defines the tag + * values. Console variables and commands created using DEF_FEAT_* macros will + * not be registered if SST is loaded by some other game. + * + * This also enables a build-time optimisation to elide REQUIRE_GAMEDATA() + * checks as well as has_* conditionals. As such, it is wise to still specify + * gamedata dependencies correctly, so that the definitions can be changed in + * the data files without breaking code. */ -#define GAMESPECIFIC(tag) +#define GAMESPECIFIC(tag) \ + /* impl note: see comment in gamedata.h */ \ + __attribute((unused)) \ + static const int _gamedata_feattags = _gametype_tag_##tag; /* * Indicates that the specified feature is required for this feature to -- cgit v1.2.3-54-g00ecf