mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
Add airport tile variables to get airport type local ID and layout
This commit is contained in:
parent
e72744cc77
commit
a0e3885acc
@ -45,6 +45,7 @@
|
|||||||
<li><a href="#object-ids">Object IDs</a></li>
|
<li><a href="#object-ids">Object IDs</a></li>
|
||||||
<li><a href="#object-properties">Object properties</a></li>
|
<li><a href="#object-properties">Object properties</a></li>
|
||||||
<li><a href="#object-variables">Object variables</a></li>
|
<li><a href="#object-variables">Object variables</a></li>
|
||||||
|
<li><a href="#airport-tile-variables">Airport tile variables</a></li>
|
||||||
<li><a href="#global-variable-properties">Global variables properties</a></li>
|
<li><a href="#global-variable-properties">Global variables properties</a></li>
|
||||||
<li><a href="#replace-new-sprites">Replace new sprites</a></li>
|
<li><a href="#replace-new-sprites">Replace new sprites</a></li>
|
||||||
<li><a href="#signal-graphics">Signal graphics using switches</a></li>
|
<li><a href="#signal-graphics">Signal graphics using switches</a></li>
|
||||||
@ -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.
|
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.
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
<h3 id="airport-tile-variables"><a href="https://newgrf-specs.tt-wiki.net/wiki/NML:Airports#Airport_tile_variables">Airport tile variables</a></h3>
|
||||||
|
<p>Variables in the table below which are not supported by the version of OpenTTD being used return a value of 0.</p>
|
||||||
|
<table>
|
||||||
|
<tr><th>Variable</th><th>Value range</th><th>Comment</th></tr>
|
||||||
|
<tr><td>airport_id</td><td>0..255</td><td>
|
||||||
|
Local GRF ID of the airport type.
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>airport_layout</td><td>0..255</td><td>
|
||||||
|
Airport layout number (as defined in layouts).
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
<h3 id="global-variable-properties">Global variables properties</h3>
|
<h3 id="global-variable-properties">Global variables properties</h3>
|
||||||
<p>The variables listed below should set inside an item and property block of the form:<pre class="code">
|
<p>The variables listed below should set inside an item and property block of the form:<pre class="code">
|
||||||
item (FEAT_GLOBALVARS) {
|
item (FEAT_GLOBALVARS) {
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
<li><a href="#varaction2_station">Variational Action 2 - Stations</a></li>
|
<li><a href="#varaction2_station">Variational Action 2 - Stations</a></li>
|
||||||
<li><a href="#varaction2_railtypes">Variational Action 2 - Railtypes</a></li>
|
<li><a href="#varaction2_railtypes">Variational Action 2 - Railtypes</a></li>
|
||||||
<li><a href="#varaction2_object">Variational Action 2 - Objects</a></li>
|
<li><a href="#varaction2_object">Variational Action 2 - Objects</a></li>
|
||||||
|
<li><a href="#varaction2_airporttiles">Variational Action 2 - Airport tiles</a></li>
|
||||||
<li><a href="#varaction2_signals">Variational Action 2 - Signals (Feature 0E)</a></li>
|
<li><a href="#varaction2_signals">Variational Action 2 - Signals (Feature 0E)</a></li>
|
||||||
<li><a href="#callbacks_ships">Callbacks - Ships</a></li>
|
<li><a href="#callbacks_ships">Callbacks - Ships</a></li>
|
||||||
<li><a href="#a3objects">Action 3 - Objects</a></li>
|
<li><a href="#a3objects">Action 3 - Objects</a></li>
|
||||||
@ -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.</p>
|
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.</p>
|
||||||
<p>This is indicated by the feature name: <font face="monospace">action0_object_edge_foundation_mode</font>, version 2</p>
|
<p>This is indicated by the feature name: <font face="monospace">action0_object_edge_foundation_mode</font>, version 2</p>
|
||||||
<br />
|
<br />
|
||||||
|
<h3 id="varaction2_airporttiles"><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Airport_Tiles">Variational Action 2 - Airport Tiles</a></h3>
|
||||||
|
<h4 id="airporttiles_airport_id">Airport ID (mappable variable: airporttiles_airport_id)</h4>
|
||||||
|
<p>This is the local GRF ID of the airport type.</p>
|
||||||
|
<p>This is indicated by the feature name: <font face="monospace">varaction2_airporttiles_airport_info</font>, version 1</p>
|
||||||
|
<h4 id="airporttiles_airport_layout">Airport layout number (mappable variable: airporttiles_airport_layout)</h4>
|
||||||
|
<p>This is the airport layout number (as defined in <a href="https://newgrf-specs.tt-wiki.net/wiki/Action0/Airports#Set_airportlayout.28s.29_.280A.29">airport property 0A</a>).</p>
|
||||||
|
<p>This is indicated by the feature name: <font face="monospace">varaction2_airporttiles_airport_info</font>, version 1</p>
|
||||||
|
<br />
|
||||||
<h3 id="varaction2_signals"><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2">Variational Action 2 - Signals (Feature 0E)</a></h3>
|
<h3 id="varaction2_signals"><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2">Variational Action 2 - Signals (Feature 0E)</a></h3>
|
||||||
<h4 id="signals_signal_restriction_info">Signal routing restriction information (mappable variable: signals_signal_restriction_info)</h4>
|
<h4 id="signals_signal_restriction_info">Signal routing restriction information (mappable variable: signals_signal_restriction_info)</h4>
|
||||||
<p>This applies to <a href="#a3signals_custom_signal_sprites">Action 2/3 Signals (Feature 0E) custom signal sprites</a>.<br />
|
<p>This applies to <a href="#a3signals_custom_signal_sprites">Action 2/3 Signals (Feature 0E) custom signal sprites</a>.<br />
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "newgrf_airporttiles.h"
|
#include "newgrf_airporttiles.h"
|
||||||
|
#include "newgrf_extension.h"
|
||||||
#include "newgrf_spritegroup.h"
|
#include "newgrf_spritegroup.h"
|
||||||
#include "newgrf_sound.h"
|
#include "newgrf_sound.h"
|
||||||
#include "station_base.h"
|
#include "station_base.h"
|
||||||
@ -192,6 +193,12 @@ static uint32 GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint32
|
|||||||
|
|
||||||
/* Get airport tile ID at offset */
|
/* Get airport tile ID at offset */
|
||||||
case 0x62: return GetAirportTileIDAtOffset(GetNearbyTile(parameter, this->tile), this->st, this->ro.grffile->grfid);
|
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);
|
DEBUG(grf, 1, "Unhandled airport tile variable 0x%X", variable);
|
||||||
|
@ -61,6 +61,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
|
|||||||
GRFFeatureInfo("action0_object_edge_foundation_mode", 2),
|
GRFFeatureInfo("action0_object_edge_foundation_mode", 2),
|
||||||
GRFFeatureInfo("action0_object_flood_resistant", 1),
|
GRFFeatureInfo("action0_object_flood_resistant", 1),
|
||||||
GRFFeatureInfo("action0_object_viewport_map_tile_type", 1),
|
GRFFeatureInfo("action0_object_viewport_map_tile_type", 1),
|
||||||
|
GRFFeatureInfo("varaction2_airporttiles_airport_info", 1),
|
||||||
GRFFeatureInfo("road_stops", 9, GFTOF_ROAD_STOPS),
|
GRFFeatureInfo("road_stops", 9, GFTOF_ROAD_STOPS),
|
||||||
GRFFeatureInfo("new_landscape", 2),
|
GRFFeatureInfo("new_landscape", 2),
|
||||||
GRFFeatureInfo("more_objects_per_grf", 1),
|
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_STYLE, "signals_signal_style"),
|
||||||
GRFVariableMapDefinition(GSF_SIGNALS, A2VRI_SIGNALS_SIGNAL_SIDE, "signals_signal_side"),
|
GRFVariableMapDefinition(GSF_SIGNALS, A2VRI_SIGNALS_SIGNAL_SIDE, "signals_signal_side"),
|
||||||
GRFVariableMapDefinition(GSF_SIGNALS, A2VRI_SIGNALS_SIGNAL_VERTICAL_CLEARANCE, "signals_signal_vertical_clearance"),
|
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_HOUSE_COUNT, "town_house_count"),
|
||||||
GRFVariableMapDefinition(GSF_FAKE_TOWNS, A2VRI_TOWNS_POPULATION, "town_population"),
|
GRFVariableMapDefinition(GSF_FAKE_TOWNS, A2VRI_TOWNS_POPULATION, "town_population"),
|
||||||
GRFVariableMapDefinition(GSF_FAKE_TOWNS, A2VRI_TOWNS_ZONE_0, "town_zone_0_radius_square"),
|
GRFVariableMapDefinition(GSF_FAKE_TOWNS, A2VRI_TOWNS_ZONE_0, "town_zone_0_radius_square"),
|
||||||
|
@ -91,6 +91,8 @@ enum Action2VariableRemapIds {
|
|||||||
A2VRI_SIGNALS_SIGNAL_STYLE,
|
A2VRI_SIGNALS_SIGNAL_STYLE,
|
||||||
A2VRI_SIGNALS_SIGNAL_SIDE,
|
A2VRI_SIGNALS_SIGNAL_SIDE,
|
||||||
A2VRI_SIGNALS_SIGNAL_VERTICAL_CLEARANCE,
|
A2VRI_SIGNALS_SIGNAL_VERTICAL_CLEARANCE,
|
||||||
|
A2VRI_AIRPORTTILES_AIRPORT_LAYOUT,
|
||||||
|
A2VRI_AIRPORTTILES_AIRPORT_ID,
|
||||||
A2VRI_TOWNS_HOUSE_COUNT,
|
A2VRI_TOWNS_HOUSE_COUNT,
|
||||||
A2VRI_TOWNS_POPULATION,
|
A2VRI_TOWNS_POPULATION,
|
||||||
A2VRI_TOWNS_ZONE_0,
|
A2VRI_TOWNS_ZONE_0,
|
||||||
|
@ -1702,6 +1702,19 @@ static const NICallback _nic_airporttiles[] = {
|
|||||||
NIC_END()
|
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 {
|
class NIHAirportTile : public NIHelper {
|
||||||
bool IsInspectable(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != nullptr; }
|
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); }
|
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 = {
|
static const NIFeature _nif_airporttile = {
|
||||||
nullptr,
|
nullptr,
|
||||||
_nic_airporttiles,
|
_nic_airporttiles,
|
||||||
_niv_industrytiles, // Yes, they share this (at least now)
|
_niv_airporttiles,
|
||||||
new NIHAirportTile(),
|
new NIHAirportTile(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user