NewGRF: Allow mapping a feature ID to the town scope

This commit is contained in:
Jonathan G Rennison
2023-03-11 02:15:18 +00:00
parent 57c5cc32d0
commit 5acf18fb37
3 changed files with 6 additions and 2 deletions

View File

@@ -5352,6 +5352,7 @@ static const char *_feature_names[] = {
"TRAMTYPES", "TRAMTYPES",
"ROADSTOPS", "ROADSTOPS",
"NEWLANDSCAPE", "NEWLANDSCAPE",
"TOWN",
}; };
static_assert(lengthof(_feature_names) == GSF_END); static_assert(lengthof(_feature_names) == GSF_END);
@@ -5490,6 +5491,7 @@ static void FeatureChangeInfo(ByteReader *buf)
/* GSF_TRAMTYPES */ TramTypeChangeInfo, /* GSF_TRAMTYPES */ TramTypeChangeInfo,
/* GSF_ROADSTOPS */ RoadStopChangeInfo, /* GSF_ROADSTOPS */ RoadStopChangeInfo,
/* GSF_NEWLANDSCAPE */ NewLandscapeChangeInfo, /* GSF_NEWLANDSCAPE */ NewLandscapeChangeInfo,
/* GSF_FAKE_TOWNS */ nullptr,
}; };
static_assert(GSF_END == lengthof(handler)); static_assert(GSF_END == lengthof(handler));
static_assert(lengthof(handler) == lengthof(_cur.grffile->action0_property_remaps), "Action 0 feature list length mismatch"); static_assert(lengthof(handler) == lengthof(_cur.grffile->action0_property_remaps), "Action 0 feature list length mismatch");

View File

@@ -90,12 +90,12 @@ enum GrfSpecFeature : uint8 {
GSF_ROADSTOPS, GSF_ROADSTOPS,
GSF_NEWLANDSCAPE, GSF_NEWLANDSCAPE,
GSF_FAKE_TOWNS, ///< Fake (but mappable) town GrfSpecFeature for NewGRF debugging (parent scope), and generic callbacks
GSF_END, GSF_END,
GSF_REAL_FEATURE_END = GSF_NEWLANDSCAPE, GSF_REAL_FEATURE_END = GSF_NEWLANDSCAPE,
GSF_FAKE_TOWNS = GSF_END, ///< Fake town GrfSpecFeature for NewGRF debugging (parent scope) GSF_FAKE_STATION_STRUCT = GSF_END, ///< Fake station struct GrfSpecFeature for NewGRF debugging
GSF_FAKE_STATION_STRUCT, ///< Fake station struct GrfSpecFeature for NewGRF debugging
GSF_FAKE_END, ///< End of the fake features GSF_FAKE_END, ///< End of the fake features
GSF_ERROR_ON_USE = 0xFE, ///< An invalid value which generates an immediate error on mapping GSF_ERROR_ON_USE = 0xFE, ///< An invalid value which generates an immediate error on mapping

View File

@@ -62,6 +62,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
GRFFeatureInfo("new_landscape", 2), GRFFeatureInfo("new_landscape", 2),
GRFFeatureInfo("more_objects_per_grf", 1, GFTOF_MORE_OBJECTS_PER_GRF), GRFFeatureInfo("more_objects_per_grf", 1, GFTOF_MORE_OBJECTS_PER_GRF),
GRFFeatureInfo("more_action2_ids", 1, GFTOF_MORE_ACTION2_IDS), GRFFeatureInfo("more_action2_ids", 1, GFTOF_MORE_ACTION2_IDS),
GRFFeatureInfo("town_feature", 1),
GRFFeatureInfo(), GRFFeatureInfo(),
}; };
@@ -69,6 +70,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
extern const GRFFeatureMapDefinition _grf_remappable_features[] = { extern const GRFFeatureMapDefinition _grf_remappable_features[] = {
GRFFeatureMapDefinition(GSF_ROADSTOPS, "road_stops"), GRFFeatureMapDefinition(GSF_ROADSTOPS, "road_stops"),
GRFFeatureMapDefinition(GSF_NEWLANDSCAPE, "new_landscape"), GRFFeatureMapDefinition(GSF_NEWLANDSCAPE, "new_landscape"),
GRFFeatureMapDefinition(GSF_FAKE_TOWNS, "town"),
GRFFeatureMapDefinition(), GRFFeatureMapDefinition(),
}; };