Add road stop variables for one-way road info

This commit is contained in:
Jonathan G Rennison
2022-02-25 14:41:07 +00:00
parent d7bc18e5ac
commit 2ce5a93527
5 changed files with 39 additions and 0 deletions

View File

@@ -119,6 +119,7 @@
<tr><td>animation_frame</td><td>0..255</td><td>Animation frame of the current tile</td></tr> <tr><td>animation_frame</td><td>0..255</td><td>Animation frame of the current tile</td></tr>
<tr><td>waiting_triggers</td><td>0..255</td><td>Waiting triggers</td></tr> <tr><td>waiting_triggers</td><td>0..255</td><td>Waiting triggers</td></tr>
<tr><td>random_bits</td><td>0..16777215</td><td>Random bits</td></tr> <tr><td>random_bits</td><td>0..16777215</td><td>Random bits</td></tr>
<tr><td>one_way_info</td><td>RST_OWI_XXX</td><td>One-way road information of drive-through stop tile<br />XXX = TWO_WAY | NORTH_BOUND | SOUTH_BOUND | NO_ENTRY</td></tr>
</table> </table>
<br /> <br />
Variables that require one or more parameters: Variables that require one or more parameters:
@@ -142,6 +143,7 @@
<tr><td>nearby_tile_view</td><td>x, y offset (-8..7)</td><td>0..5</td><td>The <a href="#roadstop_views">view/rotation</a> of a nearby road stop tile</td></tr> <tr><td>nearby_tile_view</td><td>x, y offset (-8..7)</td><td>0..5</td><td>The <a href="#roadstop_views">view/rotation</a> of a nearby road stop tile</td></tr>
<tr><td>nearby_tile_stop_type</td><td>x, y offset (-8..7)</td><td>RST_TYPE_XXX</td><td>See stop_type</td></tr> <tr><td>nearby_tile_stop_type</td><td>x, y offset (-8..7)</td><td>RST_TYPE_XXX</td><td>See stop_type</td></tr>
<tr><td>nearby_tile_same_stop_type</td><td>x, y offset (-8..7)</td><td>0 | 1</td><td>Is the stop type of a nearby road stop tile the same as this tile?</td></tr> <tr><td>nearby_tile_same_stop_type</td><td>x, y offset (-8..7)</td><td>0 | 1</td><td>Is the stop type of a nearby road stop tile the same as this tile?</td></tr>
<tr><td>nearby_tile_one_way_info</td><td>x, y offset (-8..7)</td><td>RST_OWI_XXX</td><td>One-way state of nearby drive-through road stop tile</td></tr>
<tr><td>nearby_tile_road_stop_info</td><td>x, y offset (-8..7)</td><td></td><td>Above nearby road stop tile variables in one variable (all of variable 0x68)</td></tr> <tr><td>nearby_tile_road_stop_info</td><td>x, y offset (-8..7)</td><td></td><td>Above nearby road stop tile variables in one variable (all of variable 0x68)</td></tr>
<tr><td>nearby_tile_grfid</td><td>x, y offset (-8..7)</td><td>-1, 0 or a GRFID</td><td>Return value is -1 if the tile is not a road stop, 0 if the tile is a non-custom road stop, or else the GRFID of the NewGRF defining the road stop</td></tr> <tr><td>nearby_tile_grfid</td><td>x, y offset (-8..7)</td><td>-1, 0 or a GRFID</td><td>Return value is -1 if the tile is not a road stop, 0 if the tile is a non-custom road stop, or else the GRFID of the NewGRF defining the road stop</td></tr>
</table> </table>

View File

