1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-29 01:19:11 +00:00

(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.

This commit is contained in:
Darkvater
2006-04-15 20:07:42 +00:00
parent f69fcf400e
commit d63fad7a7b
4 changed files with 11 additions and 11 deletions

View File

@@ -92,7 +92,7 @@ void TrainPowerChanged(Vehicle* v)
if (IsBridgeTile(u->tile) && IsBridgeMiddle(u->tile) && DiagDirToAxis(DirToDiagDir(u->direction)) == GetBridgeAxis(u->tile)) {
if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeOnBridge(u->tile))) engine_has_power = false;
if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeOnBridge(u->tile))) wagon_has_power = false;
} else if (IsTileType(u->tile, MP_STREET) && IsLevelCrossing(u->tile)) {
} else if (IsLevelCrossingTile(u->tile)) {
if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeCrossing(u->tile))) engine_has_power = false;
if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeCrossing(u->tile))) wagon_has_power = false;
} else {
@@ -1529,8 +1529,7 @@ static void *TestTrainOnCrossing(Vehicle *v, void *data)
static void DisableTrainCrossing(TileIndex tile)
{
if (IsTileType(tile, MP_STREET) &&
IsLevelCrossing(tile) &&
if (IsLevelCrossingTile(tile) &&
VehicleFromPos(tile, &tile, TestTrainOnCrossing) == NULL && // empty?
IsCrossingBarred(tile)) {
UnbarCrossing(tile);
@@ -3235,7 +3234,7 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
}
if ((ts &= (ts >> 16)) == 0) {
// make a rail/road crossing red
if (IsTileType(tile, MP_STREET) && IsLevelCrossing(tile)) {
if (IsLevelCrossingTile(tile)) {
if (!IsCrossingBarred(tile)) {
BarCrossing(tile);
SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v);