# HG changeset patch # User terkhen # Date 2010-07-10 20:18:59 # Node ID 4874828c361b0718fe076f6f7b7225676d597646 # Parent cc96258f112272b161f72168a5ede26a1566f12b (svn r20116) -Add: Show an specific error message when trying to convert/remove nonexistant signals. diff --git a/src/lang/english.txt b/src/lang/english.txt --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3551,6 +3551,7 @@ STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK 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... diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -948,7 +948,7 @@ CommandCost CmdBuildSingleSignal(TileInd 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 @@ static CommandCost CmdSignalTrackHelper( 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 @@ CommandCost CmdRemoveSingleSignal(TileIn 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;