summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-10-08 11:29:17 +0000
committerrubidium <rubidium@openttd.org>2008-10-08 11:29:17 +0000
commita34bd150fe85f54ec15c975231dceef260511ff6 (patch)
tree7a3ea6e3d7733ff005104220cf71deba09aff7b2
parent1d2fbbc8a701715dd07f96167459a671a6e463ef (diff)
downloadopenttd-a34bd150fe85f54ec15c975231dceef260511ff6.tar.xz
(svn r14450) -Fix [FS#2337]: time table restoring did check too restrictively causing order backups not to be properly restored.
-rw-r--r--src/timetable_cmd.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 0aa856ca9..03a84bde9 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -68,8 +68,8 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
bool packed_time = HasBit(p1, 25);
bool is_journey = HasBit(p1, 24) || packed_time;
- int wait_time = -1;
- int travel_time = -1;
+ int wait_time = order->wait_time;
+ int travel_time = order->travel_time;
if (packed_time) {
travel_time = GB(p2, 0, 16);
wait_time = GB(p2, 16, 16);;
@@ -79,7 +79,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
wait_time = GB(p2, 0, 16);
}
- if (wait_time != -1) {
+ if (wait_time != order->wait_time) {
switch (order->GetType()) {
case OT_GOTO_STATION:
if (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
@@ -92,11 +92,11 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
}
}
- if (travel_time != -1 && order->IsType(OT_CONDITIONAL)) return CMD_ERROR;
+ if (travel_time != order->travel_time && order->IsType(OT_CONDITIONAL)) return CMD_ERROR;
if (flags & DC_EXEC) {
- if (wait_time != -1) ChangeTimetable(v, order_number, wait_time, false);
- if (travel_time != -1) ChangeTimetable(v, order_number, travel_time, true);
+ if (wait_time != order->wait_time) ChangeTimetable(v, order_number, wait_time, false);
+ if (travel_time != order->travel_time) ChangeTimetable(v, order_number, travel_time, true);
}
return CommandCost();