2006-06-05 11:28:31 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/** @file ship.h */
|
|
|
|
|
2006-09-28 18:42:35 +00:00
|
|
|
#ifndef SHIP_H
|
|
|
|
#define SHIP_H
|
|
|
|
|
2006-06-05 11:28:31 +00:00
|
|
|
#include "vehicle.h"
|
|
|
|
|
2007-01-22 00:26:46 +00:00
|
|
|
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
2006-09-26 16:47:51 +00:00
|
|
|
void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
2006-10-04 12:01:59 +00:00
|
|
|
void RecalcShipStuff(Vehicle *v);
|
2007-02-10 13:37:32 +00:00
|
|
|
void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
|
2006-06-05 11:28:31 +00:00
|
|
|
|
|
|
|
static inline bool IsShipInDepot(const Vehicle* v)
|
|
|
|
{
|
2007-03-08 16:27:54 +00:00
|
|
|
assert(v->type == VEH_SHIP);
|
2006-06-05 11:28:31 +00:00
|
|
|
return v->u.ship.state == 0x80;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool IsShipInDepotStopped(const Vehicle* v)
|
|
|
|
{
|
|
|
|
return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
|
|
|
|
}
|
2006-09-28 18:42:35 +00:00
|
|
|
|
2007-04-29 21:24:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class 'wraps' Vehicle; you do not actually instantiate this class.
|
|
|
|
* You create a Vehicle using AllocateVehicle, so it is added to the pool
|
|
|
|
* and you reinitialize that to a Train using:
|
|
|
|
* v = new (v) Ship();
|
|
|
|
*
|
|
|
|
* As side-effect the vehicle type is set correctly.
|
|
|
|
*/
|
|
|
|
struct Ship: public Vehicle {
|
|
|
|
/** Initializes the Vehicle to a ship */
|
|
|
|
Ship() { this->type = VEH_SHIP; }
|
|
|
|
|
|
|
|
/** We want to 'destruct' the right class. */
|
|
|
|
virtual ~Ship() {}
|
|
|
|
|
|
|
|
const char *GetTypeString() { return "ship"; }
|
2007-04-29 22:33:51 +00:00
|
|
|
void MarkDirty();
|
2007-05-01 16:35:14 +00:00
|
|
|
void UpdateDeltaXY(Direction direction);
|
2007-05-02 09:29:41 +00:00
|
|
|
ExpensesType GetExpenseType(bool income) { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
|
|
|
|
WindowClass GetVehicleListWindowClass() { return WC_SHIPS_LIST; }
|
2007-04-29 21:24:08 +00:00
|
|
|
};
|
|
|
|
|
2006-09-28 18:42:35 +00:00
|
|
|
#endif /* SHIP_H */
|