Add support for deleted functions
[openttd/fttd.git] / src / ship.h
blob5f3d2866b2ff20dec12384a12bb59e1f81484d4f
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file ship.h Base for ships. */
12 #ifndef SHIP_H
13 #define SHIP_H
15 #include "vehicle_base.h"
16 #include "map/water.h"
17 #include "pathfinder/pos.h"
19 void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type);
20 WaterClass GetEffectiveWaterClass(TileIndex tile);
22 /**
23 * All ships have this type.
25 struct Ship FINAL : public SpecializedVehicle<Ship, VEH_SHIP> {
26 TrackdirByte trackdir; ///< The "trackdir" the ship is following.
28 /** We don't want GCC to zero our struct! It already is zeroed and has an index! */
29 Ship() : SpecializedVehicleBase() {}
30 /** We want to 'destruct' the right class. */
31 virtual ~Ship() { this->PreDestructor(); }
33 void MarkDirty();
34 void UpdateDeltaXY(Direction direction);
35 ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
36 void PlayLeaveStationSound() const;
37 bool IsPrimaryVehicle() const { return true; }
38 SpriteID GetImage(Direction direction, EngineImageType image_type) const;
39 int GetDisplaySpeed() const { return this->cur_speed / 2; }
40 int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; }
41 int GetCurrentMaxSpeed() const { return min(this->vcache.cached_max_speed, this->current_order.max_speed * 2); }
42 Money GetRunningCost() const;
43 bool IsInDepot() const { return this->trackdir == TRACKDIR_DEPOT; }
44 bool Tick();
45 void OnNewDay();
46 ShipPathPos GetPos() const;
47 TileIndex GetOrderStationLocation(StationID station);
48 bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
49 void UpdateCache();
52 /**
53 * Iterate over all ships.
54 * @param var The variable used for iteration.
56 #define FOR_ALL_SHIPS(var) FOR_ALL_VEHICLES_OF_TYPE(Ship, var)
58 #endif /* SHIP_H */