summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/rail_cmd.cpp10
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 58dc611ad..0231761ef 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -3551,6 +3551,7 @@ STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK :{WHITE}Can't re
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
index 68f39c73f..0bcae1a66 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -948,7 +948,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1,
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(TileIndex tile, DoCommandFlag flags, uin
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(TileIndex tile, DoCommandFlag flags, uint32 p1
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;