summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-05-13 21:04:12 +0000
committerrubidium <rubidium@openttd.org>2013-05-13 21:04:12 +0000
commit0d05b8a0fbc6e00b7024c7dfd661171594d8fc64 (patch)
tree6984272b38191dec7281781b5f572a50ca6a5636 /src/station_cmd.cpp
parentdf126a24de4fd9c41d8b5669996815d550b92d11 (diff)
downloadopenttd-0d05b8a0fbc6e00b7024c7dfd661171594d8fc64.tar.xz
(svn r25243) -Fix [FS#5546]: "No station" error was given, even when there was a station that way occupied or not yours
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 34304fbd4..ce3a16e4d 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1422,6 +1422,10 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
/* Count of the number of tiles removed */
int quantity = 0;
CommandCost total_cost(EXPENSES_CONSTRUCTION);
+ /* Accumulator for the errors seen during clearing. If no errors happen,
+ * and the quantity is 0 there is no station. Otherwise it will be one
+ * of the other error that got accumulated. */
+ CommandCost error;
/* Do the action for every tile into the area */
TILE_AREA_LOOP(tile, ta) {
@@ -1430,6 +1434,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);
+ error.AddCost(ret);
if (ret.Failed()) continue;
/* Check ownership of station */
@@ -1438,6 +1443,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
if (_current_company != OWNER_WATER) {
CommandCost ret = CheckOwnership(st->owner);
+ error.AddCost(ret);
if (ret.Failed()) continue;
}
@@ -1497,7 +1503,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
}
}
- if (quantity == 0) return_cmd_error(STR_ERROR_THERE_IS_NO_STATION);
+ if (quantity == 0) return error.Failed() ? error : CommandCost(STR_ERROR_THERE_IS_NO_STATION);
for (T **stp = affected_stations.Begin(); stp != affected_stations.End(); stp++) {
T *st = *stp;