Simutrans-Squirrel-API
Public Member Functions | List of all members
tile_x Class Reference
Inheritance diagram for tile_x:
coord3d extend_get ingame_object coord

Public Member Functions

string can_remove_all_objects (player_x pl)
 
map_object_x find_object (map_objects)
 
dir get_canal_ribi ()
 
array< convoy_xget_convoys ()
 
depot_x get_depot ()
 
halt_x get_halt ()
 
tile_x get_neighbour (way_types wt, dir d)
 
tile_object_list_x get_objects ()
 
slope get_slope ()
 
string get_text ()
 
way_x get_way (way_types wt)
 
dir get_way_dirs (waytypes wt)
 
dir get_way_dirs_masked (waytypes wt)
 
bool has_two_ways ()
 
bool has_way (way_types wt)
 
bool has_ways ()
 
bool is_bridge ()
 
bool is_empty ()
 
bool is_ground ()
 
bool is_tunnel ()
 
bool is_valid ()
 
bool is_water ()
 
string remove_object (player_x pl, map_objects type)
 
 tile_x (integer x, integer y, integer z)
 
Functions to mark tiles.

Methods to mark, unmark, and check mark-status of tiles. Mark flag can be reset by cursor movement.

Warning
In network games, they only work on server.
bool is_marked ()
 Check if tile is marked.
 
void unmark ()
 Unmark tile.
 
void mark ()
 Mark tile.
 
- Public Member Functions inherited from coord3d
string _tostring ()
 
 coord (int x, int y, int z)
 
string href (string text)
 
coord3d operator* (integer fac)
 
coord3d operator+ (coord3d other)
 
coord3d operator+ (coord3d other)
 
coord3d operator- (coord other)
 
coord3d operator- (coord other)
 
coord3d operator- ()
 
coord3d operator/ (integer fac)
 
- Public Member Functions inherited from coord
string _tostring ()
 
 coord (int x, int y)
 
string href (string text)
 
coord operator* (integer fac)
 
coord operator+ (coord other)
 
coord operator- (coord other)
 
coord operator- ()
 
coord operator/ (integer fac)
 
dir to_dir ()
 

Additional Inherited Members

- Public Attributes inherited from coord3d
integer x
 x-coordinate
 
integer y
 y-coordinate
 
integer z
 z-coordinate - height
 
- Public Attributes inherited from coord
integer x
 x-coordinate
 
integer y
 y-coordinate
 

Detailed Description

Class to access tiles on the map.

There is the possibility to iterate through all objects on the tile:

local tile = tile_x( ... )
foreach(thing in tile) {
... // thing is an instance of the map_object_x (or a derived) class
}

Definition at line 13 of file api_tiles.cc.

Constructor & Destructor Documentation

◆ tile_x()

tile_x::tile_x ( integer  x,
integer  y,
integer  z 
)

Constructor. Returns tile at particular 3d coordinate. If not tile is found, it returns the ground tile. Raises error, if (x, y) coordinates are out-of-range.

Parameters
xx-coordinate
yy-coordinate
zz-coordinate

Member Function Documentation

◆ can_remove_all_objects()

string tile_x::can_remove_all_objects ( player_x  pl)

Checks whether player can delete all objects on the tile.

Parameters
plplayer
Returns
error message or null if player can delete everything

◆ find_object()

map_object_x tile_x::find_object ( map_objects  )

Search for a given object type on the tile.

Returns
some instance or null if not found

◆ get_canal_ribi()

dir tile_x::get_canal_ribi ( )

Return directions in which canals branch off from water tiles. Used for jps pathfinding on water tiles.

Returns
direction

◆ get_convoys()

array<convoy_x> tile_x::get_convoys ( )
Returns
convoy list by tile

◆ get_depot()

depot_x tile_x::get_depot ( )

Returns depot_x object on this tile if any depot is present.

Returns
depot object or null

◆ get_halt()

halt_x tile_x::get_halt ( )

Access halt at this tile.

Returns
halt_x instance or null/false if no halt is present

◆ get_neighbour()

tile_x tile_x::get_neighbour ( way_types  wt,
dir  d 
)

Returns neighbour if one follows way in the given direction.

Parameters
wtwaytype, if equal to wt_all then ways are ignored.
ddirection
Returns
neighbour tile or null

◆ get_objects()

tile_object_list_x tile_x::get_objects ( )

List to iterate through all objects on this tile.

t= tile_x(47,11)
foreach(obj in t.get_objects()) {
...
}

◆ get_slope()

slope tile_x::get_slope ( )

Returns encoded slope of tile, zero means flat tile.

Returns
slope

◆ get_text()

string tile_x::get_text ( )

Returns text of a sign on this tile (station sign, city name, label).

Returns
text

◆ get_way()

way_x tile_x::get_way ( way_types  wt)

Returns way_x object on this tile of way type wt if present

Parameters
wtwaytype
Returns
way object or null

◆ get_way_dirs()

dir tile_x::get_way_dirs ( waytypes  wt)

Return directions in which ways on this tile go. One-way signs are ignored here.

Parameters
wtwaytype
Returns
direction

◆ get_way_dirs_masked()

dir tile_x::get_way_dirs_masked ( waytypes  wt)

Return directions in which ways on this tile go. Some signs restrict available directions.

Parameters
wtwaytype
Returns
direction

◆ has_two_ways()

bool tile_x::has_two_ways ( )

Queries ways on the tile.

Returns
true if there is are two ways on the tile

◆ has_way()

bool tile_x::has_way ( way_types  wt)

Queries ways on the tile.

Parameters
wtwaytype
Returns
true if there is a way with the given waytype on the tile.

◆ has_ways()

bool tile_x::has_ways ( )

Queries ways on the tile.

Returns
true if there is at least one way on the tile

◆ is_bridge()

bool tile_x::is_bridge ( )

Queries tile type.

Returns
true if tile is an bridge tile (including bridge starts)

◆ is_empty()

bool tile_x::is_empty ( )

Queries tile type.

Returns
true if tile is empty (no ways, buildings, powerlines, halts, not water tile)

◆ is_ground()

bool tile_x::is_ground ( )

Queries tile type.

Returns
true if tile on ground (not bridge/elevated, not tunnel)

◆ is_tunnel()

bool tile_x::is_tunnel ( )

Queries tile type.

Returns
true if tile is an tunnel tile (including tunnel mouths)

◆ is_valid()

bool tile_x::is_valid ( )
Returns
if object is still valid.

◆ is_water()

bool tile_x::is_water ( )

Queries tile type.

Returns
true if tile is an ocean tile

The documentation for this class was generated from the following file: