#include "tile_type.h"
#include "slope_type.h"
#include "company_type.h"
#include "map_func.h"
#include "core/bitmath_func.hpp"
#include "settings_type.h"
Go to the source code of this file.
Functions | |
static uint | TileHeight (TileIndex tile) |
Returns the height of a tile. | |
static void | SetTileHeight (TileIndex tile, uint height) |
Sets the height of a tile. | |
static uint | TilePixelHeight (TileIndex tile) |
Returns the height of a tile in pixels. | |
static TileType | GetTileType (TileIndex tile) |
Get the tiletype of a given tile. | |
static void | SetTileType (TileIndex tile, TileType type) |
Set the type of a tile. | |
static bool | IsTileType (TileIndex tile, TileType type) |
Checks if a tile is a give tiletype. | |
static bool | IsValidTile (TileIndex tile) |
Checks if a tile is valid. | |
static Owner | GetTileOwner (TileIndex tile) |
Returns the owner of a tile. | |
static void | SetTileOwner (TileIndex tile, Owner owner) |
Sets the owner of a tile. | |
static bool | IsTileOwner (TileIndex tile, Owner owner) |
Checks if a tile belongs to the given owner. | |
static void | SetTropicZone (TileIndex tile, TropicZone type) |
Set the tropic zone. | |
static TropicZone | GetTropicZone (TileIndex tile) |
Get the tropic zone. | |
Slope | GetTileSlope (TileIndex tile, uint *h) |
Return the slope of a given tile. | |
uint | GetTileZ (TileIndex tile) |
Get bottom height of the tile. | |
uint | GetTileMaxZ (TileIndex tile) |
Get top height of the tile. |
Definition in file tile_map.h.
uint GetTileMaxZ | ( | TileIndex | t | ) |
Get top height of the tile.
t | Tile to compute height of |
Definition at line 82 of file tile_map.cpp.
References MapMaxX(), MapMaxY(), max(), TILE_HEIGHT, TileDiffXY(), TileHeight(), TileX(), and TileY().
Referenced by AutoslopeCheckForEntranceEdge(), BuildTownHouse(), CheckBuildHouseSameZ(), CmdBuildBridge(), DrawCatenary(), DrawCatenaryRailway(), DrawRoadBits(), DrawTramCatenary(), and AITile::GetMaxHeight().
Returns the owner of a tile.
This function returns the owner of a tile. This cannot used for tiles which type is one of MP_HOUSE, MP_VOID and MP_INDUSTRY as no company owned any of these buildings.
tile | The tile to check |
The type of the tile must not be MP_HOUSE and MP_INDUSTRY
Definition at line 141 of file tile_map.h.
References _m, IsTileType(), IsValidTile(), Tile::m1, MP_HOUSE, and MP_INDUSTRY.
Referenced by AIDepotList::AIDepotList(), CmdBuildAircraft(), CmdBuildBridge(), CmdBuildRailVehicle(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildRoadVeh(), CmdBuildShip(), CmdDepotMassAutoReplace(), CmdInsertOrder(), CmdRemoveSingleRail(), CmdRemoveSingleSignal(), DeleteVisibleTrain(), DisasterTick_Big_Ufo(), DisasterTick_Zeppeliner(), DrawTile_Road(), ExploreSegment(), FixOwnerOfRailTrack(), AITile::GetOwner(), GetSmallMapOwnerPixels(), GetTrainForReservation(), IsInfraTileUsageAllowed(), IsTileOwner(), IsValidTileForWaypoint(), MoveWaypointsToBaseStations(), OrderDestinationIsAllowed(), PayDailyTrackSharingFee(), RemoveBuoy(), RemoveFromRailBaseStation(), RemoveRailStation(), RemoveRoad(), UpdateAllBlockSignals(), and VehiclePositionIsAllowed().
Return the slope of a given tile.
tile | Tile to compute slope of | |
h | If not NULL , pointer to storage of z height |
Definition at line 21 of file tile_map.cpp.
References _settings_game, GameSettings::construction, ConstructionSettings::freeform_edges, MapMaxX(), MapMaxY(), MapSize(), min(), SLOPE_E, SLOPE_FLAT, SLOPE_N, SLOPE_S, SLOPE_W, TILE_HEIGHT, TileDiffXY(), TileHeight(), TileX(), and TileY().
Referenced by BuildTownHouse(), CanBuildHouseHere(), CanPlantTreesOnTile(), CheckFlatLandBelow(), CmdBuildBridge(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildDock(), CmdBuildLock(), CmdBuildRoad(), CmdBuildRoadDepot(), CmdBuildShipDepot(), CmdBuildSingleRail(), CmdBuildTrainDepot(), CmdBuildTunnel(), CmdPlantTree(), CmdRemoveSingleRail(), DoBuildShiplift(), DoFloodTile(), DrawCatenaryRailway(), FindFurthestFromWater(), FloodHalftile(), GetBridgeHeight(), AITile::GetCornerHeight(), GetFloodingBehaviour(), GetFoundationSlope(), GetNearbyTileInformation(), AITunnel::GetOtherTunnelEnd(), AITile::GetSlope(), GetTownRoadGridElement(), GrowTown(), GrowTownWithBridge(), IsRoadAllowedHere(), IsValidTileForWaypoint(), IsWateredTile(), RemoveRoad(), SetWaterClassDependingOnSurroundings(), and TownCanBePlacedHere().
Get the tiletype of a given tile.
tile | The tile to get the TileType |
Definition at line 76 of file tile_map.h.
References _m, GB(), and MapSize().
Referenced by AIVehicleList_Depot::AIVehicleList_Depot(), CanEnterTileOwnerCheck(), CanPlantTreesOnTile(), ChangeTileOwner(), CleanUpRoadBits(), CmdBuildBridge(), CmdBuildRoad(), CmdBuildSingleRail(), CmdConvertRail(), CmdLandscapeClear(), CmdPlantTree(), CmdRemoveSingleRail(), CmdTerraformLand(), DoDryUp(), DoFloodTile(), DrawCatenary(), ExploreSegment(), GenerateRockyArea(), GetAnyRoadBits(), GetFloodingBehaviour(), GetFoundationSlope(), GetNearbyTileInformation(), GetOrderTypeByTile(), GetRailTrackBitsUniversal(), GetReservedTrackbits(), GetSmallMapOwnerPixels(), GetTileRailType(), GetTileTrackStatus(), GrowTownWithExtraHouse(), AITile::IsBuildable(), IsTileType(), IsWateredTile(), NeighbourHasReachableRoad(), NPFMarkTile(), PlantTreesOnTile(), RemoveRoad(), SetWaterClassDependingOnSurroundings(), TryReserveRailTrack(), UnreserveRailTrack(), UpdateSignalsInBuffer(), and VehicleEnterTile().
uint GetTileZ | ( | TileIndex | tile | ) |
Get bottom height of the tile.
tile | Tile to compute height of |
Definition at line 66 of file tile_map.cpp.
References MapMaxX(), MapMaxY(), min(), TILE_HEIGHT, TileDiffXY(), TileHeight(), TileX(), and TileY().
Referenced by DrawCatenaryOnTunnel(), AITile::GetMinHeight(), GetOtherTunnelEnd(), GetTerrainType(), IsTunnelInWayDir(), MarkTileDirtyByTile(), PlaceTreeAtSameHeight(), and PlaceTreesRandomly().
static TropicZone GetTropicZone | ( | TileIndex | tile | ) | [inline, static] |
Get the tropic zone.
tile | the tile to get the zone of |
Definition at line 200 of file tile_map.h.
References _m, GB(), and MapSize().
Referenced by GetRandomTreeType(), GetTerrainType(), PlaceTreesRandomly(), and UpdateTownGrowRate().
Checks if a tile belongs to the given owner.
tile | The tile to check | |
owner | The owner to check agains |
Definition at line 177 of file tile_map.h.
References GetTileOwner().
Referenced by CheckVehicleControlAllowed(), CmdBuildBridge(), CmdBuildCanal(), CmdPurchaseLandArea(), and IsVehicleControlAllowed().
Checks if a tile is a give tiletype.
This function checks if a tile got the given tiletype.
tile | The tile to check | |
type | The type to check agains |
Definition at line 113 of file tile_map.h.
References GetTileType().
Referenced by AddClearCounter(), AddClearDensity(), AddNearbyStation(), AddTreeCount(), AddTreeCounter(), AddTreeGrowth(), AdjustTileh(), AIDepotList::AIDepotList(), AITileList_IndustryAccepting::AITileList_IndustryAccepting(), AITileList_IndustryProducing::AITileList_IndustryProducing(), AITileList_StationType::AITileList_StationType(), CanBuildHouseHere(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CanEnterTile(), CheckFlatLandBelow(), CheckNextTrainTile(), CheckRailSlope(), CheckSubsidised(), ClearPathReservation(), CmdBuildCanal(), CmdBuildDock(), CmdBuildLongRoad(), CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoad(), CmdBuildSingleRail(), CmdPlantTree(), CmdRemoveRoadStop(), CmdReverseTrainDirection(), CmdTerraformLand(), CmdTurnRoadVeh(), CMSAForest(), CMSAMine(), CMSATree(), CMSAWater(), DecHouseProcessingTime(), DeleteLastWagon(), DeleteVisibleTrain(), DisasterTick_Aircraft(), DisasterTick_Zeppeliner(), DoClearTownHouseHelper(), DoFloodTile(), DrawCatenaryRailway(), ExtendTrainReservation(), FindFurthestFromWater(), FindIndustryToDeliver(), FindNearestEmptyLand(), FindNearIndustryName(), FindStationsAroundTiles(), FindStationsNearby(), FloodVehicles(), FollowReservation(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::FollowTileExit(), FreeTrainTrackReservation(), GetAxisForNewWaypoint(), GetCleanHouseType(), GetCleanIndustryGfx(), GetClearCounter(), GetClearDensity(), GetClearGround(), GetClosestWaterDistance(), GetCompanyHQSection(), GetCompanyHQSize(), AIIndustry::GetDockLocation(), GetFenceSE(), GetFenceSW(), AIAirport::GetHangarOfAirport(), AIIndustry::GetHeliportLocation(), GetHouseAge(), GetHouseAnimationFrame(), GetHouseBuildingStage(), GetHouseConstructionTick(), GetHouseProcessingTime(), GetHouseRandomBits(), GetHouseTriggers(), GetIndustryAnimationLoop(), GetIndustryAnimationState(), GetIndustryConstructionCounter(), GetIndustryConstructionStage(), GetIndustryGfx(), GetIndustryIDAtOffset(), GetIndustryIndex(), GetIndustryRandomBits(), GetIndustryTriggers(), GetIndustryType(), GetNearbyIndustryTileInformation(), GetNearbyTileInformation(), AIAirport::GetNumHangars(), GetOtherTunnelBridgeEnd(), AITile::GetOwner(), GetRailTileType(), AIRail::GetSignalType(), GetStationAnimationFrame(), GetStationAround(), GetStationGfx(), AIStation::GetStationID(), GetStationIndex(), GetStationType(), GetTileOwner(), GetTownIndex(), GetTrainForReservation(), GetTreeCount(), GetTreeCounter(), GetTreeDensity(), GetTreeGround(), GetTreeGrowth(), GetTreeType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), GetUnmovableType(), GrowTown(), GrowTownAtRoad(), GrowTownInTile(), HasOnewaySignalBlockingTrackdir(), HasPbsSignalOnTrackdir(), HasStationTileRail(), AITile::HasTreeOnTile(), HasTunnelBridgeReservation(), HasTunnelBridgeSnowOrDesert(), HouseGetVariable(), IncHouseConstructionTick(), IncrementHouseAge(), IndustryGetVariable(), AIOrder::InsertOrder(), AIAirport::IsAirportTile(), IsBridge(), IsBridgeTile(), AIMarine::IsBuoyTile(), AIMarine::IsCanalTile(), AITile::IsCoastTile(), IsCompanyHQ(), AITile::IsDesertTile(), AIMarine::IsDockTile(), RoadStop::IsDriveThroughRoadStopContinuation(), AITile::IsFarmTile(), IsHangar(), AIAirport::IsHangarTile(), IsHouseCompleted(), IsIndustryCompleted(), IsIndustryTileOnWater(), AIMarine::IsLockTile(), IsOwnedLand(), IsOwnedLandTile(), IsPlainRailTile(), IsPossibleCrossing(), IsRailDepotTile(), IsRailStationTile(), AIRail::IsRailTile(), IsRailWaypointTile(), AIRoad::IsRoadDepotTile(), IsRoadStop(), IsRoadStopTile(), AIRoad::IsRoadTile(), AITile::IsRockTile(), AITile::IsRoughTile(), IsSafeWaitingPosition(), AITile::IsSnowTile(), AITile::IsStationTile(), IsStatue(), IsStatueTile(), IsTransmitterTile(), IsTunnel(), IsTunnelTile(), IsValidTile(), IsValidTileForWaypoint(), IsWaitingPositionFree(), AIMarine::IsWaterDepotTile(), IsWateredTile(), AITile::IsWaterTile(), LoadUnloadVehicle(), MakeHouseTile(), MakeSingleHouseBigger(), MarkTileDirtyIfCanalOrRiver(), MayHaveBridgeAbove(), MoveWaypointsToBaseStations(), ProcessOrders(), RemoveRoad(), AIRoad::RemoveRoadDepot(), AIRoad::RemoveRoadStation(), ResetHouseAge(), ResetIndustryConstructionStage(), RoadFindPathToDest(), StationRect::ScanForStationTiles(), SearchLumberMillTrees(), SearchNearbyHouseClass(), SearchNearbyHouseGRFID(), SearchNearbyHouseID(), SetClearCounter(), SetClearGroundDensity(), SetCompanyHQSection(), SetCompanyHQSize(), SetDefaultRailGui(), SetFenceSE(), SetFenceSW(), SetHouseAnimationFrame(), SetHouseCompleted(), SetHouseProcessingTime(), SetHouseRandomBits(), SetHouseTriggers(), SetHouseType(), SetIndustryAnimationLoop(), SetIndustryAnimationState(), SetIndustryCompleted(), SetIndustryConstructionCounter(), SetIndustryConstructionStage(), SetIndustryGfx(), SetIndustryRandomBits(), SetIndustryTriggers(), SetStationAnimationFrame(), SetStationGfx(), SetTileOwner(), SetTownIndex(), SetTreeCounter(), SetTreeGroundDensity(), SetTreeGrowth(), SetTunnelBridgeReservation(), SetTunnelBridgeSnowOrDesert(), TileLoop_Water(), TownCanBePlacedHere(), TrainCanLeaveTile(), TryPathReserve(), UpdateAllBlockSignals(), UpdateHousesAndTowns(), and UpdateNearestTownForRoadTiles().
static bool IsValidTile | ( | TileIndex | tile | ) | [inline, static] |
Checks if a tile is valid.
tile | The tile to check |
Definition at line 124 of file tile_map.h.
References IsTileType(), MapSize(), and MP_VOID.
Referenced by AIRoad::_BuildRoadInternal(), AIRoad::_BuildRoadStationInternal(), AITileList::AddRectangle(), AITileList::AddTile(), AITileList_IndustryAccepting::AITileList_IndustryAccepting(), AITileList_IndustryProducing::AITileList_IndustryProducing(), AIRoad::AreRoadTilesConnected(), AIMarine::AreWaterTilesConnected(), AIAirport::BuildAirport(), AIBridge::BuildBridge(), AIMarine::BuildBuoy(), AIMarine::BuildCanal(), AICompany::BuildCompanyHQ(), AIMarine::BuildDock(), AIMarine::BuildLock(), AIRail::BuildNewGRFRailStation(), AIRail::BuildRail(), AIRail::BuildRailDepot(), AIRail::BuildRailStation(), AIRail::BuildRailTrack(), AIRail::BuildRailWaypoint(), AIRoad::BuildRoadDepot(), AISign::BuildSign(), AITunnel::BuildTunnel(), AIMarine::BuildWaterDepot(), AIRoad::CanBuildConnectedRoadPartsHere(), CleanUpRoadBits(), CmdBuildTunnel(), AIRail::ConvertRailType(), AITile::DemolishTile(), Disaster_CoalMine_Init(), DisasterTick_Big_Ufo(), DisasterTick_Submarine(), DisasterTick_Zeppeliner(), DoCommand(), DoCommandP(), DrawTileSelectionRect(), AITile::GetCargoAcceptance(), AITile::GetCargoProduction(), AITile::GetClosestTown(), AITile::GetCornerHeight(), AIAirport::GetHangarOfAirport(), AITile::GetMaxHeight(), AITile::GetMinHeight(), AIAirport::GetNearestTown(), AIRoad::GetNeighbourRoadCount(), AIAirport::GetNoiseLevelIncrease(), AIAirport::GetNumHangars(), GetOrderTypeByTile(), AIBridge::GetOtherBridgeEnd(), AITunnel::GetOtherTunnelEnd(), AITile::GetOwner(), AITile::GetSlope(), AIStation::GetStationID(), GetTileOwner(), GrowTownInTile(), AITile::HasTransportType(), AITile::HasTreeOnTile(), AIAirport::IsAirportTile(), AIBridge::IsBridgeTile(), AITile::IsBuildable(), AIMarine::IsBuoyTile(), AIMarine::IsCanalTile(), AITile::IsCoastTile(), AITile::IsDesertTile(), AIMarine::IsDockTile(), AIRoad::IsDriveThroughRoadStationTile(), AITile::IsFarmTile(), AIAirport::IsHangarTile(), AIRail::IsLevelCrossingTile(), AIMarine::IsLockTile(), IsNeighborRoadTile(), AIRail::IsRailDepotTile(), AIRail::IsRailStationTile(), AIRail::IsRailTile(), AIRail::IsRailWaypointTile(), AIRoad::IsRoadDepotTile(), AIRoad::IsRoadStationTile(), AIRoad::IsRoadTile(), AITile::IsRockTile(), AITile::IsRoughTile(), AITile::IsSnowTile(), AITile::IsStationTile(), IsTunnelInWayDir(), AITunnel::IsTunnelTile(), AIMap::IsValidTile(), AIMarine::IsWaterDepotTile(), AITile::IsWaterTile(), NPFHash(), AITile::PlantTree(), AITile::PlantTreeRectangle(), AIAirport::RemoveAirport(), AIMarine::RemoveBuoy(), AIMarine::RemoveCanal(), AIMarine::RemoveDock(), AIMarine::RemoveLock(), AIRail::RemoveRail(), AIRail::RemoveRailStationTileRectangle(), AIRail::RemoveRailTrack(), AIRail::RemoveRailWaypointTileRectangle(), AITileList::RemoveRectangle(), AIRoad::RemoveRoad(), AIRoad::RemoveRoadDepot(), AIRoad::RemoveRoadFull(), AIRoad::RemoveRoadStation(), AITileList::RemoveTile(), AIMarine::RemoveWaterDepot(), and SetTileOwner().
static void SetTileHeight | ( | TileIndex | tile, | |
uint | height | |||
) | [inline, static] |
Sets the height of a tile.
This function sets the height of the northern corner of a tile.
tile | The tile to change the height | |
height | The new height value of the tile |
heigth <= MAX_TILE_HEIGHT
Definition at line 49 of file tile_map.h.
References _m, MapSize(), MAX_TILE_HEIGHT, and SB().
Referenced by CmdTerraformLand(), FixSlopes(), FlatEmptyWorld(), GrayscaleToMapHeights(), MakeVoid(), and TgenSetTileHeight().
Sets the owner of a tile.
This function sets the owner status of a tile. Note that you cannot set a owner for tiles of type MP_HOUSE, MP_VOID and MP_INDUSTRY.
tile | The tile to change the owner status. | |
owner | The new owner. |
The type of the tile must not be MP_HOUSE and MP_INDUSTRY
Definition at line 161 of file tile_map.h.
References _m, IsTileType(), IsValidTile(), Tile::m1, MP_HOUSE, and MP_INDUSTRY.
Referenced by FixOwnerOfRailTrack(), MakeBridgeRamp(), MakeClear(), MakeField(), MakeRailTunnel(), MakeRoadTunnel(), MakeTree(), MakeUnmovable(), MakeWater(), and RemoveRoad().
Set the type of a tile.
This functions sets the type of a tile. If the type MP_VOID is selected the tile must be at the south-west or south-east edges of the map and vice versa.
tile | The tile to save the new type | |
type | The type to save |
type MP_VOID <=> tile is on the south-east or south-west edge.
Definition at line 94 of file tile_map.h.
References _m, _settings_game, GameSettings::construction, ConstructionSettings::freeform_edges, MapMaxX(), MapMaxY(), MapSize(), MP_VOID, SB(), TileX(), and TileY().
Referenced by MakeBridgeRamp(), MakeClear(), MakeField(), MakeHouseTile(), MakeIndustry(), MakeRailTunnel(), MakeRoadTunnel(), MakeTree(), MakeUnmovable(), MakeVoid(), and MakeWater().
static void SetTropicZone | ( | TileIndex | tile, | |
TropicZone | type | |||
) | [inline, static] |
Set the tropic zone.
tile | the tile to set the zone of | |
type | the new type |
Definition at line 188 of file tile_map.h.
References _m, MapSize(), and SB().
Referenced by CmdPlantTree(), and GenerateDesertArea().
static uint TileHeight | ( | TileIndex | tile | ) | [inline, static] |
Returns the height of a tile.
This function returns the height of the northern corner of a tile. This is saved in the global map-array. It does not take affect by any slope-data of the tile.
tile | The tile to get the height from |
Definition at line 33 of file tile_map.h.
References _m, GB(), and MapSize().
Referenced by CalcHeightdiff(), CheckIfCanLevelIndustryPlatform(), CmdBuildCanal(), CmdLevelLand(), CmdTerraformLand(), CommonRaiseLowerBigLand(), FixSlopes(), GetSmallMapContoursPixels(), GetSmallMapIndustriesPixels(), GetTileMaxZ(), GetTileSlope(), GetTileZ(), TerraformGetHeightOfTile(), and TilePixelHeight().
static uint TilePixelHeight | ( | TileIndex | tile | ) | [inline, static] |
Returns the height of a tile in pixels.
This function returns the height of the northern corner of a tile in pixels.
tile | The tile to get the height |
Definition at line 64 of file tile_map.h.
References TILE_HEIGHT, and TileHeight().
Referenced by UpdateTownGrowRate().