Simutrans-Squirrel-API  r11919
Classes | Functions
api_scenario.cc File Reference

Go to the source code of this file.

Classes

class  rules
 
class  debug
 

Functions

string translate (string text)
 
string double_to_string (float value, integer decimals)
 
string integer_to_string (integer value)
 
string money_to_string (integer value)
 
string coord_to_string (coord c)
 
string coord3d_to_string (coord3d c)
 
string get_month_name (integer month)
 
string difftick_to_string (integer difftick_to_string_intern)
 
void get_tool_key (any_x tool_id)
 
string load_language_file (string file)
 

Detailed Description

exports scenario related functions.

Definition in file api_scenario.cc.

Function Documentation

◆ coord3d_to_string()

string coord3d_to_string ( coord3d  c)

Print coordinates, does automatic rotation.

Parameters
ccoordinate
Returns
a nice string

◆ coord_to_string()

string coord_to_string ( coord  c)

Print coordinates, does automatic rotation.

Parameters
ccoordinate
Returns
a nice string

◆ difftick_to_string()

string difftick_to_string ( integer  difftick_to_string_intern)

Translates difference of ticks to string which could even have months in it.

Parameters
difftick_to_string_internticks in simutrans units
Returns
time difference using the current local setting

◆ double_to_string()

string double_to_string ( float  value,
integer  decimals 
)

Pretty-print floating point numbers, use language specific separator for powers of thousands.

Parameters
valuenumber to print
decimalshow many decimals should be printed
Returns
a nice string

◆ get_month_name()

string get_month_name ( integer  month)

Get name of given month.

Parameters
monthnumber between 0 (january) and 11 (december)
Returns
month name in language of server

◆ get_tool_key()

void get_tool_key ( any_x  tool_id)

Gets the tool_key (shortcut key) associated with a general tool by its ID. The ID corresponds to the index used in menuconf.tab (e.g. 0 = query tool, 1 = remover, etc.). Returns the hotkey as a string (e.g. "r", "M", "COMMA, "^s, "+F10", "#1234") without quotation marks or an empty string if there is no hotkey or invalid ID.

Parameters
tool_idthe numeric ID of the general tool (as defined in menuconf.tab)
Returns
a string representing the hotkey, or empty if none or invalid

◆ integer_to_string()

string integer_to_string ( integer  value)

Pretty-print integers, use language specific separator for powers of thousands.

Parameters
valuenumber to print
Returns
a nice string

◆ money_to_string()

string money_to_string ( integer  value)

Pretty-print money values, use language specific separator for powers of thousands.

Parameters
valuenumber to print
Returns
a nice string with trailing dollar-sign

◆ translate()

string translate ( string  text)

Helper method to translate strings, needed to identify the correct overloaded function

Parameters
textstring to translate
Returns
translation of given string