GRF: Add generic mechanism to observe which features have been tested

pull/484/head
Jonathan G Rennison 1 year ago
parent 53835cef8e
commit a85b3d7de7

@ -9231,6 +9231,9 @@ struct GRFFeatureTest {
} else {
grfmsg(2, "Action 14 feature test: feature test: doing nothing: %u", has_feature ? 1 : 0);
}
if (this->feature != nullptr && this->feature->observation_flag != GFTOF_INVALID) {
SetBit(_cur.grffile->observed_feature_tests, this->feature->observation_flag);
}
}
};

@ -358,6 +358,8 @@ struct GRFFile : ZeroedMemoryAllocator {
uint32 var8D_overlay; ///< Overlay for global variable 8D (action 0x14)
uint32 var9D_overlay; ///< Overlay for global variable 9D (action 0x14)
uint32 observed_feature_tests; ///< Observed feature test bits (see: GRFFeatureTestObservationFlag)
const SpriteGroup *new_signals_group; ///< New signals sprite group
byte new_signal_ctrl_flags; ///< Ctrl flags for new signals
byte new_signal_extra_aspects; ///< Number of extra aspects for new signals

@ -85,20 +85,27 @@ enum Action2VariableRemapIds {
A2VRI_SIGNALS_SIGNAL_STYLE,
};
enum GRFFeatureTestObservationFlag : uint8 {
GFTOF_INVALID = 0xFF,
};
/** Action14 feature definition */
struct GRFFeatureInfo {
const char *name; // nullptr indicates the end of the list
uint16 version;
GRFFeatureTestObservationFlag observation_flag;
/** Create empty object used to identify the end of a list. */
GRFFeatureInfo() :
name(nullptr),
version(0)
version(0),
observation_flag(GFTOF_INVALID)
{}
GRFFeatureInfo(const char *name, uint16 version) :
GRFFeatureInfo(const char *name, uint16 version, GRFFeatureTestObservationFlag observation_flag = GFTOF_INVALID) :
name(name),
version(version)
version(version),
observation_flag(observation_flag)
{}
};

Loading…
Cancel
Save