Mercurial > hg > openttd
changeset 15467:cfc3beb1cf80 draft
(svn r20116) -Add: Show an specific error message when trying to convert/remove nonexistant signals.
author | terkhen <terkhen@openttd.org> |
---|---|
date | Sat, 10 Jul 2010 20:18:59 +0000 |
parents | 176e340884a9 |
children | fb3a6c7e621a |
files | src/lang/english.txt src/rail_cmd.cpp |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3551,6 +3551,7 @@ 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_THERE_ARE_NO_SIGNALS :{WHITE}...there are no signals STR_ERROR_CAN_T_CONVERT_RAIL :{WHITE}Can't convert railtype here...
--- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -948,7 +948,7 @@ if (HasBit(p1, 17) && HasSignalOnTrack(tile, track)) return CommandCost(); /* you can not convert a signal if no signal is on track */ - if (convert_signal && !HasSignalOnTrack(tile, track)) return CMD_ERROR; + if (convert_signal && !HasSignalOnTrack(tile, track)) return_cmd_error(STR_ERROR_THERE_ARE_NO_SIGNALS); CommandCost cost; if (!HasSignalOnTrack(tile, track)) { @@ -1220,7 +1220,11 @@ had_success = true; total_cost.AddCost(ret); } else { - last_error = ret; + /* The "No railway" error is the least important one. */ + if (ret.GetErrorMessage() != STR_ERROR_THERE_IS_NO_RAILROAD_TRACK || + last_error.GetErrorMessage() == INVALID_STRING_ID) { + last_error = ret; + } } } @@ -1288,7 +1292,7 @@ return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK); } if (!HasSignalOnTrack(tile, track)) { - return CMD_ERROR; + return_cmd_error(STR_ERROR_THERE_ARE_NO_SIGNALS); } CommandCost ret = EnsureNoTrainOnTrack(tile, track); if (ret.Failed()) return ret;