Data Structures | Defines | 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...

Defines

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

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).
WaterClass GetEffectiveWaterClass (TileIndex tile)
 Determine the effective WaterClass for a ship travelling on a tile.

Detailed Description

Base for ships.

Definition in file ship.h.


Define Documentation

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

Iterate over all ships.

Parameters:
var The variable used for iteration.

Definition at line 55 of file ship.h.

Referenced by RemoveDock().


Function Documentation

WaterClass GetEffectiveWaterClass ( TileIndex  tile  ) 

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

Parameters:
tile Tile of interest
Returns:
the waterclass to be used by the ship.

Definition at line 44 of file ship_cmd.cpp.

References GetTunnelBridgeTransportType(), GetWaterClass(), HasTileWaterClass(), IsTileType(), MP_RAILWAY, MP_TUNNELBRIDGE, RAIL_GROUND_WATER, and TRANSPORT_WATER.

Referenced by CYapfCostShipT< Types >::PfCalcCost(), and Ship::UpdateCache().

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:
engine The engine to get the sprite from.
[out] width The width of the sprite.
[out] height The height of the sprite.
[out] xoffs Number of pixels to shift the sprite to the right.
[out] yoffs Number of pixels to shift the sprite downwards.
image_type Context the sprite is used in.

Definition at line 97 of file ship_cmd.cpp.

References Sprite::height, ST_NORMAL, UnScaleByZoom(), Sprite::width, Sprite::x_offs, Sprite::y_offs, and ZOOM_LVL_GUI.