Changeset - r8088:0596dcb18b35
[Not reviewed]
master
0 15 0
smatz - 17 years ago 2007-12-16 19:30:42
smatz@openttd.org
(svn r11649) -Codechange: some code can be simplified thanks to changes in r11642
15 files changed with 84 insertions and 190 deletions:
0 comments (0 inline, 0 general)
src/ai/trolly/pathfinder.cpp
Show inline comments
 
@@ -45,10 +45,7 @@ static bool IsRoad(TileIndex tile)
 
	return
 
		// MP_ROAD, but not a road depot?
 
		(IsTileType(tile, MP_ROAD) && !IsTileDepotType(tile, TRANSPORT_ROAD)) ||
 
		(IsTileType(tile, MP_TUNNELBRIDGE) && (
 
			(IsTunnel(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD) ||
 
			(IsBridge(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD)
 
		));
 
		(IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD);
 
}
 

	
 

	
 
@@ -236,11 +233,7 @@ static void AyStar_AiPathFinder_GetNeigh
 
			// If the next step is a bridge, we have to enter it the right way
 
			if (!PathFinderInfo->rail_or_road && IsRoad(atile)) {
 
				if (IsTileType(atile, MP_TUNNELBRIDGE)) {
 
					if (IsTunnel(atile)) {
 
						if (GetTunnelBridgeDirection(atile) != i) continue;
 
					} else {
 
						if (GetTunnelBridgeDirection(atile) != i) continue;
 
					}
 
					if (GetTunnelBridgeDirection(atile) != i) continue;
 
				}
 
			}
 

	
src/elrail.cpp
Show inline comments
 
@@ -93,17 +93,11 @@ static TrackBits GetRailTrackBitsUnivers
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			if (IsTunnel(t)) {
 
				if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
 
				if (override != NULL) *override = 1 << GetTunnelBridgeDirection(t);
 
				return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(t)));
 
			} else {
 
				if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
 
				if (override != NULL && DistanceMax(t, GetOtherBridgeEnd(t)) > 1) {
 
					*override = 1 << GetTunnelBridgeDirection(t);
 
				}
 
				return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(t)));
 
			if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
 
			if (override != NULL && (IsTunnel(t) || DistanceMax(t, GetOtherBridgeEnd(t)) > 1)) {
 
				*override = 1 << GetTunnelBridgeDirection(t);
 
			}
 
			return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(t)));
 

	
 
		case MP_ROAD:
 
			if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return TRACK_BIT_NONE;
src/npf.cpp
Show inline comments
 
