summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-02-06 21:30:18 +0000
committerrubidium <rubidium@openttd.org>2009-02-06 21:30:18 +0000
commit0caa32816f35d71761652164f170f227714ff9c8 (patch)
treeafc913c9baade8001e060581ad688cc4b010d190
parent6f9d6ffe80774a7667bb3a0efafe97ede09ed764 (diff)
downloadopenttd-0caa32816f35d71761652164f170f227714ff9c8.tar.xz
(svn r15382) -Fix [FS#2466]: multiple vehicles could be filling the timetable and only the data from one vehicle would be taken. Now only allow one to be filling at a time.
-rw-r--r--src/timetable_cmd.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 7ff52684c..030ca63c8 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -166,8 +166,13 @@ CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32
}
}
- for (v = v->FirstShared(); v != NULL; v = v->NextShared()) {
- InvalidateWindow(WC_VEHICLE_TIMETABLE, v->index);
+ for (Vehicle *v2 = v->FirstShared(); v2 != NULL; v2 = v2->NextShared()) {
+ if (v2 != v) {
+ /* Stop autofilling; only one vehicle at a time can perform autofill */
+ ClrBit(v2->vehicle_flags, VF_AUTOFILL_TIMETABLE);
+ ClrBit(v2->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME);
+ }
+ InvalidateWindow(WC_VEHICLE_TIMETABLE, v2->index);
}
return CommandCost();