@@ -208,6 +208,7 @@
<tr><td><a href="#roadstop_company_info">47</a></td><td><a href="#roadstop_company_info">roadstop_company_info</a></td><td>Player/company info</td></tr> <tr><td><a href="#roadstop_company_info">47</a></td><td><a href="#roadstop_company_info">roadstop_company_info</a></td><td>Player/company info</td></tr>
<tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">48</a></td><td></td><td>Bitmask of accepted cargoes (BaseStation)</td></tr> <tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">48</a></td><td></td><td>Bitmask of accepted cargoes (BaseStation)</td></tr>
<tr><td><a href="#roadstop_animation_frame">49</a></td><td><a href="#roadstop_animation_frame">roadstop_animation_frame</a></td><td>Current animation frame</td></tr> <tr><td><a href="#roadstop_animation_frame">49</a></td><td><a href="#roadstop_animation_frame">roadstop_animation_frame</a></td><td>Current animation frame</td></tr>
<tr><td><a href="#roadstop_misc_info">50</a></td><td><a href="#roadstop_misc_info">roadstop_misc_info</a></td><td>Miscellaneous info</td></tr>
<tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">60</a></td><td></td><td>Amount of cargo waiting (BaseStation)</td></tr> <tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">60</a></td><td></td><td>Amount of cargo waiting (BaseStation)</td></tr>
<tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">61</a></td><td></td><td>Time since last cargo pickup (BaseStation)</td></tr> <tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">61</a></td><td></td><td>Time since last cargo pickup (BaseStation)</td></tr>
<tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">62</a></td><td></td><td>Rating of cargo (BaseStation)</td></tr> <tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">62</a></td><td></td><td>Rating of cargo (BaseStation)</td></tr>
@@ -269,6 +270,22 @@
<h4 id="roadstop_animation_frame">Current animation frame (49, or mappable variable: roadstop_animation_frame)</h4> <h4 id="roadstop_animation_frame">Current animation frame (49, or mappable variable: roadstop_animation_frame)</h4>
<p>This has the same value as <a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Stations">station (feature 4) variable 4A</a>.</p> <p>This has the same value as <a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Stations">station (feature 4) variable 4A</a>.</p>
<h4 id="roadstop_misc_info">Miscellaneous road stop info (50, or mappable variable: roadstop_misc_info)</h4>
<p>The town used is the one associated with the station/waypoint (this is in the station/waypoint name by default).
<table>
<tr><th>Bits</th><th>Meaning</th></tr>
<tr><td>0 - 1</td><td>
One-way road information:<br />
0 - Two-way traffic<br />
1 - North-bound only<br />
2 - South-bound only<br />
3 - No entry
</td></tr>
</table>
<br />
The remaining bits are reserved for future use and should be masked.
</p>
<h4 id="roadstop_animation_frame_nearby_tiles">Animation frame of nearby tile (66, or mappable variable: roadstop_animation_frame_nearby_tiles)</h4> <h4 id="roadstop_animation_frame_nearby_tiles">Animation frame of nearby tile (66, or mappable variable: roadstop_animation_frame_nearby_tiles)</h4>
<p>This has the same value as <a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Stations#Animation_frame_of_nearby_tile_.2866.29">station (feature 4) variable 66</a>.</p> <p>This has the same value as <a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Stations#Animation_frame_of_nearby_tile_.2866.29">station (feature 4) variable 66</a>.</p>
@@ -295,6 +312,12 @@
2 - Road waypoint 2 - Road waypoint
</td></tr> </td></tr>
<tr><td>20</td><td>Set if the stop type (passenger/bus, freight/lorry or road waypoint) is the same as the current tile</td></tr> <tr><td>20</td><td>Set if the stop type (passenger/bus, freight/lorry or road waypoint) is the same as the current tile</td></tr>
<tr><td>21 - 22</td><td>
One-way road information of the selected tile:<br />
0 - Two-way traffic<br />
1 - North-bound only<br />
2 - South-bound only<br />
3 - No entry
</table> </table>
<br /> <br />
The remaining bits are reserved for future use and should be masked. The remaining bits are reserved for future use and should be masked.

View File

@@ -120,6 +120,7 @@ extern const GRFVariableMapDefinition _grf_action2_remappable_variables[] = {
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x46, "roadstop_town_distance_squared"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x46, "roadstop_town_distance_squared"),
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x47, "roadstop_company_info"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x47, "roadstop_company_info"),
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x49, "roadstop_animation_frame"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x49, "roadstop_animation_frame"),
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x50, "roadstop_misc_info"),
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x66, "roadstop_animation_frame_nearby_tiles"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x66, "roadstop_animation_frame_nearby_tiles"),
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x67, "roadstop_land_info_nearby_tiles"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x67, "roadstop_land_info_nearby_tiles"),
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x68, "roadstop_road_stop_info_nearby_tiles"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x68, "roadstop_road_stop_info_nearby_tiles"),

View File

@@ -121,6 +121,15 @@ uint32 RoadStopScopeResolver::GetVariable(uint16 variable, uint32 parameter, Get
/* Animation frame */ /* Animation frame */
case 0x49: return this->tile == INVALID_TILE ? 0 : this->st->GetRoadStopAnimationFrame(this->tile); case 0x49: return this->tile == INVALID_TILE ? 0 : this->st->GetRoadStopAnimationFrame(this->tile);
/* Misc info */
case 0x50: {
uint32 result = 0;
if (this->tile != INVALID_TILE) {
if (IsDriveThroughStopTile(this->tile)) result |= GetDriveThroughStopDisallowedRoadDirections(this->tile);
}
return result;
}
/* Variables which use the parameter */ /* Variables which use the parameter */
/* Variables 0x60 to 0x65 and 0x69 are handled separately below */ /* Variables 0x60 to 0x65 and 0x69 are handled separately below */
@@ -160,6 +169,9 @@ uint32 RoadStopScopeResolver::GetVariable(uint16 variable, uint32 parameter, Get
const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)];
res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ssl.localidx; res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ssl.localidx;
} }
if (IsDriveThroughStopTile(nearby_tile)) {
res |= (GetDriveThroughStopDisallowedRoadDirections(nearby_tile) << 21);
}
return res; return res;
} }

View File

@@ -1391,6 +1391,7 @@ static const NIVariable _nif_roadstops[] = {
NIV(0x47, "player info"), NIV(0x47, "player info"),
NIV(0x48, "bitmask of accepted cargoes"), NIV(0x48, "bitmask of accepted cargoes"),
NIV(0x49, "current animation frame"), NIV(0x49, "current animation frame"),
NIV(0x50, "miscellaneous info"),
NIV(0x60, "amount of cargo waiting"), NIV(0x60, "amount of cargo waiting"),
NIV(0x61, "time since last cargo pickup"), NIV(0x61, "time since last cargo pickup"),
NIV(0x62, "rating of cargo"), NIV(0x62, "rating of cargo"),