| author | peter1138 |
| Tue, 22 May 2007 19:48:11 +0000 | |
| changeset 7163 | 09e65bfbc08b |
| parent 7059 | 3d5c57a7e729 |
| child 7269 | c7f39d91255e |
| permissions | -rw-r--r-- |
| 3959 | 1 |
/* $Id$ */ |
2 |
||
| 6913 | 3 |
/** @file src/roadveh.h Road vehicle states */ |
|
6889
f7f6d9cb07a0
(svn r9523) -Cleanup: doxygen changes. Time to take care of "R"
belugas
parents:
6585
diff
changeset
|
4 |
|
|
4666
850b5b6e4bac
(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 |
|
850b5b6e4bac
(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 |
|
850b5b6e4bac
(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 |
{
|
|
|
6585
7da94b26498a
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6037
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
091f530bae28
(svn r6529) -Fix r6513: [depot window] added missing switch in CcCloneVehicle()
bjarni
parents:
3959
diff
changeset
|
21 |
|
|
6037
7409c8f581e1
(svn r8338) -Codechange: merged road vehicle build window into the other ones
bjarni
parents:
5726
diff
changeset
|
22 |
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2); |
|
4653
091f530bae28
(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
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4653
diff
changeset
|
24 |
|
|
7048
06b931095b26
(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:
6913
diff
changeset
|
25 |
|
|
06b931095b26
(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:
6913
diff
changeset
|
26 |
/** |
|
06b931095b26
(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:
6913
diff
changeset
|
27 |
* This class 'wraps' Vehicle; you do not actually instantiate this class. |
|
06b931095b26
(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:
6913
diff
changeset
|
28 |
* You create a Vehicle using AllocateVehicle, so it is added to the pool |
|
06b931095b26
(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:
6913
diff
changeset
|
29 |
* and you reinitialize that to a Train using: |
|
06b931095b26
(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:
6913
diff
changeset
|
30 |
* v = new (v) RoadVehicle(); |
|
06b931095b26
(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:
6913
diff
changeset
|
31 |
* |
|
06b931095b26
(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:
6913
diff
changeset
|
32 |
* As side-effect the vehicle type is set correctly. |
|
06b931095b26
(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:
6913
diff
changeset
|
33 |
*/ |
|
06b931095b26
(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:
6913
diff
changeset
|
34 |
struct RoadVehicle : public Vehicle {
|
|
06b931095b26
(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:
6913
diff
changeset
|
35 |
/** Initializes the Vehicle to a road vehicle */ |
|
06b931095b26
(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:
6913
diff
changeset
|
36 |
RoadVehicle() { this->type = VEH_ROAD; }
|
|
06b931095b26
(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:
6913
diff
changeset
|
37 |
|
|
06b931095b26
(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:
6913
diff
changeset
|
38 |
/** We want to 'destruct' the right class. */ |
|
06b931095b26
(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:
6913
diff
changeset
|
39 |
virtual ~RoadVehicle() {}
|
|
06b931095b26
(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:
6913
diff
changeset
|
40 |
|
|
7059
3d5c57a7e729
(svn r9765) -Codechange: constify some class functions.
rubidium
parents:
7058
diff
changeset
|
41 |
const char *GetTypeString() const { return "road vehicle"; }
|
|
7049
01825af2ce90
(svn r9755) -Codechange: refactor some more of the begin loading stuff.
rubidium
parents:
7048
diff
changeset
|
42 |
void MarkDirty(); |
|
7054
edbb4d7765f2
(svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents:
7049
diff
changeset
|
43 |
void UpdateDeltaXY(Direction direction); |
|
7059
3d5c57a7e729
(svn r9765) -Codechange: constify some class functions.
rubidium
parents:
7058
diff
changeset
|
44 |
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
|
|
3d5c57a7e729
(svn r9765) -Codechange: constify some class functions.
rubidium
parents:
7058
diff
changeset
|
45 |
WindowClass GetVehicleListWindowClass() const { return WC_ROADVEH_LIST; }
|
|
7048
06b931095b26
(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:
6913
diff
changeset
|
46 |
}; |
|
06b931095b26
(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:
6913
diff
changeset
|
47 |
|
|
4666
850b5b6e4bac
(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 */ |