author | Tero Marttila <terom@fixme.fi> |
Fri, 19 Dec 2008 02:20:26 +0200 | |
changeset 10441 | d09735696a9e |
parent 10341 | 840daea3d9a2 |
permissions | -rw-r--r-- |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
2 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
3 |
/** @file vehicle_base.h Base class for all vehicles. */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
4 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
5 |
#ifndef VEHICLE_BASE_H |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
6 |
#define VEHICLE_BASE_H |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
7 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
8 |
#include "vehicle_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
9 |
#include "track_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
10 |
#include "rail_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
11 |
#include "road_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
12 |
#include "cargo_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
13 |
#include "direction_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
14 |
#include "gfx_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
15 |
#include "command_type.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
16 |
#include "date_type.h" |
10208
72c00af5c95d
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium
parents:
10207
diff
changeset
|
17 |
#include "company_base.h" |
72c00af5c95d
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium
parents:
10207
diff
changeset
|
18 |
#include "company_type.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
19 |
#include "oldpool.h" |
8784
c2e9d649a9ce
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium
parents:
8777
diff
changeset
|
20 |
#include "order_base.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
21 |
#include "cargopacket.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
22 |
#include "texteff.hpp" |
8770
ea070bc7bdad
(svn r12469) -Codechange: split type related stuff from group.h (and openttd.h) to group_type.h.
rubidium
parents:
8666
diff
changeset
|
23 |
#include "group_type.h" |
8777
5ba12006e339
(svn r12476) -Codechange: split type engine related types from engine.h (and openttd.h) to engine_type.h.
rubidium
parents:
8770
diff
changeset
|
24 |
#include "engine_type.h" |
9061
8ebd40e86171
(svn r12913) -Add: ability to backup and restore a player's economic data and data for a vehicle (or chain of vehicles)
bjarni
parents:
9043
diff
changeset
|
25 |
#include "order_func.h" |
9126
5648d696456b
(svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers.
rubidium
parents:
9081
diff
changeset
|
26 |
#include "transport_type.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
27 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
28 |
/** Road vehicle states */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
29 |
enum RoadVehicleStates { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
30 |
/* |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
31 |
* Lower 4 bits are used for vehicle track direction. (Trackdirs) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
32 |
* When in a road stop (bit 5 or bit 6 set) these bits give the |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
33 |
* track direction of the entry to the road stop. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
34 |
* As the entry direction will always be a diagonal |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
35 |
* direction (X_NE, Y_SE, X_SW or Y_NW) only bits 0 and 3 |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
36 |
* are needed to hold this direction. Bit 1 is then used to show |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
37 |
* that the vehicle is using the second road stop bay. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
38 |
* Bit 2 is then used for drive-through stops to show the vehicle |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
39 |
* is stopping at this road stop. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
40 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
41 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
42 |
/* Numeric values */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
43 |
RVSB_IN_DEPOT = 0xFE, ///< The vehicle is in a depot |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
44 |
RVSB_WORMHOLE = 0xFF, ///< The vehicle is in a tunnel and/or bridge |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
45 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
46 |
/* Bit numbers */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
47 |
RVS_USING_SECOND_BAY = 1, ///< Only used while in a road stop |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
48 |
RVS_IS_STOPPING = 2, ///< Only used for drive-through stops. Vehicle will stop here |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
49 |
RVS_DRIVE_SIDE = 4, ///< Only used when retrieving move data |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
50 |
RVS_IN_ROAD_STOP = 5, ///< The vehicle is in a road stop |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
51 |
RVS_IN_DT_ROAD_STOP = 6, ///< The vehicle is in a drive-through road stop |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
52 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
53 |
/* Bit sets of the above specified bits */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
54 |
RVSB_IN_ROAD_STOP = 1 << RVS_IN_ROAD_STOP, ///< The vehicle is in a road stop |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
55 |
RVSB_IN_ROAD_STOP_END = RVSB_IN_ROAD_STOP + TRACKDIR_END, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
56 |
RVSB_IN_DT_ROAD_STOP = 1 << RVS_IN_DT_ROAD_STOP, ///< The vehicle is in a drive-through road stop |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
57 |
RVSB_IN_DT_ROAD_STOP_END = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
58 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
59 |
RVSB_TRACKDIR_MASK = 0x0F, ///< The mask used to extract track dirs |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
60 |
RVSB_ROAD_STOP_TRACKDIR_MASK = 0x09 ///< Only bits 0 and 3 are used to encode the trackdir for road stops |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
61 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
62 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
63 |
enum VehStatus { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
64 |
VS_HIDDEN = 0x01, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
65 |
VS_STOPPED = 0x02, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
66 |
VS_UNCLICKABLE = 0x04, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
67 |
VS_DEFPAL = 0x08, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
68 |
VS_TRAIN_SLOWING = 0x10, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
69 |
VS_SHADOW = 0x20, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
70 |
VS_AIRCRAFT_BROKEN = 0x40, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
71 |
VS_CRASHED = 0x80, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
72 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
73 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
74 |
enum VehicleFlags { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
75 |
VF_LOADING_FINISHED, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
76 |
VF_CARGO_UNLOADING, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
77 |
VF_BUILT_AS_PROTOTYPE, |
10341
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
78 |
VF_TIMETABLE_STARTED, ///< Whether the vehicle has started running on the timetable yet. |
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
79 |
VF_AUTOFILL_TIMETABLE, ///< Whether the vehicle should fill in the timetable automatically. |
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
80 |
VF_AUTOFILL_PRES_WAIT_TIME, ///< Whether non-destructive auto-fill should preserve waiting times |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
81 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
82 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
83 |
struct VehicleRail { |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
84 |
/* Link between the two ends of a multiheaded engine */ |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
85 |
Vehicle *other_multiheaded_part; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
86 |
|
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
87 |
/* Cached wagon override spritegroup */ |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
88 |
const struct SpriteGroup *cached_override; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
89 |
|
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
90 |
uint16 last_speed; // NOSAVE: only used in UI |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
91 |
uint16 crash_anim_pos; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
92 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
93 |
/* cached values, recalculated on load and each time a vehicle is added to/removed from the consist. */ |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
94 |
uint32 cached_power; ///< total power of the consist. |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
95 |
uint16 cached_max_speed; ///< max speed of the consist. (minimum of the max speed of all vehicles in the consist) |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
96 |
uint16 cached_total_length; ///< Length of the whole train, valid only for first engine. |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
97 |
uint8 cached_veh_length; ///< length of this vehicle in units of 1/8 of normal length, cached because this can be set by a callback |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
98 |
bool cached_tilt; ///< train can tilt; feature provides a bonus in curves |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
99 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
100 |
/* cached values, recalculated when the cargo on a train changes (in addition to the conditions above) */ |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
101 |
uint32 cached_weight; ///< total weight of the consist. |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
102 |
uint32 cached_veh_weight; ///< weight of the vehicle. |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
103 |
uint32 cached_max_te; ///< max tractive effort of consist |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
104 |
|
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
105 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
106 |
* Position/type of visual effect. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
107 |
* bit 0 - 3 = position of effect relative to vehicle. (0 = front, 8 = centre, 15 = rear) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
108 |
* bit 4 - 5 = type of effect. (0 = default for engine class, 1 = steam, 2 = diesel, 3 = electric) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
109 |
* bit 6 = disable visual effect. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
110 |
* bit 7 = disable powered wagons. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
111 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
112 |
byte cached_vis_effect; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
113 |
byte user_def_data; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
114 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
115 |
/* NOSAVE: for wagon override - id of the first engine in train |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
116 |
* 0xffff == not in train */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
117 |
EngineID first_engine; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
118 |
|
9808
a914bcdca6fb
(svn r13950) -Add [YAPP]: Trains can now also be in a 'stuck' state when waiting on a path reservation. (michi_cc)
rubidium
parents:
9625
diff
changeset
|
119 |
uint16 flags; |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
120 |
TrackBitsByte track; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
121 |
byte force_proceed; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
122 |
RailTypeByte railtype; |
8236
8a5dd0b42e47
(svn r11800) -Codechange: move some functions to a more logical location + some type safety.
rubidium
parents:
8178
diff
changeset
|
123 |
RailTypes compatible_railtypes; |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
124 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
125 |
|
8666
e3ee55ec96bb
(svn r12331) -Feature: [NewGRF] vehicle variable FE bit 8
glx
parents:
8628
diff
changeset
|
126 |
enum VehicleRailFlags { |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
127 |
VRF_REVERSING = 0, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
128 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
129 |
/* used to calculate if train is going up or down */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
130 |
VRF_GOINGUP = 1, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
131 |
VRF_GOINGDOWN = 2, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
132 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
133 |
/* used to store if a wagon is powered or not */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
134 |
VRF_POWEREDWAGON = 3, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
135 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
136 |
/* used to reverse the visible direction of the vehicle */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
137 |
VRF_REVERSE_DIRECTION = 4, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
138 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
139 |
/* used to mark train as lost because PF can't find the route */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
140 |
VRF_NO_PATH_TO_DESTINATION = 5, |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
141 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
142 |
/* used to mark that electric train engine is allowed to run on normal rail */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
143 |
VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6, |
8666
e3ee55ec96bb
(svn r12331) -Feature: [NewGRF] vehicle variable FE bit 8
glx
parents:
8628
diff
changeset
|
144 |
|
8938 | 145 |
/* used for vehicle var 0xFE bit 8 (toggled each time the train is reversed, accurate for first vehicle only) */ |
8666
e3ee55ec96bb
(svn r12331) -Feature: [NewGRF] vehicle variable FE bit 8
glx
parents:
8628
diff
changeset
|
146 |
VRF_TOGGLE_REVERSE = 7, |
9808
a914bcdca6fb
(svn r13950) -Add [YAPP]: Trains can now also be in a 'stuck' state when waiting on a path reservation. (michi_cc)
rubidium
parents:
9625
diff
changeset
|
147 |
|
a914bcdca6fb
(svn r13950) -Add [YAPP]: Trains can now also be in a 'stuck' state when waiting on a path reservation. (michi_cc)
rubidium
parents:
9625
diff
changeset
|
148 |
/* used to mark a train that can't get a path reservation */ |
a914bcdca6fb
(svn r13950) -Add [YAPP]: Trains can now also be in a 'stuck' state when waiting on a path reservation. (michi_cc)
rubidium
parents:
9625
diff
changeset
|
149 |
VRF_TRAIN_STUCK = 8, |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
150 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
151 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
152 |
struct VehicleAir { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
153 |
uint16 crashed_counter; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
154 |
uint16 cached_max_speed; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
155 |
byte pos; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
156 |
byte previous_pos; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
157 |
StationID targetairport; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
158 |
byte state; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
159 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
160 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
161 |
struct VehicleRoad { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
162 |
byte state; ///< @see RoadVehicleStates |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
163 |
byte frame; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
164 |
uint16 blocked_ctr; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
165 |
byte overtaking; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
166 |
byte overtaking_ctr; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
167 |
uint16 crashed_ctr; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
168 |
byte reverse_ctr; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
169 |
struct RoadStop *slot; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
170 |
byte slot_age; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
171 |
EngineID first_engine; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
172 |
byte cached_veh_length; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
173 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
174 |
RoadType roadtype; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
175 |
RoadTypes compatible_roadtypes; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
176 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
177 |
|
9008
de19c73e405f
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
8938
diff
changeset
|
178 |
struct VehicleEffect { |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
179 |
uint16 animation_state; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
180 |
byte animation_substate; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
181 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
182 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
183 |
struct VehicleDisaster { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
184 |
uint16 image_override; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
185 |
VehicleID big_ufo_destroyer_target; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
186 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
187 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
188 |
struct VehicleShip { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
189 |
TrackBitsByte state; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
190 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
191 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
192 |
DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
193 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
194 |
/* Some declarations of functions, so we can make them friendly */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
195 |
struct SaveLoad; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
196 |
extern const SaveLoad *GetVehicleDescription(VehicleType vt); |
8172
bcad4f33bd3d
(svn r11735) -Fix [FS#1574]: Don't reset loading indicator IDs when only reloading NewGRFs.
peter1138
parents:
8144
diff
changeset
|
197 |
extern void AfterLoadVehicles(bool clear_te_id); |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
198 |
struct LoadgameState; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
199 |
extern bool LoadOldVehicle(LoadgameState *ls, int num); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
200 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
201 |
struct Vehicle : PoolItem<Vehicle, VehicleID, &_Vehicle_pool>, BaseVehicle { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
202 |
private: |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
203 |
Vehicle *next; ///< pointer to the next vehicle in the chain |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
204 |
Vehicle *previous; ///< NOSAVE: pointer to the previous vehicle in the chain |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
205 |
Vehicle *first; ///< NOSAVE: pointer to the first vehicle in the chain |
9941
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
206 |
|
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
207 |
Vehicle *next_shared; ///< pointer to the next vehicle that shares the order |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
208 |
Vehicle *previous_shared; ///< NOSAVE: pointer to the previous vehicle in the shared order chain |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
209 |
Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
210 |
public: |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
211 |
friend const SaveLoad *GetVehicleDescription(VehicleType vt); ///< So we can use private/protected variables in the saveload code |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
212 |
friend void AfterLoadVehicles(bool clear_te_id); ///< So we can set the previous and first pointers while loading |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
213 |
friend bool LoadOldVehicle(LoadgameState *ls, int num); ///< So we can set the proper next pointer while loading |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
214 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
215 |
Vehicle *depot_list; ///< NOSAVE: linked list to tell what vehicles entered a depot during the last tick. Used by autoreplace |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
216 |
|
8258
9fa31acb07bc
(svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is
peter1138
parents:
8254
diff
changeset
|
217 |
char *name; ///< Name of vehicle |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
218 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
219 |
TileIndex tile; ///< Current tile index |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
220 |
TileIndex dest_tile; ///< Heading for this tile |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
221 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
222 |
Money profit_this_year; ///< Profit this year << 8, low 8 bits are fract |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
223 |
Money profit_last_year; ///< Profit last year << 8, low 8 bits are fract |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
224 |
Money value; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
225 |
|
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
226 |
/* Used for timetabling. */ |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
227 |
uint32 current_order_time; ///< How many ticks have passed since this order started. |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
228 |
int32 lateness_counter; ///< How many ticks late (or early if negative) this vehicle is. |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
229 |
|
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
230 |
/* Boundaries for the current position in the world and a next hash link. |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
231 |
* NOSAVE: All of those can be updated with VehiclePositionChanged() */ |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
232 |
int32 left_coord; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
233 |
int32 top_coord; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
234 |
int32 right_coord; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
235 |
int32 bottom_coord; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
236 |
Vehicle *next_hash; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
237 |
Vehicle *next_new_hash; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
238 |
Vehicle **old_new_hash; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
239 |
|
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
240 |
SpriteID colormap; // NOSAVE: cached color mapping |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
241 |
|
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
242 |
/* Related to age and service time */ |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
243 |
Year build_year; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
244 |
Date age; // Age in days |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
245 |
Date max_age; // Maximum age |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
246 |
Date date_of_last_service; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
247 |
Date service_interval; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
248 |
uint16 reliability; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
249 |
uint16 reliability_spd_dec; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
250 |
byte breakdown_ctr; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
251 |
byte breakdown_delay; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
252 |
byte breakdowns_since_last_service; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
253 |
byte breakdown_chance; |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
254 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
255 |
int32 x_pos; // coordinates |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
256 |
int32 y_pos; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
257 |
byte z_pos; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
258 |
DirectionByte direction; // facing |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
259 |
|
10207
c291a21b304e
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents:
10187
diff
changeset
|
260 |
OwnerByte owner; // which company owns the vehicle? |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
261 |
byte spritenum; // currently displayed sprite index |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
262 |
// 0xfd == custom sprite, 0xfe == custom second head sprite |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
263 |
// 0xff == reserved for another custom sprite |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
264 |
uint16 cur_image; // sprite number for this vehicle |
8793
5e35232593c3
(svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents:
8784
diff
changeset
|
265 |
byte x_extent; // x-extent of vehicle bounding box |
5e35232593c3
(svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents:
8784
diff
changeset
|
266 |
byte y_extent; // y-extent of vehicle bounding box |
5e35232593c3
(svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents:
8784
diff
changeset
|
267 |
byte z_extent; // z-extent of vehicle bounding box |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
268 |
int8 x_offs; // x offset for vehicle sprite |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
269 |
int8 y_offs; // y offset for vehicle sprite |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
270 |
EngineID engine_type; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
271 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
272 |
TextEffectID fill_percent_te_id; // a text-effect id to a loading indicator object |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
273 |
UnitID unitnumber; // unit number, for display purposes only |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
274 |
|
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
275 |
uint16 max_speed; ///< maximum speed |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
276 |
uint16 cur_speed; ///< current speed |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
277 |
byte subspeed; ///< fractional speed |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
278 |
byte acceleration; ///< used by train & aircraft |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
279 |
uint32 motion_counter; |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
280 |
byte progress; |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
281 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
282 |
/* for randomized variational spritegroups |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
283 |
* bitmask used to resolve them; parts of it get reseeded when triggers |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
284 |
* of corresponding spritegroups get matched */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
285 |
byte random_bits; |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
286 |
byte waiting_triggers; ///< triggers to be yet matched |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
287 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
288 |
StationID last_station_visited; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
289 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
290 |
CargoID cargo_type; ///< type of cargo this vehicle is carrying |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
291 |
byte cargo_subtype; ///< Used for livery refits (NewGRF variations) |
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
292 |
uint16 cargo_cap; ///< total capacity |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
293 |
CargoList cargo; ///< The cargo this vehicle is carrying |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
294 |
|
8556
ce8d86cc14d2
(svn r12134) -Change: count the number of ticks a vehicle was running this day to calculate running cost
smatz
parents:
8469
diff
changeset
|
295 |
byte day_counter; ///< Increased by one for each day |
ce8d86cc14d2
(svn r12134) -Change: count the number of ticks a vehicle was running this day to calculate running cost
smatz
parents:
8469
diff
changeset
|
296 |
byte tick_counter; ///< Increased by one for each tick |
ce8d86cc14d2
(svn r12134) -Change: count the number of ticks a vehicle was running this day to calculate running cost
smatz
parents:
8469
diff
changeset
|
297 |
byte running_ticks; ///< Number of ticks this vehicle was not stopped this day |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
298 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
299 |
byte vehstatus; ///< Status |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
300 |
Order current_order; ///< The current order (+ status, like: loading) |
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
301 |
VehicleOrderID num_orders; ///< How many orders there are in the list |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
302 |
VehicleOrderID cur_order_index; ///< The index to the current order |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
303 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
304 |
Order *orders; ///< Pointer to the first order for this vehicle |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
305 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
306 |
bool leave_depot_instantly; ///< NOSAVE: stores if the vehicle needs to leave the depot it just entered. Used by autoreplace |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
307 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
308 |
byte vehicle_flags; ///< Used for gradual loading and other miscellaneous things (@see VehicleFlags enum) |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
309 |
uint16 load_unload_time_rem; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
310 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
311 |
GroupID group_id; ///< Index of group Pool array |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
312 |
|
9015
5f39c06a47df
(svn r12814) -Codechange: reshuffle some variables in the Vehicle struct saving 20 bytes with a 32 bit compiler and 32 bytes on 64 bit compiler per vehicle.
rubidium
parents:
9009
diff
changeset
|
313 |
byte subtype; ///< subtype (Filled with values from EffectVehicles/TrainSubTypes/AircraftSubTypes) |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
314 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
315 |
union { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
316 |
VehicleRail rail; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
317 |
VehicleAir air; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
318 |
VehicleRoad road; |
9008
de19c73e405f
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
8938
diff
changeset
|
319 |
VehicleEffect effect; |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
320 |
VehicleDisaster disaster; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
321 |
VehicleShip ship; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
322 |
} u; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
323 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
324 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
325 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
326 |
* Allocates a lot of vehicles. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
327 |
* @param vl pointer to an array of vehicles to get allocated. Can be NULL if the vehicles aren't needed (makes it test only) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
328 |
* @param num number of vehicles to allocate room for |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
329 |
* @return true if there is room to allocate all the vehicles |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
330 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
331 |
static bool AllocateList(Vehicle **vl, int num); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
332 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
333 |
/** Create a new vehicle */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
334 |
Vehicle(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
335 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
336 |
/** Destroy all stuff that (still) needs the virtual functions to work properly */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
337 |
void PreDestructor(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
338 |
/** We want to 'destruct' the right class. */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
339 |
virtual ~Vehicle(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
340 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
341 |
void BeginLoading(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
342 |
void LeaveStation(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
343 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
344 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
345 |
* Handle the loading of the vehicle; when not it skips through dummy |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
346 |
* orders and does nothing in all other cases. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
347 |
* @param mode is the non-first call for this vehicle in this tick? |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
348 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
349 |
void HandleLoading(bool mode = false); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
350 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
351 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
352 |
* Get a string 'representation' of the vehicle type. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
353 |
* @return the string representation. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
354 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
355 |
virtual const char* GetTypeString() const { return "base vehicle"; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
356 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
357 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
358 |
* Marks the vehicles to be redrawn and updates cached variables |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
359 |
* |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
360 |
* This method marks the area of the vehicle on the screen as dirty. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
361 |
* It can be use to repaint the vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
362 |
* |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
363 |
* @ingroup dirty |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
364 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
365 |
virtual void MarkDirty() {} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
366 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
367 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
368 |
* Updates the x and y offsets and the size of the sprite used |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
369 |
* for this vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
370 |
* @param direction the direction the vehicle is facing |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
371 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
372 |
virtual void UpdateDeltaXY(Direction direction) {} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
373 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
374 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
375 |
* Sets the expense type associated to this vehicle type |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
376 |
* @param income whether this is income or (running) expenses of the vehicle |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
377 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
378 |
virtual ExpensesType GetExpenseType(bool income) const { return EXPENSES_OTHER; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
379 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
380 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
381 |
* Play the sound associated with leaving the station |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
382 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
383 |
virtual void PlayLeaveStationSound() const {} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
384 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
385 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
386 |
* Whether this is the primary vehicle in the chain. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
387 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
388 |
virtual bool IsPrimaryVehicle() const { return false; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
389 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
390 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
391 |
* Gets the sprite to show for the given direction |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
392 |
* @param direction the direction the vehicle is facing |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
393 |
* @return the sprite for the given vehicle in the given direction |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
394 |
*/ |
9022
8fa9e902b06e
(svn r12824) -Codechange: Standardise routines for drawing vehicle images, using correct types and less duplication.
peter1138
parents:
9015
diff
changeset
|
395 |
virtual SpriteID GetImage(Direction direction) const { return 0; } |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
396 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
397 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
398 |
* Gets the speed in mph that can be sent into SetDParam for string processing. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
399 |
* @return the vehicle's speed |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
400 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
401 |
virtual int GetDisplaySpeed() const { return 0; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
402 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
403 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
404 |
* Gets the maximum speed in mph that can be sent into SetDParam for string processing. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
405 |
* @return the vehicle's maximum speed |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
406 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
407 |
virtual int GetDisplayMaxSpeed() const { return 0; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
408 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
409 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
410 |
* Gets the running cost of a vehicle |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
411 |
* @return the vehicle's running cost |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
412 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
413 |
virtual Money GetRunningCost() const { return 0; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
414 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
415 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
416 |
* Check whether the vehicle is in the depot. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
417 |
* @return true if and only if the vehicle is in the depot. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
418 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
419 |
virtual bool IsInDepot() const { return false; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
420 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
421 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
422 |
* Check whether the vehicle is in the depot *and* stopped. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
423 |
* @return true if and only if the vehicle is in the depot and stopped. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
424 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
425 |
virtual bool IsStoppedInDepot() const { return this->IsInDepot() && (this->vehstatus & VS_STOPPED) != 0; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
426 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
427 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
428 |
* Calls the tick handler of the vehicle |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
429 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
430 |
virtual void Tick() {}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
431 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
432 |
/** |
8467
605661f3a91c
(svn r12037) -Codechange: replace OnNewDay_(Aircraft|RoadVeh|Ship|Train) with an OnNewDay method in the Vehicle class
glx
parents:
8258
diff
changeset
|
433 |
* Calls the new day handler of the vehicle |
605661f3a91c
(svn r12037) -Codechange: replace OnNewDay_(Aircraft|RoadVeh|Ship|Train) with an OnNewDay method in the Vehicle class
glx
parents:
8258
diff
changeset
|
434 |
*/ |
605661f3a91c
(svn r12037) -Codechange: replace OnNewDay_(Aircraft|RoadVeh|Ship|Train) with an OnNewDay method in the Vehicle class
glx
parents:
8258
diff
changeset
|
435 |
virtual void OnNewDay() {}; |
605661f3a91c
(svn r12037) -Codechange: replace OnNewDay_(Aircraft|RoadVeh|Ship|Train) with an OnNewDay method in the Vehicle class
glx
parents:
8258
diff
changeset
|
436 |
|
605661f3a91c
(svn r12037) -Codechange: replace OnNewDay_(Aircraft|RoadVeh|Ship|Train) with an OnNewDay method in the Vehicle class
glx
parents:
8258
diff
changeset
|
437 |
/** |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
438 |
* Gets the running cost of a vehicle that can be sent into SetDParam for string processing. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
439 |
* @return the vehicle's running cost |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
440 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
441 |
Money GetDisplayRunningCost() const { return (this->GetRunningCost() >> 8); } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
442 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
443 |
/** |
8614
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
444 |
* Gets the profit vehicle had this year. It can be sent into SetDParam for string processing. |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
445 |
* @return the vehicle's profit this year |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
446 |
*/ |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
447 |
Money GetDisplayProfitThisYear() const { return (this->profit_this_year >> 8); } |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
448 |
|
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
449 |
/** |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
450 |
* Gets the profit vehicle had last year. It can be sent into SetDParam for string processing. |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
451 |
* @return the vehicle's profit last year |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
452 |
*/ |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
453 |
Money GetDisplayProfitLastYear() const { return (this->profit_last_year >> 8); } |
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
454 |
|
4c67a883c4c4
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
smatz
parents:
8556
diff
changeset
|
455 |
/** |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
456 |
* Set the next vehicle of this vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
457 |
* @param next the next vehicle. NULL removes the next vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
458 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
459 |
void SetNext(Vehicle *next); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
460 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
461 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
462 |
* Get the next vehicle of this vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
463 |
* @note articulated parts are also counted as vehicles. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
464 |
* @return the next vehicle or NULL when there isn't a next vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
465 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
466 |
inline Vehicle *Next() const { return this->next; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
467 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
468 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
469 |
* Get the previous vehicle of this vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
470 |
* @note articulated parts are also counted as vehicles. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
471 |
* @return the previous vehicle or NULL when there isn't a previous vehicle. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
472 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
473 |
inline Vehicle *Previous() const { return this->previous; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
474 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
475 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
476 |
* Get the first vehicle of this vehicle chain. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
477 |
* @return the first vehicle of the chain. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
478 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
479 |
inline Vehicle *First() const { return this->first; } |
8469
c3621b1a6454
(svn r12040) -Codechange: Change IsOrderListShared from a simple function to a class member(MagicBuzz).
belugas
parents:
8467
diff
changeset
|
480 |
|
9941
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
481 |
|
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
482 |
/** |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
483 |
* Adds this vehicle to a shared vehicle chain. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
484 |
* @param shared_chain a vehicle of the chain with shared vehicles. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
485 |
* @pre !this->IsOrderListShared() |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
486 |
*/ |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
487 |
void AddToShared(Vehicle *shared_chain); |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
488 |
|
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
489 |
/** |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
490 |
* Removes the vehicle from the shared order list. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
491 |
*/ |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
492 |
void RemoveFromShared(); |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
493 |
|
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
494 |
/** |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
495 |
* Get the next vehicle of this vehicle. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
496 |
* @note articulated parts are also counted as vehicles. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
497 |
* @return the next vehicle or NULL when there isn't a next vehicle. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
498 |
*/ |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
499 |
inline Vehicle *NextShared() const { return this->next_shared; } |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
500 |
|
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
501 |
/** |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
502 |
* Get the first vehicle of this vehicle chain. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
503 |
* @return the first vehicle of the chain. |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
504 |
*/ |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
505 |
inline Vehicle *FirstShared() const { return this->first_shared; } |
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
506 |
|
8469
c3621b1a6454
(svn r12040) -Codechange: Change IsOrderListShared from a simple function to a class member(MagicBuzz).
belugas
parents:
8467
diff
changeset
|
507 |
/** |
c3621b1a6454
(svn r12040) -Codechange: Change IsOrderListShared from a simple function to a class member(MagicBuzz).
belugas
parents:
8467
diff
changeset
|
508 |
* Check if we share our orders with another vehicle. |
c3621b1a6454
(svn r12040) -Codechange: Change IsOrderListShared from a simple function to a class member(MagicBuzz).
belugas
parents:
8467
diff
changeset
|
509 |
* @return true if there are other vehicles sharing the same order |
c3621b1a6454
(svn r12040) -Codechange: Change IsOrderListShared from a simple function to a class member(MagicBuzz).
belugas
parents:
8467
diff
changeset
|
510 |
*/ |
9941
8549448b55fa
(svn r14096) -Codechange: merge the shared order's vehicle list management to a single location.
rubidium
parents:
9930
diff
changeset
|
511 |
inline bool IsOrderListShared() const { return this->previous_shared != NULL || this->next_shared != NULL; }; |
8628
2e7e4cdfe96f
(svn r12230) -Codechange: [autoreplace] made a function to detect if a vehicle needs autorenewing
bjarni
parents:
8614
diff
changeset
|
512 |
|
9928
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
513 |
/** |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
514 |
* Copy certain configurations and statistics of a vehicle after successful autoreplace/renew |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
515 |
* The function shall copy everything that cannot be copied by a command (like orders / group etc), |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
516 |
* and that shall not be resetted for the new vehicle. |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
517 |
* @param src The old vehicle |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
518 |
*/ |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
519 |
inline void CopyVehicleConfigAndStatistics(const Vehicle *src) |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
520 |
{ |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
521 |
this->unitnumber = src->unitnumber; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
522 |
|
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
523 |
this->cur_order_index = src->cur_order_index; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
524 |
this->current_order = src->current_order; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
525 |
this->dest_tile = src->dest_tile; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
526 |
|
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
527 |
this->profit_this_year = src->profit_this_year; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
528 |
this->profit_last_year = src->profit_last_year; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
529 |
|
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
530 |
this->current_order_time = src->current_order_time; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
531 |
this->lateness_counter = src->lateness_counter; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
532 |
|
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
533 |
this->service_interval = src->service_interval; |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
534 |
} |
fa24e759e11d
(svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch
parents:
9808
diff
changeset
|
535 |
|
10207
c291a21b304e
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents:
10187
diff
changeset
|
536 |
bool NeedsAutorenewing(const Company *c) const; |
8827
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
537 |
|
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
538 |
/** |
8862
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
539 |
* Check if the vehicle needs to go to a depot in near future (if a opportunity presents itself) for service or replacement. |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
540 |
* |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
541 |
* @see NeedsAutomaticServicing() |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
542 |
* @return true if the vehicle should go to a depot if a opportunity presents itself. |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
543 |
*/ |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
544 |
bool NeedsServicing() const; |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
545 |
|
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
546 |
/** |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
547 |
* Checks if the current order should be interupted for a service-in-depot-order. |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
548 |
* @see NeedsServicing() |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
549 |
* @return true if the current order should be interupted. |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
550 |
*/ |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
551 |
bool NeedsAutomaticServicing() const; |
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
552 |
|
f72f256c0259
(svn r12629) -Codechange: Split VehicleNeedsService() into Vehicle::NeedsServicing() and Vehicle::NeedsAutomaticServicing().
frosch
parents:
8827
diff
changeset
|
553 |
/** |
8827
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
554 |
* Determine the location for the station where the vehicle goes to next. |
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
555 |
* Things done for example are allocating slots in a road stop or exact |
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
556 |
* location of the platform is determined for ships. |
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
557 |
* @param station the station to make the next location of the vehicle. |
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
558 |
* @return the location (tile) to aim for. |
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
559 |
*/ |
730524764a69
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
rubidium
parents:
8793
diff
changeset
|
560 |
virtual TileIndex GetOrderStationLocation(StationID station) { return INVALID_TILE; } |
8890
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
561 |
|
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
562 |
/** |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
563 |
* Find the closest depot for this vehicle and tell us the location, |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
564 |
* DestinationID and whether we should reverse. |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
565 |
* @param location where do we go to? |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
566 |
* @param destination what hangar do we go to? |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
567 |
* @param reverse should the vehicle be reversed? |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
568 |
* @return true if a depot could be found. |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
569 |
*/ |
8a0fa7ff70a0
(svn r12657) -Codechange: add 'FindClosestDepot' to the vehicle class.
rubidium
parents:
8862
diff
changeset
|
570 |
virtual bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse) { return false; } |
8891
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
571 |
|
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
572 |
/** |
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
573 |
* Send this vehicle to the depot using the given command(s). |
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
574 |
* @param flags the command flags (like execute and such). |
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
575 |
* @param command the command to execute. |
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
576 |
* @return the cost of the depot action. |
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
577 |
*/ |
1058c3b69b7f
(svn r12658) -Codechange: unify a vast portion of the CmdSend<VehicleType>ToDepot commands.
rubidium
parents:
8890
diff
changeset
|
578 |
CommandCost SendToDepot(uint32 flags, DepotCommand command); |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
579 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
580 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
581 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
582 |
* This class 'wraps' Vehicle; you do not actually instantiate this class. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
583 |
* You create a Vehicle using AllocateVehicle, so it is added to the pool |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
584 |
* and you reinitialize that to a Train using: |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
585 |
* v = new (v) Train(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
586 |
* |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
587 |
* As side-effect the vehicle type is set correctly. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
588 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
589 |
struct DisasterVehicle : public Vehicle { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
590 |
/** Initializes the Vehicle to a disaster vehicle */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
591 |
DisasterVehicle() { this->type = VEH_DISASTER; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
592 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
593 |
/** We want to 'destruct' the right class. */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
594 |
virtual ~DisasterVehicle() {} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
595 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
596 |
const char *GetTypeString() const { return "disaster vehicle"; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
597 |
void UpdateDeltaXY(Direction direction); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
598 |
void Tick(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
599 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
600 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
601 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
602 |
* This class 'wraps' Vehicle; you do not actually instantiate this class. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
603 |
* You create a Vehicle using AllocateVehicle, so it is added to the pool |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
604 |
* and you reinitialize that to a Train using: |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
605 |
* v = new (v) Train(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
606 |
* |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
607 |
* As side-effect the vehicle type is set correctly. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
608 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
609 |
struct InvalidVehicle : public Vehicle { |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
610 |
/** Initializes the Vehicle to a invalid vehicle */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
611 |
InvalidVehicle() { this->type = VEH_INVALID; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
612 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
613 |
/** We want to 'destruct' the right class. */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
614 |
virtual ~InvalidVehicle() {} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
615 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
616 |
const char *GetTypeString() const { return "invalid vehicle"; } |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
617 |
void Tick() {} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
618 |
}; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
619 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
620 |
static inline VehicleID GetMaxVehicleIndex() |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
621 |
{ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
622 |
/* TODO - This isn't the real content of the function, but |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
623 |
* with the new pool-system this will be replaced with one that |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
624 |
* _really_ returns the highest index. Now it just returns |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
625 |
* the next safe value we are sure about everything is below. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
626 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
627 |
return GetVehiclePoolSize() - 1; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
628 |
} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
629 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
630 |
static inline uint GetNumVehicles() |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
631 |
{ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
632 |
return GetVehiclePoolSize(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
633 |
} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
634 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
635 |
#define FOR_ALL_VEHICLES_FROM(v, start) for (v = GetVehicle(start); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) if (v->IsValid()) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
636 |
#define FOR_ALL_VEHICLES(v) FOR_ALL_VEHICLES_FROM(v, 0) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
637 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
638 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
639 |
* Check if an index is a vehicle-index (so between 0 and max-vehicles) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
640 |
* @param index of the vehicle to query |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
641 |
* @return Returns true if the vehicle-id is in range |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
642 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
643 |
static inline bool IsValidVehicleID(uint index) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
644 |
{ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
645 |
return index < GetVehiclePoolSize() && GetVehicle(index)->IsValid(); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
646 |
} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
647 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
648 |
/* Returns order 'index' of a vehicle or NULL when it doesn't exists */ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
649 |
static inline Order *GetVehicleOrder(const Vehicle *v, int index) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
650 |
{ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
651 |
Order *order = v->orders; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
652 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
653 |
if (index < 0) return NULL; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
654 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
655 |
while (order != NULL && index-- > 0) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
656 |
order = order->next; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
657 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
658 |
return order; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
659 |
} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
660 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
661 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
662 |
* Returns the last order of a vehicle, or NULL if it doesn't exists |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
663 |
* @param v Vehicle to query |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
664 |
* @return last order of a vehicle, if available |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
665 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
666 |
static inline Order *GetLastVehicleOrder(const Vehicle *v) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
667 |
{ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
668 |
Order *order = v->orders; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
669 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
670 |
if (order == NULL) return NULL; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
671 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
672 |
while (order->next != NULL) |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
673 |
order = order->next; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
674 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
675 |
return order; |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
676 |
} |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
677 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
678 |
/** |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
679 |
* Returns the Trackdir on which the vehicle is currently located. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
680 |
* Works for trains and ships. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
681 |
* Currently works only sortof for road vehicles, since they have a fuzzy |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
682 |
* concept of being "on" a trackdir. Dunno really what it returns for a road |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
683 |
* vehicle that is halfway a tile, never really understood that part. For road |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
684 |
* vehicles that are at the beginning or end of the tile, should just return |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
685 |
* the diagonal trackdir on which they are driving. I _think_. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
686 |
* For other vehicles types, or vehicles with no clear trackdir (such as those |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
687 |
* in depots), returns 0xFF. |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
688 |
*/ |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
689 |
Trackdir GetVehicleTrackdir(const Vehicle* v); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
690 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
691 |
void CheckVehicle32Day(Vehicle *v); |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
692 |
|
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
diff
changeset
|
693 |
#endif /* VEHICLE_BASE_H */ |