summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-03-20 17:58:24 +0000
committeralberth <alberth@openttd.org>2010-03-20 17:58:24 +0000
commit05d705e077cb247ee31e0a61bc410fe2b9183c6a (patch)
tree7c96d4ce3b519c3edc7def2e1769c2ae4d82a334 /src/station_cmd.cpp
parenta901ab53925857a3f6ae70a045a9f0ec6362107e (diff)
downloadopenttd-05d705e077cb247ee31e0a61bc410fe2b9183c6a.tar.xz
(svn r19494) -Codechange: Remove _error_message.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp37
1 files changed, 2 insertions, 35 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 9a6c21280..b871b49cd 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -672,7 +672,6 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z
}
CommandCost ret = EnsureNoVehicleOnGround(tile);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
uint z;
@@ -867,7 +866,6 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
if (!_settings_game.construction.road_stop_on_town_road) return_cmd_error(STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD);
} else if (!_settings_game.construction.road_stop_on_competitor_road && road_owner != OWNER_NONE) {
CommandCost ret = CheckOwnership(road_owner);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
num_roadbits += CountBits(GetRoadBits(cur_tile, ROADTYPE_ROAD));
@@ -878,7 +876,6 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
Owner tram_owner = GetRoadOwner(cur_tile, ROADTYPE_TRAM);
if (!_settings_game.construction.road_stop_on_competitor_road && tram_owner != OWNER_NONE) {
CommandCost ret = CheckOwnership(tram_owner);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
num_roadbits += CountBits(GetRoadBits(cur_tile, ROADTYPE_TRAM));
@@ -1110,7 +1107,6 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
/* Does the authority allow this? */
CommandCost ret = CheckIfAuthorityAllowsNewStation(tile_org, flags);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
if (!ValParamRailtype(rt)) return CMD_ERROR;
@@ -1151,7 +1147,6 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
Station *st = NULL;
ret = FindJoiningStation(est, station_to_join, adjacent, new_location, &st);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
/* See if there is a deleted station close to us. */
@@ -1167,13 +1162,11 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
if (!_settings_game.station.join_stations) return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_RAILROAD);
CommandCost ret = CanExpandRailStation(st, new_location, axis);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
/* XXX can't we pack this in the "else" part of the if above? */
CommandCost ret = st->rect.BeforeAddRect(tile_org, w_org, h_org, StationRect::ADD_TEST);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
} else {
/* allocate and initialize new station */
@@ -1379,10 +1372,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
/* If there is a vehicle on ground, do not allow to remove (flood) the tile */
CommandCost ret = EnsureNoVehicleOnGround(tile);
- if (ret.Failed()) {
- ret.SetGlobalErrorMessage();
- continue;
- }
+ if (ret.Failed()) continue;
/* Check ownership of station */
T *st = T::GetByTile(tile);
@@ -1390,10 +1380,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
if (_current_company != OWNER_WATER) {
CommandCost ret = CheckOwnership(st->owner);
- if (ret.Failed()) {
- ret.SetGlobalErrorMessage();
- continue;
- }
+ if (ret.Failed()) continue;
}
/* Do not allow removing from stations if non-uniform stations are not enabled
@@ -1542,7 +1529,6 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags)
/* Current company owns the station? */
if (_current_company != OWNER_WATER) {
CommandCost ret = CheckOwnership(st->owner);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
@@ -1558,7 +1544,6 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags)
if (!st->TileBelongsToRailStation(tile)) continue;
CommandCost ret = EnsureNoVehicleOnGround(tile);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
cost.AddCost(_price[PR_CLEAR_STATION_RAIL]);
@@ -1725,7 +1710,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (is_drive_through && !IsValidAxis((Axis)ddir)) return CMD_ERROR;
CommandCost ret = CheckIfAuthorityAllowsNewStation(tile, flags);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
/* Total road stop cost. */
@@ -1737,7 +1721,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
Station *st = NULL;
ret = FindJoiningRoadStop(est, station_to_join, HasBit(p2, 5), roadstop_area, &st);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
/* Find a deleted station close to us */
@@ -1752,7 +1735,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
}
CommandCost ret = st->rect.BeforeAddRect(roadstop_area.tile, roadstop_area.w, roadstop_area.h, StationRect::ADD_TEST);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
} else {
/* allocate and initialize new station */
@@ -1846,7 +1828,6 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
if (_current_company != OWNER_WATER) {
CommandCost ret = CheckOwnership(st->owner);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
@@ -1870,7 +1851,6 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
if (flags & DC_EXEC) FindVehicleOnPos(tile, NULL, &ClearRoadStopStatusEnum);
} else {
CommandCost ret = EnsureNoVehicleOnGround(tile);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
@@ -2108,7 +2088,6 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
if (airport_type >= NUM_AIRPORTS) return CMD_ERROR;
CommandCost ret = CheckIfAuthorityAllowsNewStation(tile, flags);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
/* Check if a valid, buildable airport was chosen for construction */
@@ -2156,7 +2135,6 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
Station *st = NULL;
ret = FindJoiningStation(INVALID_STATION, station_to_join, HasBit(p2, 0), TileArea(tile, w, h), &st);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
/* Distant join */
@@ -2171,7 +2149,6 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
}
CommandCost ret = st->rect.BeforeAddRect(tile, w, h, StationRect::ADD_TEST);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
if (st->airport.tile != INVALID_TILE) {
@@ -2263,7 +2240,6 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
if (_current_company != OWNER_WATER) {
CommandCost ret = CheckOwnership(st->owner);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
}
@@ -2281,7 +2257,6 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
if (!st->TileBelongsToAirport(tile_cur)) continue;
CommandCost ret = EnsureNoVehicleOnGround(tile_cur);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
cost.AddCost(_price[PR_CLEAR_STATION_AIRPORT]);
@@ -2381,13 +2356,11 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if (IsWaterTile(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
CommandCost ret = CheckIfAuthorityAllowsNewStation(tile, flags);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
TileIndex tile_cur = tile + TileOffsByDiagDir(direction);
@@ -2402,7 +2375,6 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
WaterClass wc = GetWaterClass(tile_cur);
ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
tile_cur += TileOffsByDiagDir(direction);
@@ -2415,7 +2387,6 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
ret = FindJoiningStation(INVALID_STATION, station_to_join, HasBit(p1, 0),
TileArea(tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
_dock_w_chk[direction], _dock_h_chk[direction]), &st);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
/* Distant join */
@@ -2432,7 +2403,6 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
CommandCost ret = st->rect.BeforeAddRect(
tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
_dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TEST);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
if (st->dock_tile != INVALID_TILE) return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK);
@@ -2483,7 +2453,6 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
{
Station *st = Station::GetByTile(tile);
CommandCost ret = CheckOwnership(st->owner);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
TileIndex tile1 = st->dock_tile;
@@ -2491,7 +2460,6 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
ret = EnsureNoVehicleOnGround(tile1);
if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile2);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
if (flags & DC_EXEC) {
@@ -3222,7 +3190,6 @@ CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (st == NULL) return CMD_ERROR;
CommandCost ret = CheckOwnership(st->owner);
- ret.SetGlobalErrorMessage();
if (ret.Failed()) return ret;
bool reset = StrEmpty(text);