OpenTTD
Data Structures | Macros | Functions
ship.h File Reference

Base for ships. More...

#include "vehicle_base.h"
#include "water_map.h"

Go to the source code of this file.

Data Structures

struct  Ship
 All ships have this type. More...
 

Macros

#define FOR_ALL_SHIPS(var)   FOR_ALL_VEHICLES_OF_TYPE(Ship, var)
 Iterate over all ships. More...
 

Functions

void GetShipSpriteSize (EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
 Get the size of the sprite of a ship sprite heading west (used for lists). More...
 
WaterClass GetEffectiveWaterClass (TileIndex tile)
 Determine the effective WaterClass for a ship travelling on a tile. More...
 

Detailed Description

Base for ships.

Definition in file ship.h.

Macro Definition Documentation

◆ FOR_ALL_SHIPS

#define FOR_ALL_SHIPS (   var)    FOR_ALL_VEHICLES_OF_TYPE(Ship, var)

Iterate over all ships.

Parameters
varThe variable used for iteration.

Definition at line 55 of file ship.h.

Function Documentation

◆ GetEffectiveWaterClass()

WaterClass GetEffectiveWaterClass ( TileIndex  tile)

Determine the effective WaterClass for a ship travelling on a tile.

Parameters
tileTile of interest
Returns
the waterclass to be used by the ship.

Definition at line 47 of file ship_cmd.cpp.

References GetWaterClass(), HasTileWaterClass(), IsTileType(), and MP_TUNNELBRIDGE.

◆ GetShipSpriteSize()

void GetShipSpriteSize ( EngineID  engine,
uint &  width,
uint &  height,
int &  xoffs,
int &  yoffs,
EngineImageType  image_type 
)

Get the size of the sprite of a ship sprite heading west (used for lists).

Parameters
engineThe engine to get the sprite from.
[out]widthThe width of the sprite.
[out]heightThe height of the sprite.
[out]xoffsNumber of pixels to shift the sprite to the right.
[out]yoffsNumber of pixels to shift the sprite downwards.
image_typeContext the sprite is used in.

Definition at line 113 of file ship_cmd.cpp.