summaryrefslogtreecommitdiff
path: root/src/timetable_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-07-14 21:01:49 +0000
committerrubidium <rubidium@openttd.org>2008-07-14 21:01:49 +0000
commit2e68b35106a8e9e29372594c75b37172d90c434f (patch)
treec04eab66f4437af132445671a76f32e893f6e47d /src/timetable_cmd.cpp
parent68613f4ba045bc783b425e5213ebe5f318147b5a (diff)
downloadopenttd-2e68b35106a8e9e29372594c75b37172d90c434f.tar.xz
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
Diffstat (limited to 'src/timetable_cmd.cpp')
-rw-r--r--src/timetable_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 49384b03d..98c13a609 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -69,8 +69,10 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
bool packed_time = HasBit(p1, 25);
bool is_journey = HasBit(p1, 24) || packed_time;
if (!is_journey) {
- if (!order->IsType(OT_GOTO_STATION)) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
+ if (!order->IsType(OT_GOTO_STATION) && !order->IsType(OT_CONDITIONAL)) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
if (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
+ } else {
+ if (order->IsType(OT_CONDITIONAL)) return CMD_ERROR;
}
if (flags & DC_EXEC) {
@@ -175,7 +177,9 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
* adjusted later by people who aren't. */
time_taken = (((time_taken - 1) / DAY_TICKS) + 1) * DAY_TICKS;
- ChangeTimetable(v, v->cur_order_index, time_taken, travelling);
+ if (!v->current_order.IsType(OT_CONDITIONAL)) {
+ ChangeTimetable(v, v->cur_order_index, time_taken, travelling);
+ }
return;
} else if (v->cur_order_index == 0) {
/* Otherwise if we're at the beginning and it already has a value,