From 5acf18fb37ba1ac6d078aaba18960749661331af Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 11 Mar 2023 02:15:18 +0000 Subject: [PATCH] NewGRF: Allow mapping a feature ID to the town scope --- src/newgrf.cpp | 2 ++ src/newgrf.h | 4 ++-- src/newgrf_extension.cpp | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index f168315954..27462a69df 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5352,6 +5352,7 @@ static const char *_feature_names[] = { "TRAMTYPES", "ROADSTOPS", "NEWLANDSCAPE", + "TOWN", }; static_assert(lengthof(_feature_names) == GSF_END); @@ -5490,6 +5491,7 @@ static void FeatureChangeInfo(ByteReader *buf) /* GSF_TRAMTYPES */ TramTypeChangeInfo, /* GSF_ROADSTOPS */ RoadStopChangeInfo, /* GSF_NEWLANDSCAPE */ NewLandscapeChangeInfo, + /* GSF_FAKE_TOWNS */ nullptr, }; static_assert(GSF_END == lengthof(handler)); static_assert(lengthof(handler) == lengthof(_cur.grffile->action0_property_remaps), "Action 0 feature list length mismatch"); diff --git a/src/newgrf.h b/src/newgrf.h index 6e20fb1c86..5bc269bd26 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -90,12 +90,12 @@ enum GrfSpecFeature : uint8 { GSF_ROADSTOPS, GSF_NEWLANDSCAPE, + GSF_FAKE_TOWNS, ///< Fake (but mappable) town GrfSpecFeature for NewGRF debugging (parent scope), and generic callbacks GSF_END, GSF_REAL_FEATURE_END = GSF_NEWLANDSCAPE, - GSF_FAKE_TOWNS = GSF_END, ///< Fake town GrfSpecFeature for NewGRF debugging (parent scope) - GSF_FAKE_STATION_STRUCT, ///< Fake station struct GrfSpecFeature for NewGRF debugging + GSF_FAKE_STATION_STRUCT = GSF_END, ///< Fake station struct GrfSpecFeature for NewGRF debugging GSF_FAKE_END, ///< End of the fake features GSF_ERROR_ON_USE = 0xFE, ///< An invalid value which generates an immediate error on mapping diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp index 8794260218..c19400b5db 100644 --- a/src/newgrf_extension.cpp +++ b/src/newgrf_extension.cpp @@ -62,6 +62,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = { GRFFeatureInfo("new_landscape", 2), GRFFeatureInfo("more_objects_per_grf", 1, GFTOF_MORE_OBJECTS_PER_GRF), GRFFeatureInfo("more_action2_ids", 1, GFTOF_MORE_ACTION2_IDS), + GRFFeatureInfo("town_feature", 1), GRFFeatureInfo(), }; @@ -69,6 +70,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = { extern const GRFFeatureMapDefinition _grf_remappable_features[] = { GRFFeatureMapDefinition(GSF_ROADSTOPS, "road_stops"), GRFFeatureMapDefinition(GSF_NEWLANDSCAPE, "new_landscape"), + GRFFeatureMapDefinition(GSF_FAKE_TOWNS, "town"), GRFFeatureMapDefinition(), };