Change: Extend rail types to 64 (6 bit storage)
This commit is contained in:
@@ -157,7 +157,7 @@
|
||||
EnforcePrecondition(false, station_id == ScriptStation::STATION_NEW || station_id == ScriptStation::STATION_JOIN_ADJACENT || ScriptStation::IsValidStation(station_id));
|
||||
|
||||
uint32 p1 = GetCurrentRailType() | (platform_length << 16) | (num_platforms << 8);
|
||||
if (direction == RAILTRACK_NW_SE) p1 |= (1 << 4);
|
||||
if (direction == RAILTRACK_NW_SE) p1 |= (1 << 6);
|
||||
if (station_id != ScriptStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
|
||||
return ScriptObject::DoCommand(tile, p1, (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16, CMD_BUILD_RAIL_STATION);
|
||||
}
|
||||
@@ -176,7 +176,7 @@
|
||||
EnforcePrecondition(false, goal_industry == ScriptIndustryType::INDUSTRYTYPE_UNKNOWN || goal_industry == ScriptIndustryType::INDUSTRYTYPE_TOWN || ScriptIndustryType::IsValidIndustryType(goal_industry));
|
||||
|
||||
uint32 p1 = GetCurrentRailType() | (platform_length << 16) | (num_platforms << 8);
|
||||
if (direction == RAILTRACK_NW_SE) p1 |= 1 << 4;
|
||||
if (direction == RAILTRACK_NW_SE) p1 |= 1 << 6;
|
||||
if (station_id != ScriptStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24);
|
||||
|
||||
const GRFFile *file;
|
||||
@@ -244,7 +244,7 @@
|
||||
EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
|
||||
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
|
||||
|
||||
return ScriptObject::DoCommand(tile, tile, GetCurrentRailType() | (FindFirstTrack((::TrackBits)rail_track) << 4), CMD_BUILD_RAILROAD_TRACK);
|
||||
return ScriptObject::DoCommand(tile, tile, GetCurrentRailType() | (FindFirstTrack((::TrackBits)rail_track) << 6), CMD_BUILD_RAILROAD_TRACK);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptRail::RemoveRailTrack(TileIndex tile, RailTrack rail_track)
|
||||
@@ -255,7 +255,7 @@
|
||||
EnforcePrecondition(false, GetRailTracks(tile) & rail_track);
|
||||
EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
|
||||
|
||||
return ScriptObject::DoCommand(tile, tile, FindFirstTrack((::TrackBits)rail_track) << 4, CMD_REMOVE_RAILROAD_TRACK);
|
||||
return ScriptObject::DoCommand(tile, tile, FindFirstTrack((::TrackBits)rail_track) << 6, CMD_REMOVE_RAILROAD_TRACK);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptRail::AreTilesConnected(TileIndex from, TileIndex tile, TileIndex to)
|
||||
@@ -355,7 +355,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
|
||||
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
|
||||
(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
|
||||
|
||||
uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 8 | ScriptRail::GetCurrentRailType();;
|
||||
uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 10 | ScriptRail::GetCurrentRailType();;
|
||||
return ScriptObject::DoCommand(tile, to, p2, CMD_BUILD_RAILROAD_TRACK);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user