ship.h

Go to the documentation of this file.
00001 /* $Id: ship.h 21098 2010-11-06 13:03:17Z terkhen $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef SHIP_H
00013 #define SHIP_H
00014 
00015 #include "vehicle_base.h"
00016 
00017 void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
00018 
00022 struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
00023   TrackBitsByte state;
00024 
00026   Ship() : SpecializedVehicle<Ship, VEH_SHIP>() {}
00028   virtual ~Ship() { this->PreDestructor(); }
00029 
00030   const char *GetTypeString() const { return "ship"; }
00031   void MarkDirty();
00032   void UpdateDeltaXY(Direction direction);
00033   ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
00034   void PlayLeaveStationSound() const;
00035   bool IsPrimaryVehicle() const { return true; }
00036   SpriteID GetImage(Direction direction) const;
00037   int GetDisplaySpeed() const { return this->cur_speed / 2; }
00038   int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; }
00039   Money GetRunningCost() const;
00040   bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; }
00041   bool Tick();
00042   void OnNewDay();
00043   Trackdir GetVehicleTrackdir() const;
00044   TileIndex GetOrderStationLocation(StationID station);
00045   bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
00046   void UpdateCache();
00047 };
00048 
00049 #define FOR_ALL_SHIPS(var) FOR_ALL_VEHICLES_OF_TYPE(Ship, var)
00050 
00051 #endif /* SHIP_H */

Generated on Fri Dec 31 17:15:38 2010 for OpenTTD by  doxygen 1.6.1