author | rubidium |
Wed, 02 May 2007 09:29:41 +0000 | |
changeset 6562 | 077afce9a4ee |
parent 6558 | c88e142f896e |
child 6563 | fed2a162046b |
permissions | -rw-r--r-- |
3959 | 1 |
/* $Id$ */ |
2 |
||
6417 | 3 |
/** @file src/roadveh.h Road vehicle states */ |
6393
e1e4939d19b5
(svn r9523) -Cleanup: doxygen changes. Time to take care of "R"
belugas
parents:
6259
diff
changeset
|
4 |
|
4666
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4653
diff
changeset
|
5 |
#ifndef ROADVEH_H |
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4653
diff
changeset
|
6 |
#define ROADVEH_H |
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4653
diff
changeset
|
7 |
|
3959 | 8 |
#include "vehicle.h" |
9 |
||
10 |
||
11 |
static inline bool IsRoadVehInDepot(const Vehicle* v) |
|
12 |
{ |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
5786
diff
changeset
|
13 |
assert(v->type == VEH_ROAD); |
3959 | 14 |
return v->u.road.state == 254; |
15 |
} |
|
16 |
||
17 |
static inline bool IsRoadVehInDepotStopped(const Vehicle* v) |
|
18 |
{ |
|
19 |
return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED; |
|
20 |
} |
|
4653
9f72ab9dc4a7
(svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents:
3959
diff
changeset
|
21 |
|
5786
9bbd2d7f2a30
(svn r8338) -Codechange: merged road vehicle build window into the other ones
bjarni
parents:
5475
diff
changeset
|
22 |
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2); |
4653
9f72ab9dc4a7
(svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents:
3959
diff
changeset
|
23 |
void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2); |
4666
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4653
diff
changeset
|
24 |
|
6552
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
25 |
|
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
26 |
/** |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
27 |
* This class 'wraps' Vehicle; you do not actually instantiate this class. |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
28 |
* You create a Vehicle using AllocateVehicle, so it is added to the pool |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
29 |
* and you reinitialize that to a Train using: |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
30 |
* v = new (v) RoadVehicle(); |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
31 |
* |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
32 |
* As side-effect the vehicle type is set correctly. |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
33 |
*/ |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
34 |
struct RoadVehicle : public Vehicle { |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
35 |
/** Initializes the Vehicle to a road vehicle */ |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
36 |
RoadVehicle() { this->type = VEH_ROAD; } |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
37 |
|
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
38 |
/** We want to 'destruct' the right class. */ |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
39 |
virtual ~RoadVehicle() {} |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
40 |
|
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
41 |
const char *GetTypeString() { return "road vehicle"; } |
6553
976a684212ad
(svn r9755) -Codechange: refactor some more of the begin loading stuff.
rubidium
parents:
6552
diff
changeset
|
42 |
void MarkDirty(); |
6558
c88e142f896e
(svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents:
6553
diff
changeset
|
43 |
void UpdateDeltaXY(Direction direction); |
6562
077afce9a4ee
(svn r9764) -Codechange: replace some lookup tables by functions.
rubidium
parents:
6558
diff
changeset
|
44 |
ExpensesType GetExpenseType(bool income) { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; } |
077afce9a4ee
(svn r9764) -Codechange: replace some lookup tables by functions.
rubidium
parents:
6558
diff
changeset
|
45 |
WindowClass GetVehicleListWindowClass() { return WC_ROADVEH_LIST; } |
6552
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
46 |
}; |
d87268e08799
(svn r9754) -Codechange: make classes for all vehicle types, so we can make nicer/better maintainable code, i.e. virtual methods instead of switches.
rubidium
parents:
6417
diff
changeset
|
47 |
|
4666
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4653
diff
changeset
|
48 |
#endif /* ROADVEH_H */ |