From bc007539964fe813fb846e13e9319e037c0fe891 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 6 Jun 2023 21:35:39 +0100 Subject: [PATCH] NewGRF stations: Remove extended version of varuiable 68 --- docs/newgrf-additions.html | 33 +-------------------------------- src/newgrf.cpp | 4 ---- src/newgrf_extension.cpp | 2 -- src/newgrf_extension.h | 4 +--- src/newgrf_optimiser.cpp | 1 - src/newgrf_station.cpp | 8 -------- src/newgrf_station.h | 1 - src/table/newgrf_debug_data.h | 1 - 8 files changed, 2 insertions(+), 52 deletions(-) diff --git a/docs/newgrf-additions.html b/docs/newgrf-additions.html index 10afa2e705..5c86bae574 100644 --- a/docs/newgrf-additions.html +++ b/docs/newgrf-additions.html @@ -782,39 +782,8 @@

Variational Action 2 - Stations

Track type in purchase list (42)

This is indicated by the feature name: varaction2_station_var42, version 1

-

Station info of nearby tiles (68)

-

If feature name varaction2_station_var68_extended_localidx is present and the feature is successfully tested for,
- then the local setID field which would normally be in bits 0..7 (clamped to 0..255), is instead split such that the lower byte is in bits 0..7, and the upper byte is in bits 24..31, such that the variable overall has the format: - - - - - - - - -
BitsMeaning
0 - 7 - If the tile is defined in the current GRF, this is the lower 8 bits of the setID used in the definition. Otherwise, the content is undefined.
- Note that if this GRF has any station setIDs greater than 255, bits 24 - 31 need to be used as well. -
8 - 9 - 0 - The tile uses original TTD graphics
- 1 - The tile is defined in the current GRF
- 2 - The tile is defined in another GRF -
10Set if the selected tile belongs to the current station, clear otherwise
11Clear if the selected tile is parallel with the current one, set if perpendicular to it
12 - 13 - 0 - plain platform
- 1 - platform with building
- 2 - platform with roof, left side
- 3 - platform with roof, right side -
24 - 31 - If the tile is defined in the current GRF, this is the upper 8 bits of the setID used in the definition. Otherwise, the content is undefined.
- This can be ignored if this GRF does not have any station setIDs greater than 255 (does not define more than 256 station types). -
-
- The remaining bits are reserved for future use and should be masked.
- This format requires varaction2_station_var68_extended_localidx, version 1. -

Station info of nearby tiles v2 (mappable variable: station_station_info_nearby_tiles_v2)

-

This has a similar value to 68/Station info of nearby tiles, above.
+

