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

Public Member Functions

 tile_x (integer x, integer y, integer z)
 
bool is_valid ()
 
map_object_x find_object (map_objects)
 
string remove_object (player_x pl, map_objects type)
 
halt_x get_halt ()
 
bool is_water ()
 
bool is_bridge ()
 
bool is_tunnel ()
 
bool is_empty ()
 
bool is_ground ()
 
slope get_slope ()
 
string get_text ()
 
bool has_way (way_types wt)
 
bool has_ways ()
 
bool has_two_ways ()
 
dir get_way_dirs (waytypes wt)
 
dir get_way_dirs_masked (waytypes wt)
 
dir get_canal_ribi ()
 
tile_x get_neighbour (way_types wt, dir d)
 
string can_remove_all_objects (player_x pl)
 
tile_object_list_x get_objects ()
 
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.
 

Additional Inherited Members

- Private Member Functions inherited from coord3d
 coord (int x, int y, int z)
 
coord3d operator+ (coord3d other)
 
coord3d operator- (coord other)
 
coord3d operator+ (coord3d other)
 
coord3d operator- (coord other)
 
coord3d operator- ()
 
coord3d operator* (integer fac)
 
coord3d operator/ (integer fac)
 
string _tostring ()
 
string href (string text)
 
- Private Member Functions inherited from coord
 coord (int x, int y)
 
coord operator+ (coord other)
 
coord operator- (coord other)
 
coord operator- ()
 
coord operator* (integer fac)
 
coord operator/ (integer fac)
 
string _tostring ()
 
string href (string text)
 
dir to_dir ()
 
- Private Attributes inherited from coord3d
integer x
 x-coordinate
 
integer y
 y-coordinate
 
integer z
 z-coordinate - height
 
- Private 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 ( 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

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
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
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
halt_x tile_x::get_halt ( )

Access halt at this tile.

Returns
halt_x instance or null/false if no halt is present
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
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()) {
...
}
slope tile_x::get_slope ( )

Returns encoded slope of tile, zero means flat tile.

Returns
slope
string tile_x::get_text ( )

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

Returns
text
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
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
bool tile_x::has_two_ways ( )

Queries ways on the tile.

Returns
true if there is are two ways on the tile
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.
bool tile_x::has_ways ( )

Queries ways on the tile.

Returns
true if there is at least one way on the tile
bool tile_x::is_bridge ( )

Queries tile type.

Returns
true if tile is an bridge tile (including bridge starts)
bool tile_x::is_empty ( )

Queries tile type.

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

Queries tile type.

Returns
true if tile on ground (not bridge/elevated, not tunnel)
bool tile_x::is_tunnel ( )

Queries tile type.

Returns
true if tile is an tunnel tile (including tunnel mouths)
bool tile_x::is_valid ( )
Returns
if object is still valid.
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: