author | rubidium |
Wed, 02 May 2007 09:29:41 +0000 | |
changeset 7058 | b541279ca705 |
parent 7054 | edbb4d7765f2 |
child 7059 | 3d5c57a7e729 |
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 |
|
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
|
41 |
const char *GetTypeString() { 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); |
7058
b541279ca705
(svn r9764) -Codechange: replace some lookup tables by functions.
rubidium
parents:
7054
diff
changeset
|
44 |
ExpensesType GetExpenseType(bool income) { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; } |
b541279ca705
(svn r9764) -Codechange: replace some lookup tables by functions.
rubidium
parents:
7054
diff
changeset
|
45 |
WindowClass GetVehicleListWindowClass() { 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 */ |