ship.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef SHIP_H
00013 #define SHIP_H
00014
00015 #include "vehicle_base.h"
00016
00017 void RecalcShipStuff(Vehicle *v);
00018 void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
00019
00023 struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
00024 TrackBitsByte state;
00025
00027 Ship() : SpecializedVehicle<Ship, VEH_SHIP>() {}
00029 virtual ~Ship() { this->PreDestructor(); }
00030
00031 const char *GetTypeString() const { return "ship"; }
00032 void MarkDirty();
00033 void UpdateDeltaXY(Direction direction);
00034 ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
00035 void PlayLeaveStationSound() const;
00036 bool IsPrimaryVehicle() const { return true; }
00037 SpriteID GetImage(Direction direction) const;
00038 int GetDisplaySpeed() const { return this->cur_speed / 2; }
00039 int GetDisplayMaxSpeed() const { return this->max_speed / 2; }
00040 Money GetRunningCost() const;
00041 bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; }
00042 bool Tick();
00043 void OnNewDay();
00044 Trackdir GetVehicleTrackdir() const;
00045 TileIndex GetOrderStationLocation(StationID station);
00046 bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
00047 };
00048
00049 #define FOR_ALL_SHIPS(var) FOR_ALL_VEHICLES_OF_TYPE(Ship, var)
00050
00051 #endif