(svn r9532) -Fix (r8741) [FS#708]: Make errors when building drive through road stops more descriptive.
authormaedhros
Sat, 31 Mar 2007 09:53:40 +0000
changeset 6898 fa8a3e592990
parent 6897 dcee0e80200b
child 6899 9fef750f15c5
(svn r9532) -Fix (r8741) [FS#708]: Make errors when building drive through road stops more descriptive.
src/lang/english.txt
src/station_cmd.cpp
--- a/src/lang/english.txt	Sat Mar 31 08:24:05 2007 +0000
+++ b/src/lang/english.txt	Sat Mar 31 09:53:40 2007 +0000
@@ -3149,3 +3149,5 @@
 ########
 
 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
--- a/src/station_cmd.cpp	Sat Mar 31 08:24:05 2007 +0000
+++ b/src/station_cmd.cpp	Sat Mar 31 09:53:40 2007 +0000
@@ -1190,9 +1190,12 @@
 	/* 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);