summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
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 /src/rail_cmd.cpp
parentbb247132182238960ea0a7b1c26c43fd30c42fe7 (diff)
downloadopenttd-066aa61a458814f101e8ca5ec225d5f1c2f5c4ca.tar.xz
(svn r20116) -Add: Show an specific error message when trying to convert/remove nonexistant signals.
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp10
1 files changed, 7 insertions, 3 deletions
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;