Mercurial > hg > openttd
changeset 15465:8c1ec9acb54c draft
(svn r20114) -Add: Show an specific error message when trying to remove rail or build/convert/remove signals over nonexistant railways.
author | terkhen <terkhen@openttd.org> |
---|---|
date | Sat, 10 Jul 2010 20:15:35 +0000 |
parents | e526f1e34127 |
children | 176e340884a9 |
files | src/lang/english.txt src/rail_cmd.cpp |
diffstat | 2 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3549,6 +3549,7 @@ STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK :{WHITE}Can't remove railway track from here... STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM :{WHITE}Can't remove signals from here... STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE :{WHITE}Can't convert signals here... +STR_ERROR_THERE_IS_NO_RAILROAD_TRACK :{WHITE}...there is no railway track STR_ERROR_CAN_T_CONVERT_RAIL :{WHITE}Can't convert railtype here...
--- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -517,7 +517,7 @@ switch (GetTileType(tile)) { case MP_ROAD: { - if (!IsLevelCrossing(tile) || GetCrossingRailBits(tile) != trackbit) return CMD_ERROR; + if (!IsLevelCrossing(tile) || GetCrossingRailBits(tile) != trackbit) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); if (_current_company != OWNER_WATER) { CommandCost ret = CheckTileOwnership(tile); @@ -545,8 +545,8 @@ case MP_RAILWAY: { TrackBits present; - - if (!IsPlainRail(tile)) return CMD_ERROR; + /* There are no rails present at depots. */ + if (!IsPlainRail(tile)) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); if (_current_company != OWNER_WATER) { CommandCost ret = CheckTileOwnership(tile); @@ -557,7 +557,7 @@ if (ret.Failed()) return ret; present = GetTrackBits(tile); - if ((present & trackbit) == 0) return CMD_ERROR; + if ((present & trackbit) == 0) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); if (present == (TRACK_BIT_X | TRACK_BIT_Y)) crossing = true; cost.AddCost(RailClearCost(GetRailType(tile))); @@ -590,7 +590,7 @@ break; } - default: return CMD_ERROR; + default: return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); } if (flags & DC_EXEC) { @@ -923,7 +923,7 @@ /* You can only build signals on plain rail tiles, and the selected track must exist */ if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || !HasTrack(tile, track)) { - return CMD_ERROR; + return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); } CommandCost ret = EnsureNoTrainOnTrack(tile, track); if (ret.Failed()) return ret; @@ -1149,7 +1149,7 @@ TileIndex end_tile = p1; if (signal_density == 0 || signal_density > 20) return CMD_ERROR; - if (!IsPlainRailTile(tile)) return CMD_ERROR; + if (!IsPlainRailTile(tile)) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); /* for vertical/horizontal tracks, double the given signals density * since the original amount will be too dense (shorter tracks) */ @@ -1284,10 +1284,10 @@ { Track track = Extract<Track, 0, 3>(p1); - if (!ValParamTrackOrientation(track) || - !IsPlainRailTile(tile) || - !HasTrack(tile, track) || - !HasSignalOnTrack(tile, track)) { + if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || !HasTrack(tile, track)) { + return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); + } + if (!HasSignalOnTrack(tile, track)) { return CMD_ERROR; } CommandCost ret = EnsureNoTrainOnTrack(tile, track);