This has a similar value to 68/Station info of nearby tiles.
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index a0da21d2d7..b59210d533 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5988,10 +5988,6 @@ static void NewSpriteGroup(ByteReader *buf) if (adjust.variable == 0x68) adjust.variable = A2VRI_ROADSTOP_INFO_NEARBY_TILES_EXT; if (adjust.variable == 0x7B && adjust.parameter == 0x68) adjust.parameter = A2VRI_ROADSTOP_INFO_NEARBY_TILES_EXT; } - if (info.scope_feature == GSF_STATIONS && HasBit(_cur.grffile->observed_feature_tests, GFTOF_STATION_VAR68_EXT_LOCALIDX)) { - if (adjust.variable == 0x68) adjust.variable = A2VRI_STATION_INFO_NEARBY_TILES_EXT; - if (adjust.variable == 0x7B && adjust.parameter == 0x68) adjust.parameter = A2VRI_STATION_INFO_NEARBY_TILES_EXT; - } if (adjust.type != DSGA_TYPE_NONE) { adjust.add_val = buf->ReadVarSize(varsize); diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp index c6cda5ff9b..f4ff928f61 100644 --- a/src/newgrf_extension.cpp +++ b/src/newgrf_extension.cpp @@ -24,7 +24,6 @@ extern const GRFFeatureInfo _grf_feature_list[] = { GRFFeatureInfo("action0_station_prop1B", 1), GRFFeatureInfo("action0_station_disallowed_bridge_pillars", 1), GRFFeatureInfo("varaction2_station_var42", 1), - GRFFeatureInfo("varaction2_station_var68_extended_localidx", 1, GFTOF_STATION_VAR68_EXT_LOCALIDX), GRFFeatureInfo("varaction2_station_station_nearby_info_v2", 1), GRFFeatureInfo("more_bridge_types", 1), GRFFeatureInfo("action0_bridge_prop14", 1), @@ -199,7 +198,6 @@ extern const GRFVariableMapDefinition _grf_action2_remappable_variables[] = { extern const GRFNameOnlyVariableMapDefinition _grf_action2_internal_variable_names[] = { GRFNameOnlyVariableMapDefinition(A2VRI_VEHICLE_CURRENT_SPEED_SCALED, "current speed scaled"), - GRFNameOnlyVariableMapDefinition(A2VRI_STATION_INFO_NEARBY_TILES_EXT, "68 (extended)"), GRFNameOnlyVariableMapDefinition(A2VRI_ROADSTOP_INFO_NEARBY_TILES_EXT, "68 (extended)"), GRFNameOnlyVariableMapDefinition(), }; diff --git a/src/newgrf_extension.h b/src/newgrf_extension.h index a63ca2da57..3df941fcac 100644 --- a/src/newgrf_extension.h +++ b/src/newgrf_extension.h @@ -76,8 +76,7 @@ enum Action0RemapPropertyIds { enum Action2VariableRemapIds { - A2VRI_STATION_INFO_NEARBY_TILES_EXT = 0x100, - A2VRI_STATION_INFO_NEARBY_TILES_V2, + A2VRI_STATION_INFO_NEARBY_TILES_V2 = 0x100, A2VRI_OBJECT_FOUNDATION_SLOPE, A2VRI_OBJECT_FOUNDATION_SLOPE_CHANGE, A2VRI_VEHICLE_CURRENT_SPEED_SCALED, @@ -108,7 +107,6 @@ enum GRFFeatureTestObservationFlag : uint8 { GFTOF_MORE_VARACTION2_TYPES, GFTOF_MULTI_PART_SHIPS, GFTOF_ROAD_STOPS, - GFTOF_STATION_VAR68_EXT_LOCALIDX, GFTOF_INVALID = 0xFF, }; diff --git a/src/newgrf_optimiser.cpp b/src/newgrf_optimiser.cpp index ca8b35430a..d03177cbc3 100644 --- a/src/newgrf_optimiser.cpp +++ b/src/newgrf_optimiser.cpp @@ -45,7 +45,6 @@ static bool IsExpensiveStationVariable(uint16 variable) case 0x67: case 0x68: case 0x6A: - case A2VRI_STATION_INFO_NEARBY_TILES_EXT: case A2VRI_STATION_INFO_NEARBY_TILES_V2: return true; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 5ae62e23b1..fa1b6ea23f 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -289,9 +289,6 @@ uint32 StationScopeResolver::GetNearbyStationInfo(uint32 parameter, StationScope default: return res | ClampTo(localidx); - case NearbyStationInfoMode::Extended: - return res | (localidx & 0xFF) | ((localidx & 0xFF00) << 16); - case NearbyStationInfoMode::V2: return (res << 8) | localidx; } @@ -389,11 +386,6 @@ uint32 StationScopeResolver::GetNearbyStationInfo(uint32 parameter, StationScope return this->GetNearbyStationInfo(parameter, NearbyStationInfoMode::Standard); } - /* Station info of nearby tiles: extended */ - case A2VRI_STATION_INFO_NEARBY_TILES_EXT: { - return this->GetNearbyStationInfo(parameter, NearbyStationInfoMode::Extended); - } - /* Station info of nearby tiles: v2 */ case A2VRI_STATION_INFO_NEARBY_TILES_V2: { return this->GetNearbyStationInfo(parameter, NearbyStationInfoMode::V2); diff --git a/src/newgrf_station.h b/src/newgrf_station.h index 36991ad58f..1514e4d296 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -50,7 +50,6 @@ struct StationScopeResolver : public ScopeResolver { private: enum class NearbyStationInfoMode { Standard, - Extended, V2, }; uint32 GetNearbyStationInfo(uint32 parameter, NearbyStationInfoMode mode) const; diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 2eaded7671..a5bd7c670f 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -591,7 +591,6 @@ static const NIVariable _niv_stations[] = { NIV(0x68, "station info of nearby tiles"), NIV(0x69, "information about cargo accepted in the past"), NIV(0x6A, "GRFID of nearby station tiles"), - NIVF(A2VRI_STATION_INFO_NEARBY_TILES_EXT, "station info of nearby tiles ext", NIVF_SHOW_PARAMS), NIVF(A2VRI_STATION_INFO_NEARBY_TILES_V2, "station info of nearby tiles v2", NIVF_SHOW_PARAMS), NIV_END() };
BitsMeaning
0 - 15If the tile is defined in the current GRF, this is the setID used in the definition. Otherwise, the content is undefined.