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

@@ -120,6 +120,7 @@ extern const GRFVariableMapDefinition _grf_action2_remappable_variables[] = {
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x46, "roadstop_town_distance_squared"),
GRFVariableMapDefinition(GSF_ROADSTOPS, 0x47, "roadstop_company_info"),
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, 0x67, "roadstop_land_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 */
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 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)];
res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ssl.localidx;
}
if (IsDriveThroughStopTile(nearby_tile)) {
res |= (GetDriveThroughStopDisallowedRoadDirections(nearby_tile) << 21);
}
return res;
}

View File

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