From 4d93b704d9f0e6e58dac1d97f79a05bd4320c43f Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 18 Jan 2010 22:57:21 +0000 Subject: (svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions --- src/rail_cmd.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/rail_cmd.cpp') diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 205cd2ce2..98909f38f 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -340,7 +340,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u } ret = CheckRailSlope(tileh, trackbit, GetTrackBits(tile), tile); - if (CmdFailed(ret)) return ret; + if (ret.Failed()) return ret; cost.AddCost(ret); /* If the rail types don't match, try to convert only if engines of @@ -349,7 +349,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u if (GetRailType(tile) != railtype && !HasPowerOnRail(railtype, GetRailType(tile))) { if (HasPowerOnRail(GetRailType(tile), railtype)) { ret = DoCommand(tile, tile, railtype, flags, CMD_CONVERT_RAIL); - if (CmdFailed(ret)) return ret; + if (ret.Failed()) return ret; cost.AddCost(ret); } else { return CMD_ERROR; @@ -415,11 +415,11 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u bool water_ground = IsTileType(tile, MP_WATER) && IsSlopeWithOneCornerRaised(tileh); ret = CheckRailSlope(tileh, trackbit, TRACK_BIT_NONE, tile); - if (CmdFailed(ret)) return ret; + if (ret.Failed()) return ret; cost.AddCost(ret); ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); - if (CmdFailed(ret)) return ret; + if (ret.Failed()) return ret; cost.AddCost(ret); if (water_ground) { @@ -581,7 +581,7 @@ bool FloodHalftile(TileIndex t) TrackBits to_remove = lower_track & rail_bits; if (to_remove != 0) { _current_company = OWNER_WATER; - if (CmdFailed(DoCommand(t, 0, FIND_FIRST_BIT(to_remove), DC_EXEC, CMD_REMOVE_SINGLE_RAIL))) return flooded; // not yet floodable + if (DoCommand(t, 0, FIND_FIRST_BIT(to_remove), DC_EXEC, CMD_REMOVE_SINGLE_RAIL).Failed()) return flooded; // not yet floodable flooded = true; rail_bits = rail_bits & ~to_remove; if (rail_bits == 0) { @@ -693,14 +693,14 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3 TileIndex end_tile = p1; Trackdir trackdir = TrackToTrackdir(track); - if (CmdFailed(ValidateAutoDrag(&trackdir, tile, end_tile))) return CMD_ERROR; + if (ValidateAutoDrag(&trackdir, tile, end_tile).Failed()) return CMD_ERROR; if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, tile); for (;;) { ret = DoCommand(tile, railtype, TrackdirToTrack(trackdir), flags, remove ? CMD_REMOVE_SINGLE_RAIL : CMD_BUILD_SINGLE_RAIL); - if (CmdFailed(ret)) { + if (ret.Failed()) { if (_error_message != STR_ERROR_ALREADY_BUILT && !remove) break; _error_message = INVALID_STRING_ID; } else { @@ -792,7 +792,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u } CommandCost cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); - if (CmdFailed(cost)) return CMD_ERROR; + if (cost.Failed()) return CMD_ERROR; if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); @@ -1082,7 +1082,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin * since the original amount will be too dense (shorter tracks) */ signal_density *= 2; - if (CmdFailed(ValidateAutoDrag(&trackdir, tile, end_tile))) return CMD_ERROR; + if (ValidateAutoDrag(&trackdir, tile, end_tile).Failed()) return CMD_ERROR; track = TrackdirToTrack(trackdir); // trackdir might have changed, keep track in sync Trackdir start_trackdir = trackdir; @@ -1138,7 +1138,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin ret = DoCommand(tile, p1, signals, flags, remove ? CMD_REMOVE_SIGNALS : CMD_BUILD_SIGNALS); /* Be user-friendly and try placing signals as much as possible */ - if (CmdSucceeded(ret)) { + if (ret.Succeeded()) { err = false; total_cost.AddCost(ret); } @@ -1521,7 +1521,7 @@ static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags) while (tracks != TRACK_BIT_NONE) { Track track = RemoveFirstTrack(&tracks); ret = DoCommand(tile, 0, track, flags, CMD_REMOVE_SINGLE_RAIL); - if (CmdFailed(ret)) return CMD_ERROR; + if (ret.Failed()) return CMD_ERROR; cost.AddCost(ret); } @@ -2454,7 +2454,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol if (!_settings_game.construction.build_on_slopes || !AutoslopeEnabled()) return CMD_ERROR; /* Is the slope-rail_bits combination valid in general? I.e. is it safe to call GetRailFoundation() ? */ - if (CmdFailed(CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile))) return CMD_ERROR; + if (CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile).Failed()) return CMD_ERROR; /* Get the slopes on top of the foundations */ z_old += ApplyFoundationToSlope(GetRailFoundation(tileh_old, rail_bits), &tileh_old); -- cgit v1.2.3-54-g00ecf