@@ -481,8 +481,7 @@ static bool VehicleMayEnterTile(Owner ow
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			if ((IsTunnel(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) ||
 
					(IsBridge(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL)) {
 
			if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
 
				return IsTileOwner(tile, owner);
 
			}
 
			break;
 
@@ -534,14 +533,11 @@ static void NPFFollowTrack(AyStar* aysta
 
	DEBUG(npf, 4, "Expanding: (%d, %d, %d) [%d]", TileX(src_tile), TileY(src_tile), src_trackdir, src_tile);
 

	
 
	/* Find dest tile */
 
	if (IsTunnelTile(src_tile) && GetTunnelBridgeDirection(src_tile) == src_exitdir) {
 
		/* This is a tunnel. We know this tunnel is our type,
 
	if (IsTileType(src_tile, MP_TUNNELBRIDGE) && GetTunnelBridgeDirection(src_tile) == src_exitdir) {
 
		/* This is a tunnel/bridge. We know this tunnel/bridge is our type,
 
		 * otherwise we wouldn't have got here. It is also facing us,
 
		 * so we should skip it's body */
 
		dst_tile = GetOtherTunnelEnd(src_tile);
 
		override_dst_check = true;
 
	} else if (IsBridgeTile(src_tile) && GetTunnelBridgeDirection(src_tile) == src_exitdir) {
 
		dst_tile = GetOtherBridgeEnd(src_tile);
 
		dst_tile = IsTunnel(src_tile) ? GetOtherTunnelEnd(src_tile) : GetOtherBridgeEnd(src_tile);
 
		override_dst_check = true;
 
	} else if (type != TRANSPORT_WATER && (IsStandardRoadStopTile(src_tile) || IsTileDepotType(src_tile, type))) {
 
		/* This is a road station (non drive-through) or a train or road depot. We can enter and exit
 
@@ -590,14 +586,9 @@ static void NPFFollowTrack(AyStar* aysta
 
	/* I can't enter a tunnel entry/exit tile from a tile above the tunnel. Note
 
	 * that I can enter the tunnel from a tile below the tunnel entrance. This
 
	 * solves the problem of vehicles wanting to drive off a tunnel entrance */
 
	if (!override_dst_check) {
 
		if (IsTileType(dst_tile, MP_TUNNELBRIDGE)) {
 
			if (IsTunnel(dst_tile)) {
 
				if (GetTunnelBridgeDirection(dst_tile) != src_exitdir) return;
 
			} else {
 
				if (GetTunnelBridgeDirection(dst_tile) != src_exitdir) return;
 
			}
 
		}
 
	if (!override_dst_check && IsTileType(dst_tile, MP_TUNNELBRIDGE) &&
 
			GetTunnelBridgeDirection(dst_tile) != src_exitdir) {
 
		return;
 
	}
 

	
 
	/* check correct rail type (mono, maglev, etc) */
src/openttd.cpp
Show inline comments
 
@@ -1759,14 +1759,8 @@ bool AfterLoadGame()
 
					break;
 

	
 
				case MP_TUNNELBRIDGE:
 
					if (IsTunnel(t)) {
 
						if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) {
 
							SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
 
						}
 
					} else {
 
						if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) {
 
							SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
 
						}
 
					if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) {
 
						SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
 
					}
 
					break;
 

	
src/pathfind.cpp
Show inline comments
 
@@ -260,16 +260,9 @@ static inline void TPFMode1_NormalCase(T
 
	/* Check if the new tile is a tunnel or bridge head and that the direction
 
	 * and transport type match */
 
	if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 
		if (IsTunnel(tile)) {
 
			if (GetTunnelBridgeDirection(tile) != direction ||
 
					GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 
				return;
 
			}
 
		} else if (IsBridge(tile)) {
 
			if (GetTunnelBridgeDirection(tile) != direction ||
 
					GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 
				return;
 
			}
 
		if (GetTunnelBridgeDirection(tile) != direction ||
 
				GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 
			return;
 
		}
 
	}
 

	
src/rail.cpp
Show inline comments
 
@@ -132,11 +132,7 @@ RailType GetTileRailType(TileIndex tile)
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			if (IsTunnel(tile)) {
 
				if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) return GetRailType(tile);
 
			} else {
 
				if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) return GetRailType(tile);
 
			}
 
			if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) return GetRailType(tile);
 
			break;
 

	
 
		default:
src/rail_cmd.cpp
Show inline comments
 
@@ -926,17 +926,15 @@ static bool CheckSignalAutoFill(TileInde
 
			return true;
 

	
 
		case MP_TUNNELBRIDGE: {
 
			TileIndex orig_tile = tile;
 
			/* Skip to end of tunnel or bridge */
 
			if (IsBridge(tile)) {
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return false;
 
				if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir)) return false;
 
				tile = GetOtherBridgeEnd(tile);
 
			} else {
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return false;
 
				if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir)) return false;
 
				tile = GetOtherTunnelEnd(tile);
 
			}
 
			TileIndex orig_tile = tile; // backup old value
 

	
 
			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return false;
 
			if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir)) return false;
 

	
 
			/* Skip to end of tunnel or bridge
 
			 * note that tile is a parameter by reference, so it must be updated */
 
			tile = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
 

	
 
			signal_ctr += 2 + DistanceMax(orig_tile, tile) * 2;
 
			return true;
 
		}
src/rail_gui.cpp
Show inline comments
 
