|
OpenTTD Source 20260218-master-g2123fca5ea
|
Generic 'commands' that can be performed on all tiles. More...
#include "core/enum_type.hpp"#include "core/geometry_type.hpp"#include "command_type.h"#include "vehicle_type.h"#include "cargo_type.h"#include "track_type.h"#include "tile_map.h"#include "timer/timer_game_calendar.h"Go to the source code of this file.
Data Structures | |
| struct | TileInfo |
| Tile information, used while rendering the tile. More... | |
| struct | TileDesc |
| Tile description for the 'land area information' tool. More... | |
| struct | TileTypeProcs |
| Set of callback functions for performing tile operations of a given tile type. More... | |
Typedefs | |
| using | VehicleEnterTileStates = EnumBitSet<VehicleEnterTileState, uint8_t> |
| typedef void | DrawTileProc(TileInfo *ti) |
| Tile callback function signature for drawing a tile and its contents to the screen. | |
| typedef int | GetSlopeZProc(TileIndex tile, uint x, uint y, bool ground_vehicle) |
Tile callback function signature for obtaining the world Z coordinate of a given point of a tile. | |
| typedef CommandCost | ClearTileProc(TileIndex tile, DoCommandFlags flags) |
| typedef void | AddAcceptedCargoProc(TileIndex tile, CargoArray &acceptance, CargoTypes &always_accepted) |
| Tile callback function signature for obtaining cargo acceptance of a tile. | |
| typedef void | GetTileDescProc(TileIndex tile, TileDesc &td) |
| Tile callback function signature for obtaining a tile description. | |
| typedef TrackStatus | GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) |
| Tile callback function signature for getting the possible tracks that can be taken on a given tile by a given transport. | |
| typedef void | AddProducedCargoProc(TileIndex tile, CargoArray &produced) |
| Tile callback function signature for obtaining the produced cargo of a tile. | |
| typedef bool | ClickTileProc(TileIndex tile) |
| typedef void | AnimateTileProc(TileIndex tile) |
| typedef void | TileLoopProc(TileIndex tile) |
| typedef void | ChangeTileOwnerProc(TileIndex tile, Owner old_owner, Owner new_owner) |
| typedef VehicleEnterTileStates | VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y) |
| typedef Foundation | GetFoundationProc(TileIndex tile, Slope tileh) |
| typedef CommandCost | TerraformTileProc(TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new) |
| Tile callback function signature of the terraforming callback. | |
| using | CheckBuildAboveProc = CommandCost(TileIndex tile, DoCommandFlags flags, Axis axis, int height) |
| Tile callback function signature to test if a bridge can be built above a tile. | |
Enumerations | |
| enum class | VehicleEnterTileState : uint8_t { EnteredStation , EnteredWormhole , CannotEnter } |
| Flags to describe several special states upon entering a tile. More... | |
Functions | |
| TrackStatus | GetTileTrackStatus (TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side=INVALID_DIAGDIR) |
| Returns information about trackdirs and signal states. | |
| VehicleEnterTileStates | VehicleEnterTile (Vehicle *v, TileIndex tile, int x, int y) |
| Call the tile callback function for a vehicle entering a tile. | |
| void | ChangeTileOwner (TileIndex tile, Owner old_owner, Owner new_owner) |
| Change the owner of a tile. | |
| void | GetTileDesc (TileIndex tile, TileDesc &td) |
| void | AddAcceptedCargo (TileIndex tile, CargoArray &acceptance, CargoTypes &always_accepted) |
| Obtain cargo acceptance of a tile. | |
| void | AddProducedCargo (TileIndex tile, CargoArray &produced) |
| Obtain the produced cargo of a tile. | |
| bool | MayAnimateTile (TileIndex tile) |
| Test if a tile may be animated. | |
| void | AnimateTile (TileIndex tile) |
| bool | ClickTile (TileIndex tile) |
Variables | |
| const EnumClassIndexContainer< std::array< const TileTypeProcs *, to_underlying(TileType::MaxSize)>, TileType > | _tile_type_procs |
| Tile callback functions for each type of tile. | |
Generic 'commands' that can be performed on all tiles.
Definition in file tile_cmd.h.
| typedef void AddAcceptedCargoProc(TileIndex tile, CargoArray &acceptance, CargoTypes &always_accepted) |
Tile callback function signature for obtaining cargo acceptance of a tile.
| tile | Tile queried for its accepted cargo |
| acceptance | Storage destination of the cargo acceptance in 1/8 |
| always_accepted | Bitmask of always accepted cargo types |
Definition at line 85 of file tile_cmd.h.
| typedef void AddProducedCargoProc(TileIndex tile, CargoArray &produced) |
Tile callback function signature for obtaining the produced cargo of a tile.
| tile | Tile being queried |
| produced | Destination array for produced cargo |
Definition at line 114 of file tile_cmd.h.
| typedef void AnimateTileProc(TileIndex tile) |
Definition at line 116 of file tile_cmd.h.
| typedef void ChangeTileOwnerProc(TileIndex tile, Owner old_owner, Owner new_owner) |
Definition at line 118 of file tile_cmd.h.
| using CheckBuildAboveProc = CommandCost(TileIndex tile, DoCommandFlags flags, Axis axis, int height) |
Tile callback function signature to test if a bridge can be built above a tile.
| tile | The involved tile. |
| flags | Command flags passed to the build command. |
| axis | Axis of bridge being built. |
| height | Absolute height of bridge platform. |
Definition at line 148 of file tile_cmd.h.
| typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlags flags) |
Definition at line 77 of file tile_cmd.h.
| typedef bool ClickTileProc(TileIndex tile) |
Definition at line 115 of file tile_cmd.h.
| typedef void DrawTileProc(TileInfo *ti) |
Tile callback function signature for drawing a tile and its contents to the screen.
| ti | Information about the tile to draw |
Definition at line 63 of file tile_cmd.h.
| typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh) |
Definition at line 121 of file tile_cmd.h.
| typedef int GetSlopeZProc(TileIndex tile, uint x, uint y, bool ground_vehicle) |
Tile callback function signature for obtaining the world Z coordinate of a given point of a tile.
| tile | The queries tile for the Z coordinate. |
| x | World X coordinate in tile "units". |
| y | World Y coordinate in tile "units". |
| ground_vehicle | Whether to get the Z coordinate of the ground vehicle, or the ground. |
Definition at line 76 of file tile_cmd.h.
Tile callback function signature for obtaining a tile description.
| tile | Tile being queried |
| td | Storage pointer for returned tile description |
Definition at line 92 of file tile_cmd.h.
| typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) |
Tile callback function signature for getting the possible tracks that can be taken on a given tile by a given transport.
The return value contains the existing trackdirs and signal states.
see track_func.h for usage of TrackStatus.
| tile | the tile to get the track status from |
| mode | the mode of transportation |
| sub_mode | used to differentiate between different kinds within the mode |
Definition at line 107 of file tile_cmd.h.
| typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new) |
Tile callback function signature of the terraforming callback.
The function is called when a tile is affected by a terraforming operation. It has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype. With DoCommandFlag::Execute in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
| tile | The involved tile. |
| flags | Command flags passed to the terraform command (DoCommandFlag::Execute, DoCommandFlag::QueryCost, etc.). |
| z_new | TileZ after terraforming. |
| tileh_new | Slope after terraforming. |
Definition at line 138 of file tile_cmd.h.
| typedef void TileLoopProc(TileIndex tile) |
Definition at line 117 of file tile_cmd.h.
Definition at line 120 of file tile_cmd.h.
| using VehicleEnterTileStates = EnumBitSet<VehicleEnterTileState, uint8_t> |
Definition at line 29 of file tile_cmd.h.
|
strong |
Flags to describe several special states upon entering a tile.
Definition at line 23 of file tile_cmd.h.
|
inline |
Obtain cargo acceptance of a tile.
| tile | Tile queried for its accepted cargo. |
| acceptance | Storage destination of the cargo acceptance in 1/8. |
| always_accepted | Bitmask of always accepted cargo types. |
Definition at line 185 of file tile_cmd.h.
References _tile_type_procs, and GetTileType().
Referenced by FindSubsidyCargoDestination(), GetAcceptanceAroundStation(), GetAcceptanceAroundTiles(), and LandInfoWindow::OnInit().
|
inline |
Obtain the produced cargo of a tile.
| tile | Tile being queried. |
| produced | Destination array for produced cargo. |
Definition at line 197 of file tile_cmd.h.
References _tile_type_procs, and GetTileType().
Referenced by FindSubsidyTownCargoRoute(), and GetProductionAroundTiles().
|
inline |
Definition at line 214 of file tile_cmd.h.
| void ChangeTileOwner | ( | TileIndex | tile, |
| Owner | old_owner, | ||
| Owner | new_owner ) |
Change the owner of a tile.
| tile | Tile to change |
| old_owner | Current owner of the tile |
| new_owner | New owner of the tile |
Definition at line 577 of file landscape.cpp.
References _tile_type_procs, and GetTileType().
Referenced by AfterLoadGame(), and ChangeOwnershipOfCompanyItems().
|
inline |
Definition at line 221 of file tile_cmd.h.
Definition at line 582 of file landscape.cpp.
| TrackStatus GetTileTrackStatus | ( | TileIndex | tile, |
| TransportType | mode, | ||
| uint | sub_mode, | ||
| DiagDirection | side ) |
Returns information about trackdirs and signal states.
If there is any trackbit at 'side', return all trackdirbits. For TRANSPORT_ROAD, return no trackbits if there is no roadbit (of given subtype) at given side.
| tile | tile to get info about |
| mode | transport type |
| sub_mode | for TRANSPORT_ROAD, roadtypes to check |
| side | side we are entering from, INVALID_DIAGDIR to return all trackbits |
Definition at line 566 of file landscape.cpp.
References _tile_type_procs, and GetTileType().
Referenced by AfterLoadGame(), CheckRoadBlockedForOvertaking(), CYapfFollowShipT< Types >::CheckShipReverse(), DisasterTick_Submarine(), FixOwnerOfRailTrack(), CFollowTrackT< TRANSPORT_WATER, Ship, true >::Follow(), GenericPlaceSignals(), GetTrackdirBitsForRoad(), IsPossibleDockingTile(), MaskWireBits(), CFollowTrackT< TRANSPORT_WATER, Ship, true >::QueryNewTileTrackStatus(), RoadFindPathToDest(), RoadVehicle::TileMayHaveSlopedTrack(), TrainCheckIfLineEnds(), TrainController(), TryPathReserve(), TryReserveRailTrack(), UnreserveRailTrack(), and UpdateSignalsInBuffer().
|
inline |
Test if a tile may be animated.
| tile | Tile to test. |
Definition at line 209 of file tile_cmd.h.
References _tile_type_procs, and GetTileType().
Referenced by AfterLoadGame().
Call the tile callback function for a vehicle entering a tile.
Definition at line 1831 of file vehicle.cpp.
References _tile_type_procs, and GetTileType().
Referenced by TrainController(), and UpdateStatusAfterSwap().
|
extern |
Tile callback functions for each type of tile.
Definition at line 69 of file landscape.cpp.
Referenced by AddAcceptedCargo(), AddProducedCargo(), ChangeTileOwner(), CmdLandscapeClear(), CmdTerraformLand(), GetFoundationSlope(), GetSlopePixelZ(), GetSlopePixelZOutsideMap(), GetTileTrackStatus(), MayAnimateTile(), RunTileLoop(), VehicleEnterTile(), and ViewportAddLandscape().