src/ship.h
changeset 7490 bb27d92565d3
parent 7488 6f51ddf4c225
child 8116 8da76dcb3287
equal deleted inserted replaced
7489:71e233b9a937 7490:bb27d92565d3
    10 #include "variables.h"
    10 #include "variables.h"
    11 
    11 
    12 void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
    12 void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
    13 void RecalcShipStuff(Vehicle *v);
    13 void RecalcShipStuff(Vehicle *v);
    14 void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
    14 void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
    15 
       
    16 static inline bool IsShipInDepot(const Vehicle *v)
       
    17 {
       
    18 	assert(v->type == VEH_SHIP);
       
    19 	return v->u.ship.state == 0x80;
       
    20 }
       
    21 
       
    22 static inline bool IsShipInDepotStopped(const Vehicle *v)
       
    23 {
       
    24 	return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
       
    25 }
       
    26 
       
    27 
    15 
    28 /**
    16 /**
    29  * This class 'wraps' Vehicle; you do not actually instantiate this class.
    17  * This class 'wraps' Vehicle; you do not actually instantiate this class.
    30  * You create a Vehicle using AllocateVehicle, so it is added to the pool
    18  * You create a Vehicle using AllocateVehicle, so it is added to the pool
    31  * and you reinitialize that to a Train using:
    19  * and you reinitialize that to a Train using:
    49 	bool IsPrimaryVehicle() const { return true; }
    37 	bool IsPrimaryVehicle() const { return true; }
    50 	int GetImage(Direction direction) const;
    38 	int GetImage(Direction direction) const;
    51 	int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
    39 	int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
    52 	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
    40 	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
    53 	Money GetRunningCost() const { return ShipVehInfo(this->engine_type)->running_cost * _price.ship_running; }
    41 	Money GetRunningCost() const { return ShipVehInfo(this->engine_type)->running_cost * _price.ship_running; }
       
    42 	bool IsInDepot() const { return this->u.ship.state == 0x80; }
    54 	void Tick();
    43 	void Tick();
    55 };
    44 };
    56 
    45 
    57 #endif /* SHIP_H */
    46 #endif /* SHIP_H */