@@ -1522,12 +1522,8 @@ void SetDefaultRailGui()
 
			RailType count[RAILTYPE_END];
 
			memset(count, 0, sizeof(count));
 
			for (TileIndex t = 0; t < MapSize(); t++) {
 
				if (IsTileType(t, MP_RAILWAY) ||
 
						IsLevelCrossingTile(t) ||
 
						IsRailwayStationTile(t) ||
 
						(IsTunnelTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) ||
 
						(IsBridgeTile(t) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL)
 
						) {
 
				if (IsTileType(t, MP_RAILWAY) || IsLevelCrossingTile(t) || IsRailwayStationTile(t) ||
 
						(IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL)) {
 
					count[GetRailType(t)]++;
 
				}
 
			}
src/road_cmd.cpp
Show inline comments
 
@@ -133,15 +133,8 @@ CommandCost CmdRemoveRoad(TileIndex tile
 

	
 
		case MP_TUNNELBRIDGE:
 
			{
 
				TileIndex endtile;
 
				if (IsTunnel(tile)) {
 
					if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
					endtile = GetOtherTunnelEnd(tile);
 
				} else {
 
					if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
					endtile = GetOtherBridgeEnd(tile);
 
				}
 

	
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
				TileIndex endtile = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
 
				if (GetVehicleTunnelBridge(tile, endtile) != NULL) return CMD_ERROR;
 
			} break;
 

	
 
@@ -514,15 +507,11 @@ CommandCost CmdBuildRoad(TileIndex tile,
 

	
 
		case MP_TUNNELBRIDGE:
 
			{
 
				TileIndex endtile;
 
				if (IsTunnel(tile)) {
 
					if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
					endtile = GetOtherTunnelEnd(tile);
 
				} else {
 
					if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
					endtile = GetOtherBridgeEnd(tile);
 
				}
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
 
				if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
 

	
 
				TileIndex endtile = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
 

	
 
				/* Don't allow "upgrading" the bridge/tunnel when vehicles are already driving on it */
 
				if (GetVehicleTunnelBridge(tile, endtile) != NULL) return CMD_ERROR;
 
			} break;
src/road_map.cpp
Show inline comments
 
@@ -34,13 +34,8 @@ RoadBits GetAnyRoadBits(TileIndex tile, 
 
			return DiagDirToRoadBits(GetRoadStopDir(tile));
 

	
 
		case MP_TUNNELBRIDGE:
 
			if (IsTunnel(tile)) {
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
 
				return DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
 
			} else {
 
				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
 
				return DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
 
			}
 
			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
 
			return DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
 

	
 
		default: return ROAD_NONE;
 
	}
src/roadveh_cmd.cpp
Show inline comments
 
@@ -551,8 +551,7 @@ CommandCost CmdTurnRoadVeh(TileIndex til
 

	
 
	if (IsTileType(v->tile, MP_ROAD) && GetRoadTileType(v->tile) == ROAD_TILE_NORMAL && GetDisallowedRoadDirections(v->tile) != DRD_NONE) return CMD_ERROR;
 

	
 
	if (IsTunnelTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
 
	if (IsBridgeTile(v->tile) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
 
	if (IsTileType(v->tile, MP_TUNNELBRIDGE) && DirToDiagDir(v->direction) == GetTunnelBridgeDirection(v->tile)) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) v->u.road.reverse_ctr = 180;
 

	
 
@@ -1407,9 +1406,7 @@ static Trackdir FollowPreviousRoadVehicl
 
	if (prev_state == RVSB_WORMHOLE || prev_state == RVSB_IN_DEPOT) {
 
		DiagDirection diag_dir = INVALID_DIAGDIR;
 

	
 
		if (IsTunnelTile(tile)) {
 
			diag_dir = GetTunnelBridgeDirection(tile);
 
		} else if (IsBridgeTile(tile)) {
 
		if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 
			diag_dir = GetTunnelBridgeDirection(tile);
 
		} else if (IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_DEPOT) {
 
			diag_dir = ReverseDiagDir(GetRoadDepotDirection(tile));
src/smallmap_gui.cpp
Show inline comments
 
@@ -339,13 +339,8 @@ static inline TileType GetEffectiveTileT
 
	TileType t = GetTileType(tile);
 

	
 
	if (t == MP_TUNNELBRIDGE) {
 
		TransportType tt;
 
		TransportType tt = GetTunnelBridgeTransportType(tile);
 

	
 
		if (IsTunnel(tile)) {
 
			tt = GetTunnelBridgeTransportType(tile);
 
		} else {
 
			tt = GetTunnelBridgeTransportType(tile);
 
		}
 
		switch (tt) {
 
			case TRANSPORT_RAIL: t = MP_RAILWAY; break;
 
			case TRANSPORT_ROAD: t = MP_ROAD;    break;
src/town_cmd.cpp
Show inline comments
 
@@ -1064,10 +1064,8 @@ static void GrowTownInTile(TileIndex *ti
 

	
 
		/* Reached a tunnel/bridge? Then continue at the other side of it. */
 
		if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 
			if (IsTunnel(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD) {
 
				*tile_ptr = GetOtherTunnelEnd(tile);
 
			} else if (IsBridge(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD) {
 
				*tile_ptr = GetOtherBridgeEnd(tile);
 
			if (GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD) {
 
				*tile_ptr = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
 
			}
 
			return;
 
		}
src/train_cmd.cpp
Show inline comments
 
@@ -3059,7 +3059,7 @@ static void DeleteLastWagon(Vehicle *v)
 

	
 
		if (GetVehicleTunnelBridge(v->tile, endtile) != NULL) return; // tunnel / bridge is busy
 

	
 
		DiagDirection dir = IsTunnel(v->tile) ? GetTunnelBridgeDirection(v->tile) : GetTunnelBridgeDirection(v->tile);
 
		DiagDirection dir = GetTunnelBridgeDirection(v->tile);
 

	
 
		/* v->direction is "random", so it cannot be used to determine the direction of the track */
 
		UpdateSignalsOnSegment(v->tile, dir);
 
@@ -3176,7 +3176,7 @@ static bool TrainCheckIfLineEnds(Vehicle
 
	TileIndex tile = v->tile;
 

	
 
	if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 
		DiagDirection dir = IsTunnel(tile) ? GetTunnelBridgeDirection(tile) : GetTunnelBridgeDirection(tile);
 
		DiagDirection dir = GetTunnelBridgeDirection(tile);
 
		if (DiagDirToDir(dir) == v->direction) return true;
 
	}
 

	
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -702,63 +702,39 @@ static CommandCost ClearTile_TunnelBridg
 
 */
 
CommandCost DoConvertTunnelBridgeRail(TileIndex tile, RailType totype, bool exec)
 
{
 
	if (IsTunnel(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
 
		TileIndex endtile = GetOtherTunnelEnd(tile);
 

	
 
		/* If not coverting rail <-> el. rail, any vehicle cannot be in tunnel */
 
		if (!IsCompatibleRail(GetRailType(tile), totype) &&
 
				GetVehicleTunnelBridge(tile, endtile) != NULL) {
 
			return CMD_ERROR;
 
		}
 
	if (GetTunnelBridgeTransportType(tile) != TRANSPORT_RAIL) return CMD_ERROR;
 

	
 
		if (exec) {
 
			SetRailType(tile, totype);
 
			SetRailType(endtile, totype);
 
			MarkTileDirtyByTile(tile);
 
			MarkTileDirtyByTile(endtile);
 

	
 
			Track track = AxisToTrack(DiagDirToAxis(GetTunnelBridgeDirection(tile)));
 

	
 
			YapfNotifyTrackLayoutChange(tile, track);
 
			YapfNotifyTrackLayoutChange(endtile, track);
 

	
 
			VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
 
			VehicleFromPos(endtile, NULL, &UpdateTrainPowerProc);
 
		}
 

	
 
		return CommandCost((DistanceManhattan(tile, endtile) + 1) * RailConvertCost(GetRailType(tile), totype));
 
	} else if (IsBridge(tile) && GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL) {
 
		TileIndex endtile = GetOtherBridgeEnd(tile);
 
	TileIndex endtile = IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile);
 

	
 
		if (!IsCompatibleRail(GetRailType(tile), totype) &&
 
				GetVehicleTunnelBridge(tile, endtile) != NULL) {
 
			return CMD_ERROR;
 
		}
 

	
 
		if (exec) {
 
			SetRailType(tile, totype);
 
			SetRailType(endtile, totype);
 
			MarkTileDirtyByTile(tile);
 
			MarkTileDirtyByTile(endtile);
 

	
 
			Track track = AxisToTrack(DiagDirToAxis(GetTunnelBridgeDirection(tile)));
 
			TileIndexDiff delta = TileOffsByDiagDir(GetTunnelBridgeDirection(tile));
 

	
 
			YapfNotifyTrackLayoutChange(tile, track);
 
			YapfNotifyTrackLayoutChange(endtile, track);
 

	
 
			VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
 
			VehicleFromPos(endtile, NULL, &UpdateTrainPowerProc);
 

	
 
			for (tile += delta; tile != endtile; tile += delta) {
 
				MarkTileDirtyByTile(tile); // TODO encapsulate this into a function
 
			}
 
		}
 

	
 
		return CommandCost((DistanceManhattan(tile, endtile) + 1) * RailConvertCost(GetRailType(tile), totype));
 
	} else {
 
	/* If not coverting rail <-> el. rail, any vehicle cannot be in tunnel/bridge */
 
	if (!IsCompatibleRail(GetRailType(tile), totype) &&
 
			GetVehicleTunnelBridge(tile, endtile) != NULL) {
 
		return CMD_ERROR;
 
	}
 

	
 
	if (exec) {
 
		SetRailType(tile, totype);
 
		SetRailType(endtile, totype);
 

	
 
		Track track = AxisToTrack(DiagDirToAxis(GetTunnelBridgeDirection(tile)));
 

	
 
		YapfNotifyTrackLayoutChange(tile, track);
 
		YapfNotifyTrackLayoutChange(endtile, track);
 

	
 
		VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
 
		VehicleFromPos(endtile, NULL, &UpdateTrainPowerProc);
 

	
 
		MarkTileDirtyByTile(tile);
 
		MarkTileDirtyByTile(endtile);
 

	
 
		if (IsBridge(tile)) {
 
			TileIndexDiff delta = TileOffsByDiagDir(GetTunnelBridgeDirection(tile));
 
			TileIndex t = tile + delta;
 
			for (; t != endtile; t += delta) MarkTileDirtyByTile(t); // TODO encapsulate this into a function
 
		}
 
	}
 

	
 
	return CommandCost((DistanceManhattan(tile, endtile) + 1) * RailConvertCost(GetRailType(tile), totype));
 
}
 

	
 

	
 
@@ -1261,29 +1237,24 @@ static void AnimateTile_TunnelBridge(Til
 

	
 
static void TileLoop_TunnelBridge(TileIndex tile)
 
{
 
	bool snow_or_desert = IsTunnelTile(tile) ? HasTunnelBridgeSnowOrDesert(tile) : HasTunnelBridgeSnowOrDesert(tile);
 
	bool snow_or_desert = HasTunnelBridgeSnowOrDesert(tile);
 
	switch (_opt.landscape) {
 
		case LT_ARCTIC:
 
			if (snow_or_desert != (GetTileZ(tile) > GetSnowLine())) {
 
				if (IsTunnelTile(tile)) {
 
					SetTunnelBridgeSnowOrDesert(tile, !snow_or_desert);
 
				} else {
 
					SetTunnelBridgeSnowOrDesert(tile, !snow_or_desert);
 
				}
 
				SetTunnelBridgeSnowOrDesert(tile, !snow_or_desert);
 
				MarkTileDirtyByTile(tile);
 
			}
 
			break;
 

	
 
		case LT_TROPIC:
 
			if (GetTropicZone(tile) == TROPICZONE_DESERT && !snow_or_desert) {
 
				if (IsTunnelTile(tile)) {
 
					SetTunnelBridgeSnowOrDesert(tile, true);
 
				} else {
 
					SetTunnelBridgeSnowOrDesert(tile, true);
 
				}
 
				SetTunnelBridgeSnowOrDesert(tile, true);
 
				MarkTileDirtyByTile(tile);
 
			}
 
			break;
 

	
 
		default:
 
			break;
 
	}
 
}
 

	
 
@@ -1295,15 +1266,9 @@ static void ClickTile_TunnelBridge(TileI
 

	
 
static uint32 GetTileTrackStatus_TunnelBridge(TileIndex tile, TransportType mode, uint sub_mode)
 
{
 
	if (IsTunnel(tile)) {
 
		if (GetTunnelBridgeTransportType(tile) != mode) return 0;
 
		if (GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD && (GetRoadTypes(tile) & sub_mode) == 0) return 0;
 
		return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) * 0x101;
 
	} else {
 
		if (GetTunnelBridgeTransportType(tile) != mode) return 0;
 
		if (GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD && (GetRoadTypes(tile) & sub_mode) == 0) return 0;
 
		return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) * 0x101;
 
	}
 
	if (GetTunnelBridgeTransportType(tile) != mode) return 0;
 
	if (GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD && (GetRoadTypes(tile) & sub_mode) == 0) return 0;
 
	return AxisToTrackBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) * 0x101;
 
}
 

	
 
static void ChangeTileOwner_TunnelBridge(TileIndex tile, PlayerID old_player, PlayerID new_player)
 
@@ -1318,7 +1283,7 @@ static void ChangeTileOwner_TunnelBridge
 
			 * the bridge/tunnel. As all *our* vehicles are already removed, they
 
			 * must be of another owner. Therefor this must be a road bridge/tunnel.
 
			 * In that case we can safely reassign the ownership to OWNER_NONE. */
 
			assert((IsTunnel(tile) ? GetTunnelBridgeTransportType(tile) : GetTunnelBridgeTransportType(tile)) == TRANSPORT_ROAD);
 
			assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD);
 
			SetTileOwner(tile, OWNER_NONE);
 
		}
 
	}
0 comments (0 inline, 0 general)