Simutrans-Squirrel-API
Static Public Member Functions | List of all members
dir Class Reference

Static Public Member Functions

static bool is_single (dir d)
 
static bool is_twoway (dir d)
 
static bool is_threeway (dir d)
 
static bool is_curve (dir d)
 
static bool is_straight (dir d)
 
static dir double (dir d)
 
static dir backward (dir d)
 
static slope to_slope (dir d)
 
static coord to_coord ()
 

Static Public Attributes

Named directions.
static const dir none
 
static const dir north
 
static const dir east
 
static const dir northeast
 
static const dir south
 
static const dir northsouth
 
static const dir southeast
 
static const dir northsoutheast
 
static const dir west
 
static const dir northwest
 
static const dir eastwest
 
static const dir northeastwest
 
static const dir southwest
 
static const dir northsouthwest
 
static const dir southeastwest
 
static const dir all
 

Detailed Description

Class holding static methods to work with directions. Directions are just bit-encoded integers.

Definition at line 110 of file api_simple.cc.

Member Function Documentation

static dir dir::backward ( dir  d)
static
Parameters
ddirection to test
Returns
backward direction, e.g. w -> e, n+w -> s+e, n+w+s -> e.
static dir dir::double ( dir  d)
static
Parameters
ddirection
Returns
complements direction to complete straight, i.e. w -> w+e, but n+w -> 0.
static bool dir::is_curve ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is curve, e.g. n+e, s+w.
static bool dir::is_single ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is single direction, i.e. just one of n/s/e/w
static bool dir::is_straight ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is straight and has no curves in it, e.g. n+w, w.
static bool dir::is_threeway ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is triple direction, e.g. n+s+e.
static bool dir::is_twoway ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is double direction, e.g. n+e, n+s.
static coord dir::to_coord ( )
static

Helper function to convert direction vector to dir type.

static slope dir::to_slope ( dir  d)
static

Converts direction to slope: direction goes upward on slope.

Parameters
ddirection

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