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 #include "engine_func.h"
00017 #include "engine_base.h"
00018 #include "economy_func.h"
00019
00020 void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
00021 void RecalcShipStuff(Vehicle *v);
00022 void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
00023
00027 struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
00028 TrackBitsByte state;
00029
00031 Ship() : SpecializedVehicle<Ship, VEH_SHIP>() {}
00033 virtual ~Ship() { this->PreDestructor(); }
00034
00035 const char *GetTypeString() const { return "ship"; }
00036 void MarkDirty();
00037 void UpdateDeltaXY(Direction direction);
00038 ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
00039 void PlayLeaveStationSound() const;
00040 bool IsPrimaryVehicle() const { return true; }
00041 SpriteID GetImage(Direction direction) const;
00042 int GetDisplaySpeed() const { return this->cur_speed / 2; }
00043 int GetDisplayMaxSpeed() const { return this->max_speed / 2; }
00044 Money GetRunningCost() const;
00045 bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; }
00046 bool Tick();
00047 void OnNewDay();
00048 Trackdir GetVehicleTrackdir() const;
00049 TileIndex GetOrderStationLocation(StationID station);
00050 bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
00051 };
00052
00053 #define FOR_ALL_SHIPS(var) FOR_ALL_VEHICLES_OF_TYPE(Ship, var)
00054
00055 #endif