summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-04-26 21:48:22 +0000
committerDarkvater <darkvater@openttd.org>2006-04-26 21:48:22 +0000
commitfeefbbbf06eacaf857f6cd7cdbb8216b8e6b97dc (patch)
treed896d9ae3cc601842ad7147e66fd7eb298394619 /rail_cmd.c
parent939dd7d2bf4da9adfe71e0a4294dc419663d0b0e (diff)
downloadopenttd-feefbbbf06eacaf857f6cd7cdbb8216b8e6b97dc.tar.xz
(svn r4586) - Codechange: Recursive commands that rely on _error_message to handle success/failure can fail if a recursive call fails but doesn't set the error message, thus resulting in an old, possibly erroneous being used (see FS#130 prior to r4585). Now properly reset the global variable _error_message in these cases.
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 6f7113169..20d14445f 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -511,8 +511,8 @@ static int32 CmdRailTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint32
ret = DoCommand(tile, railtype, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
if (CmdFailed(ret)) {
- if ((_error_message != STR_1007_ALREADY_BUILT) && (mode == 0))
- break;
+ if ((_error_message != STR_1007_ALREADY_BUILT) && (mode == 0)) break;
+ _error_message = INVALID_STRING_ID;
} else
total_cost += ret;
@@ -771,6 +771,7 @@ static int32 CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint3
* This includes vehicles on track, competitor's tracks, etc. */
if (CmdFailed(ret)) {
if (_error_message != STR_1005_NO_SUITABLE_RAILROAD_TRACK && mode != 1) return CMD_ERROR;
+ _error_message = INVALID_STRING_ID;
} else {
error = false;
total_cost += ret;