(svn r27953) -Cleanup: Adjust other languages for r27952
[openttd.git] / src / ship.h
blobc94cbcddb7c260820aed69850932e97ad9ff2a43
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 "water_map.h"
18 void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type);
19 WaterClass GetEffectiveWaterClass(TileIndex tile);
21 /**
22 * All ships have this type.
24 struct Ship FINAL : public SpecializedVehicle<Ship, VEH_SHIP> {
25 TrackBitsByte state; ///< The "track" the ship is following.
27 /** We don't want GCC to zero our struct! It already is zeroed and has an index! */
28 Ship() : SpecializedVehicleBase() {}
29 /** We want to 'destruct' the right class. */
30 virtual ~Ship() { this->PreDestructor(); }
32 void MarkDirty();
33 void UpdateDeltaXY(Direction direction);
34 ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
35 void PlayLeaveStationSound() const;
36 bool IsPrimaryVehicle() const { return true; }
37 void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const;
38 int GetDisplaySpeed() const { return this->cur_speed / 2; }
39 int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; }
40 int GetCurrentMaxSpeed() const { return min(this->vcache.cached_max_speed, this->current_order.GetMaxSpeed() * 2); }
41 Money GetRunningCost() const;
42 bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; }
43 bool Tick();
44 void OnNewDay();
45 Trackdir GetVehicleTrackdir() const;
46 TileIndex GetOrderStationLocation(StationID station);
47 bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
48 void UpdateCache();
51 /**
52 * Iterate over all ships.
53 * @param var The variable used for iteration.
55 #define FOR_ALL_SHIPS(var) FOR_ALL_VEHICLES_OF_TYPE(Ship, var)
57 #endif /* SHIP_H */