src/ship.h
branchgamebalance
changeset 9911 0b8b245a2391
parent 9908 0fa543611bbe
child 9625 3301b1b3889c
equal deleted inserted replaced
9910:0b2aebc8283e 9911:0b8b245a2391
    21 static inline bool IsShipInDepotStopped(const Vehicle* v)
    21 static inline bool IsShipInDepotStopped(const Vehicle* v)
    22 {
    22 {
    23 	return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
    23 	return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
    24 }
    24 }
    25 
    25 
       
    26 
       
    27 /**
       
    28  * This class 'wraps' Vehicle; you do not actually instantiate this class.
       
    29  * You create a Vehicle using AllocateVehicle, so it is added to the pool
       
    30  * and you reinitialize that to a Train using:
       
    31  *   v = new (v) Ship();
       
    32  *
       
    33  * As side-effect the vehicle type is set correctly.
       
    34  */
       
    35 struct Ship: public Vehicle {
       
    36 	/** Initializes the Vehicle to a ship */
       
    37 	Ship() { this->type = VEH_SHIP; }
       
    38 
       
    39 	/** We want to 'destruct' the right class. */
       
    40 	virtual ~Ship() {}
       
    41 
       
    42 	const char *GetTypeString() const { return "ship"; }
       
    43 	void MarkDirty();
       
    44 	void UpdateDeltaXY(Direction direction);
       
    45 	ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
       
    46 	WindowClass GetVehicleListWindowClass() const { return WC_SHIPS_LIST; }
       
    47 	void PlayLeaveStationSound() const;
       
    48 };
       
    49 
    26 #endif /* SHIP_H */
    50 #endif /* SHIP_H */