| OpenTTD
    | 
Map accessors for water tiles. More...
Go to the source code of this file.
| Data Structures | |
| struct | EnumPropsT< WaterClass > | 
| Helper information for extract tool.  More... | |
| Enumerations | |
| enum | WaterTileTypeBitLayout { WBL_TYPE_BEGIN = 4, WBL_TYPE_COUNT = 4, WBL_TYPE_NORMAL = 0x0, WBL_TYPE_LOCK = 0x1, WBL_TYPE_DEPOT = 0x8, WBL_COAST_FLAG = 0, WBL_LOCK_ORIENT_BEGIN = 0, WBL_LOCK_ORIENT_COUNT = 2, WBL_LOCK_PART_BEGIN = 2, WBL_LOCK_PART_COUNT = 2, WBL_DEPOT_PART = 0, WBL_DEPOT_AXIS = 1 } | 
| Bit field layout of m5 for water tiles.  More... | |
| enum | WaterTileType { WATER_TILE_CLEAR, WATER_TILE_COAST, WATER_TILE_LOCK, WATER_TILE_DEPOT } | 
| Available water tile types.  More... | |
| enum | WaterClass { WATER_CLASS_SEA, WATER_CLASS_CANAL, WATER_CLASS_RIVER, WATER_CLASS_INVALID } | 
| classes of water (for WATER_TILE_CLEAR water tile type).  More... | |
| enum | DepotPart { DEPOT_PART_NORTH = 0, DEPOT_PART_SOUTH = 1, DEPOT_PART_END } | 
| Sections of the water depot.  More... | |
| enum | LockPart { LOCK_PART_MIDDLE = 0, LOCK_PART_LOWER = 1, LOCK_PART_UPPER = 2 } | 
| Sections of the water lock.  More... | |
| Functions | |
| static WaterTileType | GetWaterTileType (TileIndex t) | 
| Get the water tile type at a tile. | |
| static bool | HasTileWaterClass (TileIndex t) | 
| Checks whether the tile has an waterclass associated. | |
| static WaterClass | GetWaterClass (TileIndex t) | 
| Get the water class at a tile. | |
| static void | SetWaterClass (TileIndex t, WaterClass wc) | 
| Set the water class at a tile. | |
| static bool | IsTileOnWater (TileIndex t) | 
| Tests if the tile was built on water. | |
| static bool | IsWater (TileIndex t) | 
| Is it a plain water tile? | |
| static bool | IsSea (TileIndex t) | 
| Is it a sea water tile? | |
| static bool | IsCanal (TileIndex t) | 
| Is it a canal tile? | |
| static bool | IsRiver (TileIndex t) | 
| Is it a river water tile? | |
| static bool | IsWaterTile (TileIndex t) | 
| Is it a water tile with plain water? | |
| static bool | IsCoast (TileIndex t) | 
| Is it a coast tile? | |
| static bool | IsCoastTile (TileIndex t) | 
| Is it a coast tile. | |
| static bool | IsShipDepot (TileIndex t) | 
| Is it a water tile with a ship depot on it? | |
| static bool | IsShipDepotTile (TileIndex t) | 
| Is it a ship depot tile? | |
| static Axis | GetShipDepotAxis (TileIndex t) | 
| Get the axis of the ship depot. | |
| static DepotPart | GetShipDepotPart (TileIndex t) | 
| Get the part of a ship depot. | |
| static DiagDirection | GetShipDepotDirection (TileIndex t) | 
| Get the direction of the ship depot. | |
| static TileIndex | GetOtherShipDepotTile (TileIndex t) | 
| Get the other tile of the ship depot. | |
| static TileIndex | GetShipDepotNorthTile (TileIndex t) | 
| Get the most northern tile of a ship depot. | |
| static bool | IsLock (TileIndex t) | 
| Is there a lock on a given water tile? | |
| static DiagDirection | GetLockDirection (TileIndex t) | 
| Get the direction of the water lock. | |
| static byte | GetLockPart (TileIndex t) | 
| Get the part of a lock. | |
| static byte | GetWaterTileRandomBits (TileIndex t) | 
| Get the random bits of the water tile. | |
| static bool | HasTileWaterGround (TileIndex t) | 
| Checks whether the tile has water at the ground. | |
| static void | MakeShore (TileIndex t) | 
| Helper function to make a coast tile. | |
| static void | MakeWater (TileIndex t, Owner o, WaterClass wc, uint8 random_bits) | 
| Helper function for making a watery tile. | |
| static void | MakeSea (TileIndex t) | 
| Make a sea tile. | |
| static void | MakeRiver (TileIndex t, uint8 random_bits) | 
| Make a river tile. | |
| static void | MakeCanal (TileIndex t, Owner o, uint8 random_bits) | 
| Make a canal tile. | |
| static void | MakeShipDepot (TileIndex t, Owner o, DepotID did, DepotPart part, Axis a, WaterClass original_water_class) | 
| Make a ship depot section. | |
| static void | MakeLockTile (TileIndex t, Owner o, LockPart part, DiagDirection dir, WaterClass original_water_class) | 
| Make a lock section. | |
| static void | MakeLock (TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper, WaterClass wc_middle) | 
| Make a water lock. | |
Map accessors for water tiles.
Definition in file water_map.h.
| enum DepotPart | 
Sections of the water depot.
Definition at line 59 of file water_map.h.
| enum LockPart | 
Sections of the water lock.
| LOCK_PART_MIDDLE | Middle part of a lock. | 
| LOCK_PART_LOWER | Lower part of a lock. | 
| LOCK_PART_UPPER | Upper part of a lock. | 
Definition at line 66 of file water_map.h.
| enum WaterClass | 
classes of water (for WATER_TILE_CLEAR water tile type).
| WATER_CLASS_SEA | Sea. | 
| WATER_CLASS_CANAL | Canal. | 
| WATER_CLASS_RIVER | River. | 
| WATER_CLASS_INVALID | Used for industry tiles on land (also for oilrig if newgrf says so). | 
Definition at line 49 of file water_map.h.
| enum WaterTileType | 
Available water tile types.
| WATER_TILE_CLEAR | Plain water. | 
| WATER_TILE_COAST | Coast. | 
| WATER_TILE_LOCK | Water lock. | 
| WATER_TILE_DEPOT | Water Depot. | 
Definition at line 41 of file water_map.h.
Bit field layout of m5 for water tiles.
| WBL_TYPE_BEGIN | Start of the 'type' bitfield. | 
| WBL_TYPE_COUNT | Length of the 'type' bitfield. | 
| WBL_TYPE_NORMAL | Clear water or coast ('type' bitfield). | 
| WBL_TYPE_LOCK | Lock ('type' bitfield). | 
| WBL_TYPE_DEPOT | Depot ('type' bitfield). | 
| WBL_COAST_FLAG | Flag for coast. | 
| WBL_LOCK_ORIENT_BEGIN | Start of lock orientiation bitfield. | 
| WBL_LOCK_ORIENT_COUNT | Length of lock orientiation bitfield. | 
| WBL_LOCK_PART_BEGIN | Start of lock part bitfield. | 
| WBL_LOCK_PART_COUNT | Length of lock part bitfield. | 
| WBL_DEPOT_PART | Depot part flag. | 
| WBL_DEPOT_AXIS | Depot axis flag. | 
Definition at line 21 of file water_map.h.
| 
 | inlinestatic | 
