summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-03-31 09:53:40 +0000
committermaedhros <maedhros@openttd.org>2007-03-31 09:53:40 +0000
commit9c88baee675fd1e7c64f1bfd48a45bf4b7d6c246 (patch)
treef310c543d5e9a6fe7a967d260e6a19a8711020ac
parent3ac05f25dbdaf27ef0a9f20513036e898614cd34 (diff)
downloadopenttd-9c88baee675fd1e7c64f1bfd48a45bf4b7d6c246.tar.xz
(svn r9532) -Fix (r8741) [FS#708]: Make errors when building drive through road stops more descriptive.
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/station_cmd.cpp7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index e4961c8cf..c32c0fca2 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -3149,3 +3149,5 @@ STR_DATE_LONG :{STRING} {STRIN
########
STR_FEEDER_CARGO_VALUE :{BLACK}Transfer Credits: {LTBLUE}{CURRENCY}
+STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD :{WHITE}...this is a town owned road
+STR_DRIVE_THROUGH_ERROR_DIRECTION :{WHITE}...road facing in the wrong direction
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 00f77d44f..e9bc286c2 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1190,9 +1190,12 @@ int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* If it is a drive-through stop check for valid axis */
if (is_drive_through && !IsValidAxis((Axis)p1)) return CMD_ERROR;
/* Road bits in the wrong direction */
- if (build_over_road && (GetRoadBits(tile) & ((Axis)p1 == AXIS_X ? ROAD_Y : ROAD_X)) != 0) return CMD_ERROR;
+ if (build_over_road && (GetRoadBits(tile) & ((Axis)p1 == AXIS_X ? ROAD_Y : ROAD_X)) != 0) return_cmd_error(STR_DRIVE_THROUGH_ERROR_DIRECTION);
/* Not allowed to build over this road */
- if (build_over_road && !IsTileOwner(tile, _current_player) && !(IsTileOwner(tile, OWNER_TOWN) && _patches.road_stop_on_town_road)) return CMD_ERROR;
+ if (build_over_road) {
+ if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
+ if (!IsTileOwner(tile, OWNER_TOWN) && !CheckOwnership(GetTileOwner(tile))) return CMD_ERROR;
+ }
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);