diff options
| author | 2025-10-11 03:09:35 +0100 | |
|---|---|---|
| committer | 2025-10-11 03:13:18 +0100 | |
| commit | 74f1309af5310fbfa346048f8ecfc7fe1e8a4571 (patch) | |
| tree | f2c8eb715e0caea090fb69abfeaeee1ca55d6d8a /src/feature.h | |
| parent | b447f5879d0c4c49d72f167ed2cf0f1e44a52123 (diff) | |
| download | sst-74f1309af5310fbfa346048f8ecfc7fe1e8a4571.tar.gz sst-74f1309af5310fbfa346048f8ecfc7fe1e8a4571.zip | |
Improve gamedata codegen and fix spurious cases
The old GAMESPECIFIC mechanism had worked in practice but was
technically a little bit incorrect, oops.
Diffstat (limited to 'src/feature.h')
| -rw-r--r-- | src/feature.h | 20 |
1 files changed, 12 insertions, 8 deletions
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 |
