author | celestar |
Wed, 13 Jun 2007 11:45:14 +0000 | |
branch | gamebalance |
changeset 9911 | 0b8b245a2391 |
parent 9908 | 0fa543611bbe |
child 9625 | 3301b1b3889c |
permissions | -rw-r--r-- |
3962 | 1 |
/* $Id$ */ |
2 |
||
9908
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9895
diff
changeset
|
3 |
/** @file ship.h */ |
0fa543611bbe
(svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents:
9895
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:
4638
diff
changeset
|
5 |
#ifndef SHIP_H |
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4638
diff
changeset
|
6 |
#define SHIP_H |
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4638
diff
changeset
|
7 |
|
3962 | 8 |
#include "vehicle.h" |
9 |
||
6034
89a7d10fa75b
(svn r8335) -Feature: the build ship window is now also resizable horizontally and contains sorting options
bjarni
parents:
5726
diff
changeset
|
10 |
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2); |
4638
8abe4f10b94b
(svn r6513) -Codechange: unified the code to draw depot windows
bjarni
parents:
3962
diff
changeset
|
11 |
void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2); |
4725
f7284b86833f
(svn r6637) -Codechange: merged all (vehicle type)EnterDepot into VehicleEnterDepot()
bjarni
parents:
4666
diff
changeset
|
12 |
void RecalcShipStuff(Vehicle *v); |
6223
92d2073c3d7e
(svn r8661) -Fix: [depot windows] Enlarge the blocks in the depot window if a sprite is too big to fit (ships and aircraft only)
bjarni
parents:
6034
diff
changeset
|
13 |
void GetShipSpriteSize(EngineID engine, uint &width, uint &height); |
3962 | 14 |
|
15 |
static inline bool IsShipInDepot(const Vehicle* v) |
|
16 |
{ |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6223
diff
changeset
|
17 |
assert(v->type == VEH_SHIP); |
3962 | 18 |
return v->u.ship.state == 0x80; |
19 |
} |
|
20 |
||
21 |
static inline bool IsShipInDepotStopped(const Vehicle* v) |
|
22 |
{ |
|
23 |
return IsShipInDepot(v) && v->vehstatus & VS_STOPPED; |
|
24 |
} |
|
4666
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4638
diff
changeset
|
25 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
26 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
27 |
/** |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
28 |
* This class 'wraps' Vehicle; you do not actually instantiate this class. |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
29 |
* You create a Vehicle using AllocateVehicle, so it is added to the pool |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
30 |
* and you reinitialize that to a Train using: |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
31 |
* v = new (v) Ship(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
32 |
* |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
33 |
* As side-effect the vehicle type is set correctly. |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
34 |
*/ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
35 |
struct Ship: public Vehicle { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
36 |
/** Initializes the Vehicle to a ship */ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
37 |
Ship() { this->type = VEH_SHIP; } |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
38 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
39 |
/** We want to 'destruct' the right class. */ |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
40 |
virtual ~Ship() {} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
41 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
42 |
const char *GetTypeString() const { return "ship"; } |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
43 |
void MarkDirty(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
44 |
void UpdateDeltaXY(Direction direction); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
45 |
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; } |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
46 |
WindowClass GetVehicleListWindowClass() const { return WC_SHIPS_LIST; } |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
47 |
void PlayLeaveStationSound() const; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
48 |
}; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9908
diff
changeset
|
49 |
|
4666
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4638
diff
changeset
|
50 |
#endif /* SHIP_H */ |