Get the direction of the water lock.
| t | Water tile to query. | 
Definition at line 308 of file water_map.h.
References _m, GB(), IsLock(), WBL_LOCK_ORIENT_BEGIN, and WBL_LOCK_ORIENT_COUNT.
Referenced by DrawWaterLock(), IsWateredTile(), and RemoveLock().
| 
 | inlinestatic | 
Get the part of a lock.
| t | Water tile to query. | 
Definition at line 320 of file water_map.h.
References _m, GB(), IsLock(), WBL_LOCK_PART_BEGIN, and WBL_LOCK_PART_COUNT.
Referenced by AfterLoadCompanyStats(), DrawWaterLock(), and CanalScopeResolver::GetVariable().
Get the other tile of the ship depot.
| t | Tile to query, containing one section of a ship depot. | 
Definition at line 272 of file water_map.h.
References AXIS_X, DEPOT_PART_NORTH, GetShipDepotAxis(), GetShipDepotPart(), and TileDiffXY().
Referenced by AfterLoadGame(), and GetShipDepotNorthTile().
Get the axis of the ship depot.
| t | Water tile to query. | 
Definition at line 237 of file water_map.h.
References _m, GB(), IsShipDepotTile(), and WBL_DEPOT_AXIS.
Referenced by DrawWaterDepot(), GetOtherShipDepotTile(), and GetShipDepotDirection().
| 
 | inlinestatic | 
