author | truelight |
Thu, 24 Mar 2005 14:43:40 +0000 | |
changeset 1540 | 6eef12dab5bf |
parent 1530 | 2b46869fc0d4 |
child 1615 | 24c6310f887b |
permissions | -rw-r--r-- |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
1 |
#ifndef ORDER_H |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
2 |
#define ORDER_H |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
3 |
|
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
4 |
#include "pool.h" |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
5 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
6 |
/* Order types */ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
7 |
enum { |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
8 |
OT_NOTHING = 0, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
9 |
OT_GOTO_STATION = 1, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
10 |
OT_GOTO_DEPOT = 2, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
11 |
OT_LOADING = 3, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
12 |
OT_LEAVESTATION = 4, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
13 |
OT_DUMMY = 5, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
14 |
OT_GOTO_WAYPOINT = 6 |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
15 |
}; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
16 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
17 |
/* Order flags -- please use OFB instead OF and use HASBIT/SETBIT/CLEARBIT */ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
18 |
enum { |
1530
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
19 |
//Flags for stations: |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
20 |
OF_UNLOAD = 0x2, |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
21 |
OF_FULL_LOAD = 0x4, // Also used when to force an aircraft into a depot |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
22 |
|
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
23 |
//Flags for depots: |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
24 |
OF_PART_OF_ORDERS = 0x2, |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
25 |
OF_HALT_IN_DEPOT = 0x4, |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
26 |
|
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
27 |
//Common flags |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
28 |
OF_NON_STOP = 0x8 |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
29 |
}; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
30 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
31 |
/* Order flags bits */ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
32 |
enum { |
1530
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
33 |
OFB_UNLOAD = 1, |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
34 |
OFB_FULL_LOAD = 2, |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
35 |
OFB_PART_OF_ORDERS = 1, |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
36 |
OFB_HALT_IN_DEPOT = 2, |
2b46869fc0d4
(svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents:
1314
diff
changeset
|
37 |
OFB_NON_STOP = 3 |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
38 |
}; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
39 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
40 |
/* Possible clone options */ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
41 |
enum { |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
42 |
CO_SHARE = 0, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
43 |
CO_COPY = 1, |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
44 |
CO_UNSHARE = 2 |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
45 |
}; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
46 |
|
1053
8d90844ddc2e
(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
celestar
parents:
1043
diff
changeset
|
47 |
/* Modes for the order checker */ |
8d90844ddc2e
(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
celestar
parents:
1043
diff
changeset
|
48 |
enum { |
8d90844ddc2e
(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
celestar
parents:
1043
diff
changeset
|
49 |
OC_INIT = 0, //the order checker can initialize a news message |
8d90844ddc2e
(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
celestar
parents:
1043
diff
changeset
|
50 |
OC_VALIDATE = 1, //the order checker validates a news message |
8d90844ddc2e
(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
celestar
parents:
1043
diff
changeset
|
51 |
}; |
8d90844ddc2e
(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
celestar
parents:
1043
diff
changeset
|
52 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
53 |
/* If you change this, keep in mind that it is saved on 3 places: |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
54 |
- Load_ORDR, all the global orders |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
55 |
- Vehicle -> current_order |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
56 |
- REF_SHEDULE (all REFs are currently limited to 16 bits!!) */ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
57 |
typedef struct Order { |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
58 |
uint8 type; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
59 |
uint8 flags; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
60 |
uint16 station; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
61 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
62 |
struct Order *next; //! Pointer to next order. If NULL, end of list |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
63 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
64 |
uint16 index; //! Index of the order, is not saved or anything, just for reference |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
65 |
} Order; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
66 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
67 |
typedef struct { |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
68 |
VehicleID clone; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
69 |
byte orderindex; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
70 |
Order order[41]; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
71 |
uint16 service_interval; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
72 |
char name[32]; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
73 |
} BackuppedOrders; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
74 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
75 |
VARDEF TileIndex _backup_orders_tile; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
76 |
VARDEF BackuppedOrders _backup_orders_data[1]; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
77 |
|
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
78 |
extern MemoryPool _order_pool; |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
79 |
|
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
80 |
/** |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
81 |
* Get the pointer to the order with index 'index' |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
82 |
*/ |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
83 |
static inline Order *GetOrder(uint index) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
84 |
{ |
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
85 |
return (Order*)GetItemFromPool(&_order_pool, index); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
86 |
} |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
87 |
|
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
88 |
/** |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
89 |
* Get the current size of the OrderPool |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
90 |
*/ |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
91 |
static inline uint16 GetOrderPoolSize(void) |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
92 |
{ |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
93 |
return _order_pool.total_items; |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
94 |
} |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
95 |
|
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
96 |
#define FOR_ALL_ORDERS_FROM(order, start) for (order = GetOrder(start); order != NULL; order = (order->index + 1 < GetOrderPoolSize()) ? GetOrder(order->index + 1) : NULL) |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
97 |
#define FOR_ALL_ORDERS(order) FOR_ALL_ORDERS_FROM(order, 0) |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
98 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
99 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
100 |
#define FOR_VEHICLE_ORDERS(v, order) for (order = v->orders; order != NULL; order = order->next) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
101 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
102 |
static inline bool HasOrderPoolFree(uint amount) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
103 |
{ |
1043
44508ede2f92
(svn r1544) -Fix: SwapOrder did not use AssignOrder, which caused the saveroutine to
truelight
parents:
1024
diff
changeset
|
104 |
const Order *order; |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
105 |
|
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
106 |
/* There is always room if not all blocks in the pool are reserved */ |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
107 |
if (_order_pool.current_blocks < _order_pool.max_blocks) |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
108 |
return true; |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
109 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
110 |
FOR_ALL_ORDERS(order) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
111 |
if (order->type == OT_NOTHING) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
112 |
if (--amount == 0) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
113 |
return true; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
114 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
115 |
return false; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
116 |
} |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
117 |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1053
diff
changeset
|
118 |
static inline bool IsOrderPoolFull(void) |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
119 |
{ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
120 |
return !HasOrderPoolFree(1); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
121 |
} |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
122 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
123 |
/* Pack and unpack routines */ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
124 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
125 |
static inline uint32 PackOrder(const Order *order) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
126 |
{ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
127 |
return order->station << 16 | order->flags << 8 | order->type; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
128 |
} |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
129 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
130 |
static inline Order UnpackOrder(uint32 packed) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
131 |
{ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
132 |
Order order; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
133 |
order.type = (packed & 0x000000FF); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
134 |
order.flags = (packed & 0x0000FF00) >> 8; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
135 |
order.station = (packed & 0xFFFF0000) >> 16; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
136 |
order.next = NULL; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
137 |
return order; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
138 |
} |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
139 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
140 |
/* Functions */ |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
141 |
void BackupVehicleOrders(Vehicle *v, BackuppedOrders *order); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
142 |
void RestoreVehicleOrders(Vehicle *v, BackuppedOrders *order); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
143 |
void DeleteDestinationFromVehicleOrder(Order dest); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
144 |
void InvalidateVehicleOrder(const Vehicle *v); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
145 |
bool VehicleHasDepotOrders(const Vehicle *v); |
1053
8d90844ddc2e
(svn r1554) -Fix: [ 1103187 ] Order Check messages are now validated before
celestar
parents:
1043
diff
changeset
|
146 |
bool CheckOrders(uint data_a, uint data_b); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
147 |
void DeleteVehicleOrders(Vehicle *v); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
148 |
bool IsOrderListShared(const Vehicle *v); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
149 |
void AssignOrder(Order *order, Order data); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
150 |
bool CheckForValidOrders(Vehicle *v); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
151 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
152 |
Order UnpackVersion4Order(uint16 packed); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
153 |
Order UnpackOldOrder(uint16 packed); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
154 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
155 |
#endif /* ORDER_H */ |