Mercurial > hg > openttd
annotate src/timetable_cmd.cpp @ 15868:5d8e60ba4e28 draft
(svn r20550) -Fix: documentation of CmdSetTimetableStart
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 18 Aug 2010 22:52:02 +0000 |
parents | 73f4e0e490b7 |
children | 708e732bb8a6 |
rev | line source |
---|---|
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
9 |
9111
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
8970
diff
changeset
|
10 /** @file timetable_cmd.cpp Commands related to time tabling. */ |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
11 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
12 #include "stdafx.h" |
8116
9cc845deddfe
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
7931
diff
changeset
|
13 #include "command_func.h" |
8131
e300ac8001ae
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents:
8116
diff
changeset
|
14 #include "functions.h" |
13767
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
15 #include "date_func.h" |
8131
e300ac8001ae
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents:
8116
diff
changeset
|
16 #include "window_func.h" |
8144
d18c8a0bb638
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium <rubidium@openttd.org>
parents:
8140
diff
changeset
|
17 #include "vehicle_base.h" |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
18 |
8264
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8254
diff
changeset
|
19 #include "table/strings.h" |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
20 |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
21 static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time, bool is_journey) |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
22 { |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11949
diff
changeset
|
23 Order *order = v->GetOrder(order_number); |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10499
diff
changeset
|
24 int delta; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
25 |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
26 if (is_journey) { |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10499
diff
changeset
|
27 delta = time - order->travel_time; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
28 order->travel_time = time; |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
29 } else { |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10499
diff
changeset
|
30 delta = time - order->wait_time; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
31 order->wait_time = time; |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
32 } |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10499
diff
changeset
|
33 v->orders.list->UpdateOrderTimetable(delta); |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
34 |
10033
cb5901118b1c
(svn r14192) -Fix [FS#2236]: properly update the current timetable's travel/wait times instead of only doing it for one vehicle in the shared order chain and only when some bit has not been set (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
9941
diff
changeset
|
35 for (v = v->FirstShared(); v != NULL; v = v->NextShared()) { |
cb5901118b1c
(svn r14192) -Fix [FS#2236]: properly update the current timetable's travel/wait times instead of only doing it for one vehicle in the shared order chain and only when some bit has not been set (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
9941
diff
changeset
|
36 if (v->cur_order_index == order_number && v->current_order.Equals(*order)) { |
cb5901118b1c
(svn r14192) -Fix [FS#2236]: properly update the current timetable's travel/wait times instead of only doing it for one vehicle in the shared order chain and only when some bit has not been set (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
9941
diff
changeset
|
37 if (is_journey) { |
cb5901118b1c
(svn r14192) -Fix [FS#2236]: properly update the current timetable's travel/wait times instead of only doing it for one vehicle in the shared order chain and only when some bit has not been set (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
9941
diff
changeset
|
38 v->current_order.travel_time = time; |
cb5901118b1c
(svn r14192) -Fix [FS#2236]: properly update the current timetable's travel/wait times instead of only doing it for one vehicle in the shared order chain and only when some bit has not been set (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
9941
diff
changeset
|
39 } else { |
cb5901118b1c
(svn r14192) -Fix [FS#2236]: properly update the current timetable's travel/wait times instead of only doing it for one vehicle in the shared order chain and only when some bit has not been set (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
9941
diff
changeset
|
40 v->current_order.wait_time = time; |
cb5901118b1c
(svn r14192) -Fix [FS#2236]: properly update the current timetable's travel/wait times instead of only doing it for one vehicle in the shared order chain and only when some bit has not been set (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
9941
diff
changeset
|
41 } |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
42 } |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
12778
diff
changeset
|
43 SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); |
7809
0b3ee8b9289c
(svn r11359) -Fix [FS#1381]: shared timetables were not properly refreshed with autofill.
rubidium <rubidium@openttd.org>
parents:
7066
diff
changeset
|
44 } |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
45 } |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
46 |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
47 /** |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
48 * Add or remove waiting times from an order. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
49 * @param tile Not used. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
50 * @param flags Operation to perform. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
51 * @param p1 Various bitstuffed elements |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
52 * - p1 = (bit 0-15) - Vehicle with the orders to change. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
53 * - p1 = (bit 16-23) - Order index to modify. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
54 * - p1 = (bit 24) - Whether to change the waiting time or the travelling |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
55 * time. |
8650
2fa51e7b4d1f
(svn r12296) -Fix [FS#1549]: restore timetable from backupped orders and add group ID to the backup
glx <glx@openttd.org>
parents:
8302
diff
changeset
|
56 * - p1 = (bit 25) - Whether p2 contains waiting and travelling time. |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
57 * @param p2 The amount of time to wait. |
8650
2fa51e7b4d1f
(svn r12296) -Fix [FS#1549]: restore timetable from backupped orders and add group ID to the backup
glx <glx@openttd.org>
parents:
8302
diff
changeset
|
58 * - p2 = (bit 0-15) - Waiting or travelling time as specified by p1 bit 24 if p1 bit 25 is not set, |
2fa51e7b4d1f
(svn r12296) -Fix [FS#1549]: restore timetable from backupped orders and add group ID to the backup
glx <glx@openttd.org>
parents:
8302
diff
changeset
|
59 * Travelling time if p1 bit 25 is set. |
2fa51e7b4d1f
(svn r12296) -Fix [FS#1549]: restore timetable from backupped orders and add group ID to the backup
glx <glx@openttd.org>
parents:
8302
diff
changeset
|
60 * - p2 = (bit 16-31) - Waiting time if p1 bit 25 is set |
13067
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
13034
diff
changeset
|
61 * @param text unused |
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
13034
diff
changeset
|
62 * @return the cost of this operation or an error |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
63 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11042
diff
changeset
|
64 CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
65 { |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9354
diff
changeset
|
66 if (!_settings_game.order.timetabling) return CMD_ERROR; |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
67 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
68 VehicleID veh = GB(p1, 0, 16); |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
69 |
11949
c89301974eb8
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
smatz <smatz@openttd.org>
parents:
11924
diff
changeset
|
70 Vehicle *v = Vehicle::GetIfValid(veh); |
14815
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
71 if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR; |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
72 |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
73 CommandCost ret = CheckOwnership(v->owner); |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
74 if (ret.Failed()) return ret; |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
75 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
76 VehicleOrderID order_number = GB(p1, 16, 8); |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11949
diff
changeset
|
77 Order *order = v->GetOrder(order_number); |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
78 if (order == NULL) return CMD_ERROR; |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
79 |
8650
2fa51e7b4d1f
(svn r12296) -Fix [FS#1549]: restore timetable from backupped orders and add group ID to the backup
glx <glx@openttd.org>
parents:
8302
diff
changeset
|
80 bool packed_time = HasBit(p1, 25); |
2fa51e7b4d1f
(svn r12296) -Fix [FS#1549]: restore timetable from backupped orders and add group ID to the backup
glx <glx@openttd.org>
parents:
8302
diff
changeset
|
81 bool is_journey = HasBit(p1, 24) || packed_time; |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
82 |
10227
091840e3062d
(svn r14450) -Fix [FS#2337]: time table restoring did check too restrictively causing order backups not to be properly restored.
rubidium <rubidium@openttd.org>
parents:
10033
diff
changeset
|
83 int wait_time = order->wait_time; |
091840e3062d
(svn r14450) -Fix [FS#2337]: time table restoring did check too restrictively causing order backups not to be properly restored.
rubidium <rubidium@openttd.org>
parents:
10033
diff
changeset
|
84 int travel_time = order->travel_time; |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
85 if (packed_time) { |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
86 travel_time = GB(p2, 0, 16); |
14561
c94cddea6802
(svn r19132) -Codechange: No need to end a line with ;;.
alberth <alberth@openttd.org>
parents:
13767
diff
changeset
|
87 wait_time = GB(p2, 16, 16); |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
88 } else if (is_journey) { |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
89 travel_time = GB(p2, 0, 16); |
9641
d6df5044bb40
(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.
rubidium <rubidium@openttd.org>
parents:
9413
diff
changeset
|
90 } else { |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
91 wait_time = GB(p2, 0, 16); |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
92 } |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
93 |
10227
091840e3062d
(svn r14450) -Fix [FS#2337]: time table restoring did check too restrictively causing order backups not to be properly restored.
rubidium <rubidium@openttd.org>
parents:
10033
diff
changeset
|
94 if (wait_time != order->wait_time) { |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
95 switch (order->GetType()) { |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
96 case OT_GOTO_STATION: |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
11991
diff
changeset
|
97 if (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) return_cmd_error(STR_ERROR_TIMETABLE_NOT_STOPPING_HERE); |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
98 break; |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
99 |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
100 case OT_CONDITIONAL: |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
101 break; |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
102 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
11991
diff
changeset
|
103 default: return_cmd_error(STR_ERROR_TIMETABLE_ONLY_WAIT_AT_STATIONS); |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
104 } |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
105 } |
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
106 |
10227
091840e3062d
(svn r14450) -Fix [FS#2337]: time table restoring did check too restrictively causing order backups not to be properly restored.
rubidium <rubidium@openttd.org>
parents:
10033
diff
changeset
|
107 if (travel_time != order->travel_time && order->IsType(OT_CONDITIONAL)) return CMD_ERROR; |
9665
294a2fc5d425
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium <rubidium@openttd.org>
parents:
9641
diff
changeset
|
108 |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
109 if (flags & DC_EXEC) { |
10227
091840e3062d
(svn r14450) -Fix [FS#2337]: time table restoring did check too restrictively causing order backups not to be properly restored.
rubidium <rubidium@openttd.org>
parents:
10033
diff
changeset
|
110 if (wait_time != order->wait_time) ChangeTimetable(v, order_number, wait_time, false); |
091840e3062d
(svn r14450) -Fix [FS#2337]: time table restoring did check too restrictively causing order backups not to be properly restored.
rubidium <rubidium@openttd.org>
parents:
10033
diff
changeset
|
111 if (travel_time != order->travel_time) ChangeTimetable(v, order_number, travel_time, true); |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
112 } |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
113 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
114 return CommandCost(); |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
115 } |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
116 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
117 /** |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
118 * Clear the lateness counter to make the vehicle on time. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
119 * @param tile Not used. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
120 * @param flags Operation to perform. |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
121 * @param p1 Various bitstuffed elements |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
122 * - p1 = (bit 0-15) - Vehicle with the orders to change. |
13067
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
13034
diff
changeset
|
123 * @param p2 unused |
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
13034
diff
changeset
|
124 * @param text unused |
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
13034
diff
changeset
|
125 * @return the cost of this operation or an error |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
126 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11042
diff
changeset
|
127 CommandCost CmdSetVehicleOnTime(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
128 { |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9354
diff
changeset
|
129 if (!_settings_game.order.timetabling) return CMD_ERROR; |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
130 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
131 VehicleID veh = GB(p1, 0, 16); |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
132 |
11949
c89301974eb8
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
smatz <smatz@openttd.org>
parents:
11924
diff
changeset
|
133 Vehicle *v = Vehicle::GetIfValid(veh); |
14815
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
134 if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR; |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
135 |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
136 CommandCost ret = CheckOwnership(v->owner); |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
137 if (ret.Failed()) return ret; |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
138 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
139 if (flags & DC_EXEC) { |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
140 v->lateness_counter = 0; |
13765
cf82bbe70093
(svn r18290) -Codechange: be more strict about what vehicles may use timetables
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
141 SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
142 } |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
143 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
144 return CommandCost(); |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
145 } |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
146 |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
147 /** |
13767
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
148 * Set the start date of the timetable. |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
149 * @param tile Not used. |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
150 * @param flags Operation to perform. |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
151 * @param p1 Vehicle id. |
15868
5d8e60ba4e28
(svn r20550) -Fix: documentation of CmdSetTimetableStart
rubidium <rubidium@openttd.org>
parents:
15050
diff
changeset
|
152 * @param p2 The timetable start date. |
5d8e60ba4e28
(svn r20550) -Fix: documentation of CmdSetTimetableStart
rubidium <rubidium@openttd.org>
parents:
15050
diff
changeset
|
153 * @param text Not used. |
5d8e60ba4e28
(svn r20550) -Fix: documentation of CmdSetTimetableStart
rubidium <rubidium@openttd.org>
parents:
15050
diff
changeset
|
154 * @return The error or cost of the operation. |
13767
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
155 */ |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
156 CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
157 { |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
158 if (!_settings_game.order.timetabling) return CMD_ERROR; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
159 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
160 Vehicle *v = Vehicle::GetIfValid(GB(p1, 0, 16)); |
14815
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
161 if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR; |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
162 |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
163 CommandCost ret = CheckOwnership(v->owner); |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
164 if (ret.Failed()) return ret; |
13767
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
165 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
166 /* Don't let a timetable start more than 15 years into the future or 1 year in the past. */ |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
167 Date start_date = (Date)p2; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
168 if (start_date < 0 || start_date > MAX_DAY) return CMD_ERROR; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
169 if (start_date - _date > 15 * DAYS_IN_LEAP_YEAR) return CMD_ERROR; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
170 if (_date - start_date > DAYS_IN_LEAP_YEAR) return CMD_ERROR; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
171 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
172 if (flags & DC_EXEC) { |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
173 v->lateness_counter = 0; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
174 ClrBit(v->vehicle_flags, VF_TIMETABLE_STARTED); |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
175 v->timetable_start = start_date; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
176 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
177 SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
178 } |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
179 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
180 return CommandCost(); |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
181 } |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
182 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
183 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
184 /** |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
185 * Start or stop filling the timetable automatically from the time the vehicle |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
186 * actually takes to complete it. When starting to autofill the current times |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
187 * are cleared and the timetable will start again from scratch. |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
188 * @param tile Not used. |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
189 * @param flags Operation to perform. |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
190 * @param p1 Vehicle index. |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
191 * @param p2 Various bitstuffed elements |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
192 * - p2 = (bit 0) - Set to 1 to enable, 0 to disable autofill. |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
193 * - p2 = (bit 1) - Set to 1 to preserve waiting times in non-destructive mode |
13067
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
13034
diff
changeset
|
194 * @param text unused |
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
13034
diff
changeset
|
195 * @return the cost of this operation or an error |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
196 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11042
diff
changeset
|
197 CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
198 { |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9354
diff
changeset
|
199 if (!_settings_game.order.timetabling) return CMD_ERROR; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
200 |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
201 VehicleID veh = GB(p1, 0, 16); |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
202 |
11949
c89301974eb8
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
smatz <smatz@openttd.org>
parents:
11924
diff
changeset
|
203 Vehicle *v = Vehicle::GetIfValid(veh); |
14815
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
204 if (v == NULL || !v->IsPrimaryVehicle()) return CMD_ERROR; |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
205 |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
206 CommandCost ret = CheckOwnership(v->owner); |
ad5c3430b2b2
(svn r19405) -Codechange: CheckOwnership() returns a CommandCost.
alberth <alberth@openttd.org>
parents:
14561
diff
changeset
|
207 if (ret.Failed()) return ret; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
208 |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
209 if (flags & DC_EXEC) { |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
210 if (HasBit(p2, 0)) { |
10677
698932d19cc4
(svn r14986) -Doc: small error in a comment (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
211 /* Start autofilling the timetable, which clears the |
698932d19cc4
(svn r14986) -Doc: small error in a comment (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
212 * "timetable has started" bit. Times are not cleared anymore, but are |
698932d19cc4
(svn r14986) -Doc: small error in a comment (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
213 * overwritten when the order is reached now. */ |
7931
44ff7a6d801f
(svn r11484) -Codechange: Remove the doubled function SetBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7929
diff
changeset
|
214 SetBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE); |
7929
4d13dbed828c
(svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7928
diff
changeset
|
215 ClrBit(v->vehicle_flags, VF_TIMETABLE_STARTED); |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
216 |
10677
698932d19cc4
(svn r14986) -Doc: small error in a comment (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
217 /* Overwrite waiting times only if they got longer */ |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
218 if (HasBit(p2, 1)) SetBit(v->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME); |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
219 |
13767
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
220 v->timetable_start = 0; |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
221 v->lateness_counter = 0; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
222 } else { |
7929
4d13dbed828c
(svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7928
diff
changeset
|
223 ClrBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE); |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
224 ClrBit(v->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME); |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
225 } |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
226 } |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
227 |
11042
3f6dbfd6e903
(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.
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
228 for (Vehicle *v2 = v->FirstShared(); v2 != NULL; v2 = v2->NextShared()) { |
3f6dbfd6e903
(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.
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
229 if (v2 != v) { |
3f6dbfd6e903
(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.
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
230 /* Stop autofilling; only one vehicle at a time can perform autofill */ |
3f6dbfd6e903
(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.
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
231 ClrBit(v2->vehicle_flags, VF_AUTOFILL_TIMETABLE); |
3f6dbfd6e903
(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.
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
232 ClrBit(v2->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME); |
3f6dbfd6e903
(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.
rubidium <rubidium@openttd.org>
parents:
10960
diff
changeset
|
233 } |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
12778
diff
changeset
|
234 SetWindowDirty(WC_VEHICLE_TIMETABLE, v2->index); |
7809
0b3ee8b9289c
(svn r11359) -Fix [FS#1381]: shared timetables were not properly refreshed with autofill.
rubidium <rubidium@openttd.org>
parents:
7066
diff
changeset
|
235 } |
0b3ee8b9289c
(svn r11359) -Fix [FS#1381]: shared timetables were not properly refreshed with autofill.
rubidium <rubidium@openttd.org>
parents:
7066
diff
changeset
|
236 |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
237 return CommandCost(); |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
238 } |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
239 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
240 void UpdateVehicleTimetable(Vehicle *v, bool travelling) |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
241 { |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
242 uint timetabled = travelling ? v->current_order.travel_time : v->current_order.wait_time; |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
243 uint time_taken = v->current_order_time; |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
244 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
245 v->current_order_time = 0; |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
246 |
9413
512ea64da840
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents:
9354
diff
changeset
|
247 if (!_settings_game.order.timetabling) return; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
248 |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
249 bool just_started = false; |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
250 |
13767
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
251 /* This vehicle is arriving at the first destination in the timetable. */ |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
252 if (v->cur_order_index == 0 && travelling) { |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
253 /* If the start date hasn't been set, or it was set automatically when |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
254 * the vehicle last arrived at the first destination, update it to the |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
255 * current time. Otherwise set the late counter appropriately to when |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
256 * the vehicle should have arrived. */ |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
257 just_started = !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED); |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
258 |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
259 if (v->timetable_start != 0) { |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
260 v->lateness_counter = (_date - v->timetable_start) * DAY_TICKS + _date_fract; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
261 v->timetable_start = 0; |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
262 } |
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
263 |
8970
3667cbc7dc1d
(svn r12762) -Fix: tabs after the first non-tab character are generally not okay (or lines starting with a space and then tabs).
rubidium <rubidium@openttd.org>
parents:
8853
diff
changeset
|
264 SetBit(v->vehicle_flags, VF_TIMETABLE_STARTED); |
13767
3b79b87a3fcb
(svn r18292) -Codechange: add a command to set the start date of a timetable. Based on work by PhilSophus.
rubidium <rubidium@openttd.org>
parents:
13765
diff
changeset
|
265 SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); |
8970
3667cbc7dc1d
(svn r12762) -Fix: tabs after the first non-tab character are generally not okay (or lines starting with a space and then tabs).
rubidium <rubidium@openttd.org>
parents:
8853
diff
changeset
|
266 } |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
267 |
7928
4e8dfd103163
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7809
diff
changeset
|
268 if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) return; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
269 |
8970
3667cbc7dc1d
(svn r12762) -Fix: tabs after the first non-tab character are generally not okay (or lines starting with a space and then tabs).
rubidium <rubidium@openttd.org>
parents:
8853
diff
changeset
|
270 if (HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)) { |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
271 if (travelling && !HasBit(v->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME)) { |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
272 /* Need to clear that now as otherwise we are not able to reduce the wait time */ |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
273 v->current_order.wait_time = 0; |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
274 } |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
275 |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
276 if (just_started) return; |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
277 |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
278 /* Modify station waiting time only if our new value is larger (this is |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
279 * always the case when we cleared the timetable). */ |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
280 if (!v->current_order.IsType(OT_CONDITIONAL) && (travelling || time_taken > v->current_order.wait_time)) { |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
281 /* Round the time taken up to the nearest day, as this will avoid |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
282 * confusion for people who are timetabling in days, and can be |
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
283 * adjusted later by people who aren't. */ |
15050
73f4e0e490b7
(svn r19670) -Codechange: Add CeilDiv() and RoundDiv() to simplify integer divisions with rounding.
frosch <frosch@openttd.org>
parents:
14898
diff
changeset
|
284 time_taken = CeilDiv(time_taken, DAY_TICKS) * DAY_TICKS; |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
285 |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
286 ChangeTimetable(v, v->cur_order_index, time_taken, travelling); |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
287 } |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
288 |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
289 if (v->cur_order_index == 0 && travelling) { |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
290 /* If we just started we would have returned earlier and have not reached |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
291 * this code. So obviously, we have completed our round: So turn autofill |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
292 * off again. */ |
7929
4d13dbed828c
(svn r11482) -Codechange: Remove the doubled function ClrBitT and rename the remaining to fit with the naming style
skidd13 <skidd13@openttd.org>
parents:
7928
diff
changeset
|
293 ClrBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE); |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
294 ClrBit(v->vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME); |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
295 } |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
296 return; |
8970
3667cbc7dc1d
(svn r12762) -Fix: tabs after the first non-tab character are generally not okay (or lines starting with a space and then tabs).
rubidium <rubidium@openttd.org>
parents:
8853
diff
changeset
|
297 } |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
298 |
10341
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
299 if (just_started) return; |
3f3ad0911cdc
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10227
diff
changeset
|
300 |
7062
1a0ddc74cd95
(svn r10327) -Fix (r10236) [FS#934]: Vehicles wait at stations when they arrive early even
maedhros <maedhros@openttd.org>
parents:
6981
diff
changeset
|
301 /* Vehicles will wait at stations if they arrive early even if they are not |
1a0ddc74cd95
(svn r10327) -Fix (r10236) [FS#934]: Vehicles wait at stations when they arrive early even
maedhros <maedhros@openttd.org>
parents:
6981
diff
changeset
|
302 * timetabled to wait there, so make sure the lateness counter is updated |
1a0ddc74cd95
(svn r10327) -Fix (r10236) [FS#934]: Vehicles wait at stations when they arrive early even
maedhros <maedhros@openttd.org>
parents:
6981
diff
changeset
|
303 * when this happens. */ |
7066
bd6373f5acf4
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros <maedhros@openttd.org>
parents:
7062
diff
changeset
|
304 if (timetabled == 0 && (travelling || v->lateness_counter >= 0)) return; |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
305 |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
306 v->lateness_counter -= (timetabled - time_taken); |
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
307 |
9941
53ba5561b1c2
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium <rubidium@openttd.org>
parents:
9829
diff
changeset
|
308 for (v = v->FirstShared(); v != NULL; v = v->NextShared()) { |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
12778
diff
changeset
|
309 SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index); |
7809
0b3ee8b9289c
(svn r11359) -Fix [FS#1381]: shared timetables were not properly refreshed with autofill.
rubidium <rubidium@openttd.org>
parents:
7066
diff
changeset
|
310 } |
6981
ba2c96d43e77
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros <maedhros@openttd.org>
parents:
diff
changeset
|
311 } |