Get the direction of the ship depot.
| t | Water tile to query. | 
Definition at line 261 of file water_map.h.
References GetShipDepotAxis(), GetShipDepotPart(), and XYNSToDiagDir().
Referenced by GetDepotDirection(), and Ship::GetVehicleTrackdir().
Get the most northern tile of a ship depot.
| t | One of the tiles of the ship depot. | 
Definition at line 283 of file water_map.h.
References GetOtherShipDepotTile(), and IsShipDepot().
Referenced by CmdBuildShip().
Get the part of a ship depot.
| t | Water tile to query. | 
Definition at line 249 of file water_map.h.
References _m, GB(), IsShipDepotTile(), and WBL_DEPOT_PART.
Referenced by DrawWaterDepot(), GetOtherShipDepotTile(), and GetShipDepotDirection().
| 
 | inlinestatic | 
Get the water class at a tile.
| t | Water tile to query. | 
Definition at line 106 of file water_map.h.
References _m, GB(), and HasTileWaterClass().
Referenced by AfterLoadCompanyStats(), AfterLoadGame(), AmbientSoundEffectCallback(), BuildObject(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildShipDepot(), CmdLandscapeClear(), DoBuildLock(), DoCreateNewIndustry(), DrawTile_TunnelBridge(), GetEffectiveWaterClass(), GetFloodingBehaviour(), GetNearbyTileInformation(), IsCanal(), IsRiver(), IsSea(), IsTileOnWater(), RemoveLock(), and SetWaterClassDependingOnSurroundings().
| 
 | inlinestatic | 
Get the random bits of the water tile.
| t | Water tile to query. | 
Definition at line 332 of file water_map.h.
References _m, IsTileType(), Tile::m4, and MP_WATER.
Referenced by CanalScopeResolver::GetRandomBits(), and CanalScopeResolver::GetVariable().
| 
 | inlinestatic | 
Get the water tile type at a tile.
| t | Water tile to query. | 
Definition at line 77 of file water_map.h.
References _m, GB(), HasBit(), IsTileType(), MP_WATER, WATER_TILE_CLEAR, WATER_TILE_COAST, WATER_TILE_DEPOT, WATER_TILE_LOCK, WBL_COAST_FLAG, WBL_TYPE_BEGIN, WBL_TYPE_COUNT, WBL_TYPE_DEPOT, WBL_TYPE_LOCK, and WBL_TYPE_NORMAL.
Referenced by AfterLoadGame(), IsCoast(), IsLock(), IsShipDepot(), IsWater(), and IsWateredTile().
| 
 | inlinestatic | 
Checks whether the tile has an waterclass associated.
You can then subsequently call GetWaterClass().
| t | Tile to query. | 
Definition at line 95 of file water_map.h.
References IsTileType(), MP_INDUSTRY, MP_OBJECT, MP_STATION, and MP_WATER.
Referenced by AmbientSoundEffectCallback(), CheckIfIndustryTilesAreFree(), CmdLandscapeClear(), DrawTile_TunnelBridge(), GetEffectiveWaterClass(), GetNearbyTileInformation(), GetWaterClass(), HasTileWaterGround(), and SetWaterClass().
| 
 | inlinestatic | 
Checks whether the tile has water at the ground.
That is, it is either some plain water tile, or a object/industry/station/... with water under it.
Definition at line 344 of file water_map.h.
References HasTileWaterClass(), IsCoastTile(), and IsTileOnWater().
Referenced by CanFollowRoad(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildObject(), CmdBuildShipDepot(), CmdBuildTunnel(), GetClosestWaterDistance(), and GrowTownInTile().
| 
 | inlinestatic | 
Is it a canal tile?
| t | Water tile to query. | 
true if it is a canal tile. Definition at line 163 of file water_map.h.
References GetWaterClass(), IsWater(), and WATER_CLASS_CANAL.
Referenced by MarkTileDirtyIfCanalOrRiver().
| 
 | inlinestatic | 
Is it a coast tile?
| t | Water tile to query. | 
true if it is a sea water tile. Definition at line 195 of file water_map.h.
References GetWaterTileType(), and WATER_TILE_COAST.
Referenced by CanPlantTreesOnTile(), CmdBuildBridge(), CmdPlantTree(), DoDryUp(), GetFloodingBehaviour(), IsCoastTile(), and SetWaterClassDependingOnSurroundings().
| 
 | inlinestatic | 
Is it a coast tile.
| t | Tile to query. | 
true if it is a coast. Definition at line 205 of file water_map.h.
References IsCoast(), IsTileType(), and MP_WATER.
Referenced by CmdLandscapeClear(), and HasTileWaterGround().
| 
 | inlinestatic | 
Is there a lock on a given water tile?
| t | Water tile to query. | 
true if it is a water lock tile. Definition at line 297 of file water_map.h.
References GetWaterTileType(), and WATER_TILE_LOCK.
Referenced by AfterLoadCompanyStats(), AfterLoadGame(), GetLockDirection(), GetLockPart(), CanalScopeResolver::GetVariable(), and SetWaterClassDependingOnSurroundings().
| 
 | inlinestatic | 
Is it a river water tile?
| t | Water tile to query. | 
true if it is a river water tile. Definition at line 174 of file water_map.h.
References GetWaterClass(), IsWater(), and WATER_CLASS_RIVER.
Referenced by MarkTileDirtyIfCanalOrRiver().
| 
 | inlinestatic | 
Is it a sea water tile?
| t | Water tile to query. | 
true if it is a sea water tile. Definition at line 152 of file water_map.h.
References GetWaterClass(), IsWater(), and WATER_CLASS_SEA.
Referenced by GrowTownWithBridge().
| 
 | inlinestatic | 
Is it a water tile with a ship depot on it?
| t | Water tile to query. | 
true if it is a ship depot tile. Definition at line 216 of file water_map.h.
References GetWaterTileType(), and WATER_TILE_DEPOT.
Referenced by AfterLoadCompanyStats(), AfterLoadGame(), GetShipDepotNorthTile(), and IsShipDepotTile().
| 
 | inlinestatic | 
Is it a ship depot tile?
| t | Tile to query. | 
true if it is a ship depot tile. Definition at line 226 of file water_map.h.
References IsShipDepot(), IsTileType(), and MP_WATER.
Referenced by AfterLoadGame(), CmdInsertOrder(), GetDepotIndex(), GetShipDepotAxis(), GetShipDepotPart(), IsDepotTile(), and IsDepotTypeTile().
| 
 | inlinestatic | 
Tests if the tile was built on water.
| t | the tile to check | 
Definition at line 130 of file water_map.h.
References GetWaterClass(), and WATER_CLASS_INVALID.
Referenced by CheckIfIndustryTilesAreFree(), CmdLandscapeClear(), DrawTileLayout(), SmallMapWindow::GetTileColours(), HasTileWaterGround(), and IsWateredTile().
| 
 | inlinestatic | 
Is it a plain water tile?
| t | Water tile to query. | 
true if any type of clear water like ocean, river, or canal. Definition at line 141 of file water_map.h.
References GetWaterTileType(), and WATER_TILE_CLEAR.
Referenced by AfterLoadGame(), CleanUpRoadBits(), CmdBuildBridge(), CMSAWater(), IsCanal(), IsRiver(), IsSea(), and IsWaterTile().
| 
 | inlinestatic | 
Is it a water tile with plain water?
| t | Tile to query. | 
true if it is a plain water tile. Definition at line 184 of file water_map.h.
References IsTileType(), IsWater(), and MP_WATER.
Referenced by BuildObject(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildObject(), CmdBuildShipDepot(), CmdLandscapeClear(), DoBuildLock(), DoCreateNewIndustry(), FindSpring(), FlowRiver(), GrowTownWithBridge(), MakeLake(), and MakeLock().
Make a canal tile.
| t | The tile to change into canal | 
| o | The owner of the canal | 
| random_bits | Random bits to be set for this tile | 
Definition at line 412 of file water_map.h.
References MakeWater(), OWNER_WATER, and WATER_CLASS_CANAL.
Referenced by AfterLoadGame(), and CmdBuildCanal().
| 
 | inlinestatic | 
Make a water lock.
| t | Tile to place the water lock section. | 
| o | Owner of the lock. | 
| d | Direction of the water lock. | 
| wc_lower | Original water class of the lower part. | 
| wc_upper | Original water class of the upper part. | 
| wc_middle | Original water class of the middle part. | 
Definition at line 471 of file water_map.h.
References GetTileOwner(), IsWaterTile(), LOCK_PART_LOWER, LOCK_PART_MIDDLE, LOCK_PART_UPPER, MakeLockTile(), and TileOffsByDiagDir().
Referenced by DoBuildLock().
| 
 | inlinestatic | 
Make a lock section.
| t | Tile to place the water lock section. | 
| o | Owner of the lock. | 
| part | Part to place. | 
| dir | Lock orientation | 
| original_water_class | Original water class. | 
Definition at line 449 of file water_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, SB(), SetTileOwner(), SetTileType(), SetWaterClass(), WBL_LOCK_ORIENT_BEGIN, WBL_LOCK_PART_BEGIN, WBL_TYPE_BEGIN, and WBL_TYPE_LOCK.
Referenced by MakeLock().
| 
 | inlinestatic | 
Make a river tile.
| t | The tile to change into river | 
| random_bits | Random bits to be set for this tile | 
Definition at line 401 of file water_map.h.
References MakeWater(), OWNER_WATER, and WATER_CLASS_RIVER.
Referenced by CmdBuildCanal(), FlowRiver(), MakeLake(), and RemoveLock().
| 
 | inlinestatic | 
Make a sea tile.
| t | The tile to change into sea | 
Definition at line 391 of file water_map.h.
References MakeWater(), OWNER_WATER, and WATER_CLASS_SEA.
Referenced by AfterLoadGame(), CmdBuildCanal(), and DoFloodTile().
| 
 | inlinestatic | 
Make a ship depot section.
| t | Tile to place the ship depot section. | 
| o | Owner of the depot. | 
| did | Depot ID. | 
| part | Depot part (either DEPOT_PART_NORTH or DEPOT_PART_SOUTH). | 
| a | Axis of the depot. | 
| original_water_class | Original water class. | 
Definition at line 427 of file water_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, SB(), SetTileOwner(), SetTileType(), SetWaterClass(), WBL_DEPOT_AXIS, WBL_DEPOT_PART, WBL_TYPE_BEGIN, and WBL_TYPE_DEPOT.
Referenced by CmdBuildShipDepot().
| 
 | inlinestatic | 
Helper function to make a coast tile.
| t | The tile to change into water | 
Definition at line 354 of file water_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, OWNER_WATER, SB(), SetTileOwner(), SetTileType(), SetWaterClass(), WATER_CLASS_SEA, WBL_COAST_FLAG, WBL_TYPE_BEGIN, and WBL_TYPE_NORMAL.
Referenced by AfterLoadGame(), CmdRemoveSingleRail(), DoFloodTile(), and FloodHalftile().
| 
 | inlinestatic | 
Helper function for making a watery tile.
| t | The tile to change into water | 
| o | The owner of the water | 
| wc | The class of water the tile has to be | 
| random_bits | Eventual random bits to be set for this tile | 
Definition at line 374 of file water_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, SB(), SetTileOwner(), SetTileType(), SetWaterClass(), WBL_TYPE_BEGIN, and WBL_TYPE_NORMAL.
Referenced by MakeCanal(), MakeRiver(), and MakeSea().
| 
 | inlinestatic | 
Set the water class at a tile.
| t | Water tile to change. | 
| wc | New water class. | 
Definition at line 118 of file water_map.h.
References _m, HasTileWaterClass(), and SB().
Referenced by AfterLoadGame(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeShipDepot(), MakeShore(), MakeStation(), MakeWater(), and SetWaterClassDependingOnSurroundings().
 1.8.1.2
 1.8.1.2