Minor fixes in CmdRemoveSingleSignal

Whitespace fixes
This commit is contained in:
Jonathan G Rennison
2015-08-01 20:26:41 +01:00
parent 59b0b18aa2
commit 22a5c6d459
4 changed files with 25 additions and 23 deletions

View File

@@ -1035,7 +1035,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1,
if (p2 != 12) cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS] * ((GetTunnelBridgeLength(tile, tile_exit) + 4) >> 2)); // minimal 1 if (p2 != 12) cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS] * ((GetTunnelBridgeLength(tile, tile_exit) + 4) >> 2)); // minimal 1
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
if (p2 == 0 && HasWormholeSignals(tile)){ // Toggle signal if already signals present. if (p2 == 0 && HasWormholeSignals(tile)) { // Toggle signal if already signals present.
if (IsTunnelBridgeEntrance (tile)) { if (IsTunnelBridgeEntrance (tile)) {
ClrBitTunnelBridgeSignal(tile); ClrBitTunnelBridgeSignal(tile);
ClrBitTunnelBridgeExit(tile_exit); ClrBitTunnelBridgeExit(tile_exit);
@@ -1388,20 +1388,20 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin
/* Collect cost. */ /* Collect cost. */
if (!test_only) { if (!test_only) {
/* Be user-friendly and try placing signals as much as possible */ /* Be user-friendly and try placing signals as much as possible */
if (ret.Succeeded()) { if (ret.Succeeded()) {
had_success = true; had_success = true;
if (IsTileType(tile, MP_TUNNELBRIDGE)) { if (IsTileType(tile, MP_TUNNELBRIDGE)) {
if ((!autofill && GetTunnelBridgeDirection(tile) == TrackdirToExitdir(trackdir)) || if ((!autofill && GetTunnelBridgeDirection(tile) == TrackdirToExitdir(trackdir)) ||
(autofill && GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir))) { (autofill && GetTunnelBridgeDirection(tile) != TrackdirToExitdir(trackdir))) {
total_cost.AddCost(ret);
}
} else {
total_cost.AddCost(ret); total_cost.AddCost(ret);
} }
last_used_ctr = last_suitable_ctr;
last_suitable_tile = INVALID_TILE;
} else { } else {
total_cost.AddCost(ret);
}
last_used_ctr = last_suitable_ctr;
last_suitable_tile = INVALID_TILE;
} else {
/* The "No railway" error is the least important one. */ /* The "No railway" error is the least important one. */
if (ret.GetErrorMessage() != STR_ERROR_THERE_IS_NO_RAILROAD_TRACK || if (ret.GetErrorMessage() != STR_ERROR_THERE_IS_NO_RAILROAD_TRACK ||
last_error.GetErrorMessage() == INVALID_STRING_ID) { last_error.GetErrorMessage() == INVALID_STRING_ID) {
@@ -1482,7 +1482,7 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
cost *= ((GetTunnelBridgeLength(tile, end) + 4) >> 2); cost *= ((GetTunnelBridgeLength(tile, end) + 4) >> 2);
CommandCost ret = EnsureNoTrainOnTrack(GetOtherTunnelBridgeEnd(tile), track); CommandCost ret = EnsureNoTrainOnTrack(GetOtherTunnelBridgeEnd(tile), track);
//if (ret.Failed()) return ret; if (ret.Failed()) return ret;
} else { } else {
if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || !HasTrack(tile, track)) { if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || !HasTrack(tile, track)) {
return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
@@ -1491,11 +1491,13 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
return_cmd_error(STR_ERROR_THERE_ARE_NO_SIGNALS); return_cmd_error(STR_ERROR_THERE_ARE_NO_SIGNALS);
} }
CommandCost ret = EnsureNoTrainOnTrack(tile, track); CommandCost ret = EnsureNoTrainOnTrack(tile, track);
//if (ret.Failed()) return ret; if (ret.Failed()) return ret;
} }
/* Only water can remove signals from anyone */ /* Only water can remove signals from anyone */
if (_current_company != OWNER_WATER) { if (_current_company != OWNER_WATER) {
CommandCost ret = CheckTileOwnership(tile);
if (ret.Failed()) return ret;
} }
/* Do it? */ /* Do it? */

View File

@@ -1644,7 +1644,7 @@ static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc *td)
if (IsTunnel(tile)) { if (IsTunnel(tile)) {
td->str = (tt == TRANSPORT_RAIL) ? HasWormholeSignals(tile) ? STR_LAI_TUNNEL_DESCRIPTION_RAILROAD_SIGNAL : STR_LAI_TUNNEL_DESCRIPTION_RAILROAD : STR_LAI_TUNNEL_DESCRIPTION_ROAD; td->str = (tt == TRANSPORT_RAIL) ? HasWormholeSignals(tile) ? STR_LAI_TUNNEL_DESCRIPTION_RAILROAD_SIGNAL : STR_LAI_TUNNEL_DESCRIPTION_RAILROAD : STR_LAI_TUNNEL_DESCRIPTION_ROAD;
} else { // IsBridge(tile) } else { // IsBridge(tile)
td->str = (tt == TRANSPORT_WATER) ? STR_LAI_BRIDGE_DESCRIPTION_AQUEDUCT : HasWormholeSignals(tile) ? STR_LAI_BRIDGE_DESCRIPTION_RAILROAD_SIGNAL : GetBridgeSpec(GetBridgeType(tile))->transport_name[tt]; td->str = (tt == TRANSPORT_WATER) ? STR_LAI_BRIDGE_DESCRIPTION_AQUEDUCT : HasWormholeSignals(tile) ? STR_LAI_BRIDGE_DESCRIPTION_RAILROAD_SIGNAL : GetBridgeSpec(GetBridgeType(tile))->transport_name[tt];
} }
td->owner[0] = GetTileOwner(tile); td->owner[0] = GetTileOwner(tile);