MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetEffectiveWaterClass

Function GetEffectiveWaterClass

src/ship_cmd.cpp:53–65  ·  view source on GitHub ↗

* Determine the effective #WaterClass for a ship travelling on a tile. * @param tile Tile of interest * @return the waterclass to be used by the ship. */

Source from the content-addressed store, hash-verified

51 * @return the waterclass to be used by the ship.
52 */
53WaterClass GetEffectiveWaterClass(TileIndex tile)
54{
55 if (HasTileWaterClass(tile)) return GetWaterClass(tile);
56 if (IsTileType(tile, MP_TUNNELBRIDGE)) {
57 assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER);
58 return WaterClass::Canal;
59 }
60 if (IsTileType(tile, MP_RAILWAY)) {
61 assert(GetRailGroundType(tile) == RailGroundType::HalfTileWater);
62 return WaterClass::Sea;
63 }
64 NOT_REACHED();
65}
66
67static const uint16_t _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
68

Callers 3

UpdateCacheMethod · 0.85
ShipControllerFunction · 0.85
PfCalcCostMethod · 0.85

Calls 6

HasTileWaterClassFunction · 0.85
GetWaterClassFunction · 0.85
IsTileTypeFunction · 0.85
GetRailGroundTypeFunction · 0.85
NOT_REACHEDFunction · 0.85

Tested by

no test coverage detected