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

Static Public Member Functions

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

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

◆ backward()

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.

◆ double()

static dir dir::double ( dir  d)
static
Parameters
ddirection
Returns
complements direction to complete straight, i.e. w -> w+e, but n+w -> 0.

◆ is_curve()

static bool dir::is_curve ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is curve, e.g. n+e, s+w.

◆ is_single()

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

◆ is_straight()

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+s, w.

◆ is_threeway()

static bool dir::is_threeway ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is triple direction, e.g. n+s+e or n+s+e+w.

◆ is_twoway()

static bool dir::is_twoway ( dir  d)
static
Parameters
ddirection to test
Returns
whether direction is double direction, e.g. n+e, n+s.

◆ to_coord()

static coord dir::to_coord ( )
static

Helper function to convert direction vector to dir type.

◆ to_slope()

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: