author | truebrain |
Thu, 12 Jun 2008 21:18:09 +0000 | |
branch | noai |
changeset 10944 | 588393239ac6 |
parent 10455 | 22c441f5adf9 |
permissions | -rw-r--r-- |
3962 | 1 |
/* $Id$ */ |
2 |
||
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10355
diff
changeset
|
3 |
/** @file ship.h Base for ships. */ |
9574 | 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 |
|
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9701
diff
changeset
|
8 |
#include "vehicle_base.h" |
9837
c9ec4f82e0d0
(svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
9724
diff
changeset
|
9 |
#include "engine_func.h" |
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
10355
diff
changeset
|
10 |
#include "engine_base.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9701
diff
changeset
|
11 |
#include "economy_func.h" |
3962 | 12 |
|
6034
89a7d10fa75b
(svn r8335) -Feature: the build ship window is now also resizable horizontally and contains sorting options
bjarni
parents:
5726
diff
changeset
|
13 |
void CcBuildShip(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
|
14 |
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
|
15 |
void GetShipSpriteSize(EngineID engine, uint &width, uint &height); |
3962 | 16 |
|
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
17 |
/** |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
18 |
* This class 'wraps' Vehicle; you do not actually instantiate this class. |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
19 |
* You create a Vehicle using AllocateVehicle, so it is added to the pool |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
20 |
* and you reinitialize that to a Train using: |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
21 |
* v = new (v) Ship(); |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
22 |
* |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
23 |
* As side-effect the vehicle type is set correctly. |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
24 |
*/ |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
25 |
struct Ship: public Vehicle { |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
26 |
/** Initializes the Vehicle to a ship */ |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
27 |
Ship() { this->type = VEH_SHIP; } |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
28 |
|
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
29 |
/** We want to 'destruct' the right class. */ |
9701
d1ac22c62f64
(svn r11036) [NoAI] -Sync: with trunk r10774:11035.
rubidium
parents:
9694
diff
changeset
|
30 |
virtual ~Ship() { this->PreDestructor(); } |
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
31 |
|
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
32 |
const char *GetTypeString() const { return "ship"; } |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
33 |
void MarkDirty(); |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
34 |
void UpdateDeltaXY(Direction direction); |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
35 |
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; } |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
36 |
void PlayLeaveStationSound() const; |
9625
3301b1b3889c
(svn r10016) [NoAI] -Sync with trunk r9914:r10015.
rubidium
parents:
9620
diff
changeset
|
37 |
bool IsPrimaryVehicle() const { return true; } |
10294 | 38 |
SpriteID GetImage(Direction direction) const; |
9701
d1ac22c62f64
(svn r11036) [NoAI] -Sync: with trunk r10774:11035.
rubidium
parents:
9694
diff
changeset
|
39 |
int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; } |
d1ac22c62f64
(svn r11036) [NoAI] -Sync: with trunk r10774:11035.
rubidium
parents:
9694
diff
changeset
|
40 |
int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; } |
d1ac22c62f64
(svn r11036) [NoAI] -Sync: with trunk r10774:11035.
rubidium
parents:
9694
diff
changeset
|
41 |
Money GetRunningCost() const { return ShipVehInfo(this->engine_type)->running_cost * _price.ship_running; } |
10355
ee4b5f7a5bf2
(svn r12896) [NoAI] -Sync: with trunk r12824:r12895.
rubidium
parents:
10294
diff
changeset
|
42 |
bool IsInDepot() const { return this->u.ship.state == TRACK_BIT_DEPOT; } |
9631
8a2d1c2ceb88
(svn r10461) [NoAI] -Sync with trunk r10349:r10460.
rubidium
parents:
9625
diff
changeset
|
43 |
void Tick(); |
9724
b39bc69bb2f2
(svn r12051) [NoAI] -Sync: with trunk (r11795:12050).
rubidium
parents:
9723
diff
changeset
|
44 |
void OnNewDay(); |
9869
6404afe43575
(svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents:
9837
diff
changeset
|
45 |
TileIndex GetOrderStationLocation(StationID station); |
10142
56ee7da4ad56
(svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents:
9869
diff
changeset
|
46 |
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse); |
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
47 |
}; |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
48 |
|
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
|
49 |
#endif /* SHIP_H */ |