summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-07-10 20:18:59 +0000
committerterkhen <terkhen@openttd.org>2010-07-10 20:18:59 +0000
commit066aa61a458814f101e8ca5ec225d5f1c2f5c4ca (patch)
treeeadfb4592ad3dcafca923b37a59f1cf7cea2e6ca
parentbb247132182238960ea0a7b1c26c43fd30c42fe7 (diff)
downloadopenttd-066aa61a458814f101e8ca5ec225d5f1c2f5c4ca.tar.xz
(svn r20116) -Add: Show an specific error message when trying to convert/remove nonexistant signals.
-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;