Map accessors for water tiles. More...
#include "depot_type.h"#include "tile_map.h"Go to the source code of this file.
Data Structures | |
| struct | EnumPropsT< WaterClass > |
Enumerations | |
| 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_NORTH = 0x80, DEPOT_SOUTH = 0x81, DEPOT_END = 0x84 } |
Sections of the water depot. More... | |
| enum | LockPart { LOCK_MIDDLE = 0x10, LOCK_LOWER = 0x14, LOCK_UPPER = 0x18, LOCK_END = 0x1C } |
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 TileIndex | GetOtherShipDepotTile (TileIndex t) |
| Get the other tile of the ship depot. | |
| 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 DiagDirection | GetShipDepotDirection (TileIndex t) |
| Get the direction of the ship depot. | |
| static TileIndex | GetShipDepotNorthTile (TileIndex t) |
| Get the most northern tile of a ship depot. | |
| static bool | IsLock (TileIndex t) |
| Is it a water lock tile? | |
| static DiagDirection | GetLockDirection (TileIndex t) |
| Get the direction of the water lock. | |
| static byte | GetSection (TileIndex t) |
| Get a section of a depot or 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 base, Axis a, WaterClass original_water_class) |
| Make a ship depot section. | |
| static void | MakeLockTile (TileIndex t, Owner o, byte section, WaterClass original_water_class) |
| Make a lock section. | |
| static void | MakeLock (TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper) |
| 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 36 of file water_map.h.
| enum LockPart |
Sections of the water lock.
Definition at line 43 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 27 of file water_map.h.
| enum WaterTileType |
Available water tile types.
Definition at line 19 of file water_map.h.
| static DiagDirection GetLockDirection | ( | TileIndex | t | ) | [inline, static] |
Get the direction of the water lock.
| t | Water tile to query. |
Definition at line 261 of file water_map.h.
Referenced by IsWateredTile(), and RemoveLock().
Get the other tile of the ship depot.
| t | Tile to query, containing one section of a ship depot. |
Definition at line 188 of file water_map.h.
References _m, HasBit(), and TileDiffXY().
Referenced by AfterLoadGame(), and GetShipDepotNorthTile().
| static byte GetSection | ( | TileIndex | t | ) | [inline, static] |
Get a section of a depot or a lock.
| t | Water tile to query. |
Definition at line 271 of file water_map.h.
References _m, GB(), and GetWaterTileType().
Referenced by DrawWaterDepot(), and DrawWaterLock().
Get the axis of the ship depot.
| t | Water tile to query. |
Definition at line 218 of file water_map.h.
Referenced by GetShipDepotDirection().
| static DiagDirection GetShipDepotDirection | ( | TileIndex | t | ) | [inline, static] |
Get the direction of the ship depot.
| t | Water tile to query. |
Definition at line 228 of file water_map.h.
References _m, GB(), GetShipDepotAxis(), and XYNSToDiagDir().
Referenced by GetDepotDirection(), and Ship::GetVehicleTrackdir().
Get the most northern tile of a ship depot.
| tile | One of the tiles of the ship depot. |
Definition at line 238 of file water_map.h.
References GetOtherShipDepotTile(), and IsShipDepot().
Referenced by CmdBuildShip().
| static WaterClass GetWaterClass | ( | TileIndex | t | ) | [inline, static] |
Get the water class at a tile.
| t | Water tile to query. |
Definition at line 84 of file water_map.h.
References _m, GB(), and HasTileWaterClass().
Referenced by AfterLoadGame(), BuildObject(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildShipDepot(), CmdLandscapeClear(), DoBuildLock(), DoCreateNewIndustry(), DrawTile_TunnelBridge(), GetFloodingBehaviour(), IsCanal(), IsRiver(), IsSea(), IsTileOnWater(), and SetWaterClassDependingOnSurroundings().
| static byte GetWaterTileRandomBits | ( | TileIndex | t | ) | [inline, static] |
Get the random bits of the water tile.
| t | Water tile to query. |
Definition at line 282 of file water_map.h.
| static WaterTileType GetWaterTileType | ( | TileIndex | t | ) | [inline, static] |
Get the water tile type at a tile.
| t | Water tile to query. |
Definition at line 55 of file water_map.h.
References _m, IsInsideMM(), IsTileType(), and MP_WATER.
Referenced by AfterLoadGame(), GetSection(), IsCoast(), AIMarine::IsLockTile(), IsWater(), AIMarine::IsWaterDepotTile(), and IsWateredTile().
| static bool HasTileWaterClass | ( | TileIndex | t | ) | [inline, static] |
Checks whether the tile has an waterclass associated.
You can then subsequently call GetWaterClass().
| t | Tile to query. |
Definition at line 73 of file water_map.h.
References IsTileType(), MP_INDUSTRY, MP_OBJECT, MP_STATION, and MP_WATER.
Referenced by CheckIfIndustryTilesAreFree(), CmdLandscapeClear(), DrawTile_TunnelBridge(), GetWaterClass(), HasTileWaterGround(), and SetWaterClass().
| static bool HasTileWaterGround | ( | TileIndex | t | ) | [inline, static] |
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 293 of file water_map.h.
References HasTileWaterClass(), IsCoastTile(), and IsTileOnWater().
Referenced by CmdBuildBuoy(), CmdBuildDock(), CmdBuildObject(), CmdBuildShipDepot(), CmdBuildTunnel(), GetClosestWaterDistance(), and GrowTownInTile().
| static bool IsCanal | ( | TileIndex | t | ) | [inline, static] |
Is it a canal tile?
| t | Water tile to query. |
true if it is a canal tile. Definition at line 138 of file water_map.h.
References GetWaterClass(), and IsWater().
Referenced by AIMarine::IsCanalTile(), and MarkTileDirtyIfCanalOrRiver().
| static bool IsCoast | ( | TileIndex | t | ) | [inline, static] |
Is it a coast tile?
| t | Water tile to query. |
true if it is a sea water tile. Definition at line 168 of file water_map.h.
References GetWaterTileType().
Referenced by CanPlantTreesOnTile(), CmdBuildBridge(), CmdPlantTree(), DoDryUp(), GetFloodingBehaviour(), AITile::IsBuildable(), IsCoastTile(), AITile::IsCoastTile(), AITile::IsWaterTile(), and SetWaterClassDependingOnSurroundings().
| static bool IsCoastTile | ( | TileIndex | t | ) | [inline, static] |
Is it a coast tile.
| t | Tile to query. |
true if it is a coast. Definition at line 178 of file water_map.h.
References IsCoast(), IsTileType(), and MP_WATER.
Referenced by CmdLandscapeClear(), and HasTileWaterGround().
| static bool IsLock | ( | TileIndex | t | ) | [inline, static] |
Is it a water lock tile?
| t | Water tile to query. |
true if it is a water lock tile. Definition at line 251 of file water_map.h.
References _m, and IsInsideMM().
Referenced by AfterLoadGame(), and SetWaterClassDependingOnSurroundings().
| static bool IsRiver | ( | TileIndex | t | ) | [inline, static] |
Is it a river water tile?
| t | Water tile to query. |
true if it is a river water tile. Definition at line 148 of file water_map.h.
References GetWaterClass(), and IsWater().
Referenced by MarkTileDirtyIfCanalOrRiver().
| static bool IsSea | ( | TileIndex | t | ) | [inline, static] |
Is it a sea water tile?
| t | Water tile to query. |
true if it is a sea water tile. Definition at line 128 of file water_map.h.
References GetWaterClass(), and IsWater().
| static bool IsShipDepot | ( | TileIndex | t | ) | [inline, static] |
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 198 of file water_map.h.
References _m, and IsInsideMM().
Referenced by AfterLoadGame(), AIVehicleList_Depot::AIVehicleList_Depot(), GetOrderTypeByTile(), GetShipDepotNorthTile(), and IsShipDepotTile().
| static bool IsShipDepotTile | ( | TileIndex | t | ) | [inline, static] |
Is it a ship depot tile?
| t | Tile to query. |
true if it is a ship depot tile. Definition at line 208 of file water_map.h.
References IsShipDepot(), IsTileType(), and MP_WATER.
Referenced by CmdInsertOrder(), GetDepotIndex(), IsDepotTile(), and IsDepotTypeTile().
| static bool IsTileOnWater | ( | TileIndex | t | ) | [inline, static] |
Tests if the tile was built on water.
| t | the tile to check |
Definition at line 108 of file water_map.h.
References GetWaterClass(), and WATER_CLASS_INVALID.
Referenced by CheckIfIndustryTilesAreFree(), CmdLandscapeClear(), DrawTileLayout(), GetSmallMapIndustriesPixels(), HasTileWaterGround(), and IsWateredTile().
| static bool IsWater | ( | TileIndex | t | ) | [inline, static] |
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 118 of file water_map.h.
References GetWaterTileType().
Referenced by AfterLoadGame(), CleanUpRoadBits(), CmdBuildBridge(), CMSAWater(), IsCanal(), IsRiver(), IsSea(), and IsWaterTile().
| static bool IsWaterTile | ( | TileIndex | t | ) | [inline, static] |
Is it a water tile with plain water?
| t | Tile to query. |
true if it is a plain water tile. Definition at line 158 of file water_map.h.
References IsTileType(), IsWater(), and MP_WATER.
Referenced by BuildObject(), CmdBuildBuoy(), CmdBuildLock(), CmdBuildObject(), CmdBuildShipDepot(), CmdLandscapeClear(), DoBuildLock(), DoCreateNewIndustry(), GrowTownWithBridge(), 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 361 of file water_map.h.
References MakeWater(), OWNER_WATER, and WATER_CLASS_CANAL.
Referenced by AfterLoadGame(), and CmdBuildCanal().
| static void MakeLock | ( | TileIndex | t, | |
| Owner | o, | |||
| DiagDirection | d, | |||
| WaterClass | wc_lower, | |||
| WaterClass | wc_upper | |||
| ) | [inline, static] |
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. |
Definition at line 418 of file water_map.h.
References GetTileOwner(), IsWaterTile(), MakeLockTile(), TileOffsByDiagDir(), and WATER_CLASS_CANAL.
Referenced by DoBuildLock().
| static void MakeLockTile | ( | TileIndex | t, | |
| Owner | o, | |||
| byte | section, | |||
| WaterClass | original_water_class | |||
| ) | [inline, static] |
Make a lock section.
| t | Tile to place the water lock section. | |
| o | Owner of the lock. | |
| section | Section to place. | |
| original_water_class | Original water class. |
Definition at line 397 of file water_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, SB(), SetTileOwner(), SetTileType(), and SetWaterClass().
Referenced by MakeLock().
| static void MakeRiver | ( | TileIndex | t, | |
| uint8 | random_bits | |||
| ) | [inline, static] |
Make a river tile.
| t | The tile to change into river | |
| random_bits | Random bits to be set for this tile |
Definition at line 350 of file water_map.h.
References MakeWater(), OWNER_WATER, and WATER_CLASS_RIVER.
Referenced by CmdBuildCanal().
| static void MakeSea | ( | TileIndex | t | ) | [inline, static] |
Make a sea tile.
| t | The tile to change into sea |
Definition at line 340 of file water_map.h.
References MakeWater(), OWNER_WATER, and WATER_CLASS_SEA.
Referenced by AfterLoadGame(), CmdBuildCanal(), and DoFloodTile().
| static void MakeShipDepot | ( | TileIndex | t, | |
| Owner | o, | |||
| DepotID | did, | |||
| DepotPart | base, | |||
| Axis | a, | |||
| WaterClass | original_water_class | |||
| ) | [inline, static] |
Make a ship depot section.
| t | Tile to place the ship depot section. | |
| o | Owner of the depot. | |
| did | Depot ID. | |
| base | Depot base (either DEPOT_NORTH or DEPOT_SOUTH). | |
| a | Axis of the depot. | |
| original_water_class | Original water class. |
Definition at line 376 of file water_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, SB(), SetTileOwner(), SetTileType(), and SetWaterClass().
Referenced by CmdBuildShipDepot().
| static void MakeShore | ( | TileIndex | t | ) | [inline, static] |
Helper function to make a coast tile.
| t | The tile to change into water |
Definition at line 303 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(), and WATER_CLASS_SEA.
Referenced by AfterLoadGame(), CmdRemoveSingleRail(), DoFloodTile(), and FloodHalftile().
| static void MakeWater | ( | TileIndex | t, | |
| Owner | o, | |||
| WaterClass | wc, | |||
| uint8 | random_bits | |||
| ) | [inline, static] |
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 323 of file water_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, SB(), SetTileOwner(), SetTileType(), and SetWaterClass().
Referenced by MakeCanal(), MakeRiver(), and MakeSea().
| static void SetWaterClass | ( | TileIndex | t, | |
| WaterClass | wc | |||
| ) | [inline, static] |
Set the water class at a tile.
| t | Water tile to change. | |
| wc | New water class. |
Definition at line 96 of file water_map.h.
References _m, HasTileWaterClass(), and SB().
Referenced by AfterLoadGame(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeShipDepot(), MakeShore(), MakeStation(), MakeWater(), and SetWaterClassDependingOnSurroundings().
1.7.1