diff --git a/docs/newgrf-additions-nml.html b/docs/newgrf-additions-nml.html index 5f0562d9b8..b3d9315dce 100644 --- a/docs/newgrf-additions-nml.html +++ b/docs/newgrf-additions-nml.html @@ -45,6 +45,7 @@
  • Object IDs
  • Object properties
  • Object variables
  • +
  • Airport tile variables
  • Global variables properties
  • Replace new sprites
  • Signal graphics using switches
  • @@ -382,6 +383,17 @@ This is useful for xoring with the tile_slope variable, because if this variable is unavailable then the result is still the underlying tile slope. +

    Airport tile variables

    +

    Variables in the table below which are not supported by the version of OpenTTD being used return a value of 0.

    + + + + +
    VariableValue rangeComment
    airport_id0..255 + Local GRF ID of the airport type. +
    airport_layout0..255 + Airport layout number (as defined in layouts). +

    Global variables properties

    The variables listed below should set inside an item and property block of the form:

     item (FEAT_GLOBALVARS) {
    diff --git a/docs/newgrf-additions.html b/docs/newgrf-additions.html
    index 7b2ef3a1d2..b888fd6a6f 100644
    --- a/docs/newgrf-additions.html
    +++ b/docs/newgrf-additions.html
    @@ -52,6 +52,7 @@
     	
  • Variational Action 2 - Stations
  • Variational Action 2 - Railtypes
  • Variational Action 2 - Objects
  • +
  • Variational Action 2 - Airport tiles
  • Variational Action 2 - Signals (Feature 0E)
  • Callbacks - Ships
  • Action 3 - Objects
  • @@ -882,6 +883,14 @@ This is useful for xoring with bits 8-12 of variable 41, because if this variable is unavailable then the result is still the underlying tile slope.

    This is indicated by the feature name: action0_object_edge_foundation_mode, version 2


    +

    Variational Action 2 - Airport Tiles

    +

    Airport ID (mappable variable: airporttiles_airport_id)

    +

    This is the local GRF ID of the airport type.

    +

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

    +

    Airport layout number (mappable variable: airporttiles_airport_layout)

    +

    This is the airport layout number (as defined in airport property 0A).

    +

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

    +

    Variational Action 2 - Signals (Feature 0E)

    Signal routing restriction information (mappable variable: signals_signal_restriction_info)

    This applies to Action 2/3 Signals (Feature 0E) custom signal sprites.
    diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index e9180cf603..b43fb4733e 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -10,6 +10,7 @@ #include "stdafx.h" #include "debug.h" #include "newgrf_airporttiles.h" +#include "newgrf_extension.h" #include "newgrf_spritegroup.h" #include "newgrf_sound.h" #include "station_base.h" @@ -192,6 +193,12 @@ static uint32 GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint32 /* Get airport tile ID at offset */ case 0x62: return GetAirportTileIDAtOffset(GetNearbyTile(parameter, this->tile), this->st, this->ro.grffile->grfid); + + case A2VRI_AIRPORTTILES_AIRPORT_LAYOUT: + return this->st->airport.layout; + + case A2VRI_AIRPORTTILES_AIRPORT_ID: + return this->st->airport.GetSpec()->grf_prop.local_id; } DEBUG(grf, 1, "Unhandled airport tile variable 0x%X", variable); diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp index 6d6a9d718c..518f0dd65b 100644 --- a/src/newgrf_extension.cpp +++ b/src/newgrf_extension.cpp @@ -61,6 +61,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = { GRFFeatureInfo("action0_object_edge_foundation_mode", 2), GRFFeatureInfo("action0_object_flood_resistant", 1), GRFFeatureInfo("action0_object_viewport_map_tile_type", 1), + GRFFeatureInfo("varaction2_airporttiles_airport_info", 1), GRFFeatureInfo("road_stops", 9, GFTOF_ROAD_STOPS), GRFFeatureInfo("new_landscape", 2), GRFFeatureInfo("more_objects_per_grf", 1), @@ -179,6 +180,8 @@ extern const GRFVariableMapDefinition _grf_action2_remappable_variables[] = { GRFVariableMapDefinition(GSF_SIGNALS, A2VRI_SIGNALS_SIGNAL_STYLE, "signals_signal_style"), GRFVariableMapDefinition(GSF_SIGNALS, A2VRI_SIGNALS_SIGNAL_SIDE, "signals_signal_side"), GRFVariableMapDefinition(GSF_SIGNALS, A2VRI_SIGNALS_SIGNAL_VERTICAL_CLEARANCE, "signals_signal_vertical_clearance"), + GRFVariableMapDefinition(GSF_AIRPORTTILES, A2VRI_AIRPORTTILES_AIRPORT_LAYOUT, "airporttiles_airport_layout"), + GRFVariableMapDefinition(GSF_AIRPORTTILES, A2VRI_AIRPORTTILES_AIRPORT_ID, "airporttiles_airport_id"), GRFVariableMapDefinition(GSF_FAKE_TOWNS, A2VRI_TOWNS_HOUSE_COUNT, "town_house_count"), GRFVariableMapDefinition(GSF_FAKE_TOWNS, A2VRI_TOWNS_POPULATION, "town_population"), GRFVariableMapDefinition(GSF_FAKE_TOWNS, A2VRI_TOWNS_ZONE_0, "town_zone_0_radius_square"), diff --git a/src/newgrf_extension.h b/src/newgrf_extension.h index 3df941fcac..939beadd44 100644 --- a/src/newgrf_extension.h +++ b/src/newgrf_extension.h @@ -91,6 +91,8 @@ enum Action2VariableRemapIds { A2VRI_SIGNALS_SIGNAL_STYLE, A2VRI_SIGNALS_SIGNAL_SIDE, A2VRI_SIGNALS_SIGNAL_VERTICAL_CLEARANCE, + A2VRI_AIRPORTTILES_AIRPORT_LAYOUT, + A2VRI_AIRPORTTILES_AIRPORT_ID, A2VRI_TOWNS_HOUSE_COUNT, A2VRI_TOWNS_POPULATION, A2VRI_TOWNS_ZONE_0, diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 41b3a0a06b..996ed494e4 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -1702,6 +1702,19 @@ static const NICallback _nic_airporttiles[] = { NIC_END() }; +static const NIVariable _niv_airporttiles[] = { + NIV(0x41, "ground type"), + NIV(0x42, "current town zone in nearest town"), + NIV(0x43, "relative position"), + NIV(0x44, "animation frame"), + NIV(0x60, "land info of nearby tiles"), + NIV(0x61, "animation stage of nearby tiles"), + NIV(0x62, "get industry or airport tile ID at offset"), + NIV(A2VRI_AIRPORTTILES_AIRPORT_LAYOUT, "airport layout"), + NIV(A2VRI_AIRPORTTILES_AIRPORT_ID, "airport local ID"), + NIV_END() +}; + class NIHAirportTile : public NIHelper { bool IsInspectable(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != nullptr; } uint GetParent(uint index) const override { return GetTownInspectWindowNumber(Station::GetByTile(index)->town); } @@ -1733,7 +1746,7 @@ class NIHAirportTile : public NIHelper { static const NIFeature _nif_airporttile = { nullptr, _nic_airporttiles, - _niv_industrytiles, // Yes, they share this (at least now) + _niv_airporttiles, new NIHAirportTile(), };