mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-08 01:10:28 +00:00
(svn r11621) -Fix [FS#1525]: there were still some cases where one could not build a tram track, but the tram could become blocked.
This commit is contained in:
parent
a85c832919
commit
a5bcce4fc8
@ -1461,25 +1461,21 @@ static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Can a tram track build without destruction on the given tile?
|
* Can a tram track build without destruction on the given tile?
|
||||||
|
* @param p the player that would be building the tram tracks
|
||||||
* @param t the tile to build on.
|
* @param t the tile to build on.
|
||||||
|
* @param r the road bits needed.
|
||||||
* @return true when a track track can be build on 't'
|
* @return true when a track track can be build on 't'
|
||||||
*/
|
*/
|
||||||
static bool CanBuildTramTrackOnTile(TileIndex t)
|
static bool CanBuildTramTrackOnTile(PlayerID p, TileIndex t, RoadBits r)
|
||||||
{
|
{
|
||||||
switch (GetTileType(t)) {
|
/* The 'current' player is not necessarily the owner of the vehicle. */
|
||||||
case MP_CLEAR:
|
PlayerID original_player = _current_player;
|
||||||
case MP_TREES:
|
_current_player = p;
|
||||||
return true;
|
|
||||||
|
|
||||||
case MP_ROAD:
|
CommandCost ret = DoCommand(t, ROADTYPE_TRAM << 4 | r, 0, 0, CMD_BUILD_ROAD);
|
||||||
return GetRoadTileType(t) == ROAD_TILE_NORMAL;
|
|
||||||
|
|
||||||
case MP_WATER:
|
_current_player = original_player;
|
||||||
return IsCoast(t);
|
return CmdSucceeded(ret);
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
|
static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
|
||||||
@ -1593,7 +1589,7 @@ again:
|
|||||||
* going to cause the tram to split up.
|
* going to cause the tram to split up.
|
||||||
* - Or the front of the tram can drive over the next tile.
|
* - Or the front of the tram can drive over the next tile.
|
||||||
*/
|
*/
|
||||||
} else if (!IsRoadVehFront(v) || !CanBuildTramTrackOnTile(tile)) {
|
} else if (!IsRoadVehFront(v) || !CanBuildTramTrackOnTile(v->owner, tile, needed)) {
|
||||||
/*
|
/*
|
||||||
* Taking the 'small' corner for trams only happens when:
|
* Taking the 'small' corner for trams only happens when:
|
||||||
* - We are not the from vehicle of an articulated tram.
|
* - We are not the from vehicle of an articulated tram.
|
||||||
|
Loading…
Reference in New Issue
Block a user