Simutrans-Squirrel-API
api_simple.cc
Go to the documentation of this file.
1 
9 class time_x {
10 public:
11  integer raw;
12  integer year;
13  integer month;
14 };
19 class time_ticks_x : public time_x {
20 public:
21  integer ticks;
22  integer ticks_per_month;
23  integer next_month_ticks;
24 };
32 class coord {
33 public:
35  integer x;
37  integer y;
38  // operators are defined in script_base.nut
39  coord(int x, int y);
40  coord operator + (coord other);
41  coord operator - (coord other);
42  coord operator - ();
43  coord operator * (integer fac);
44  coord operator / (integer fac);
50  string _tostring();
57  string href(string text);
61  dir to_dir();
62 };
70 class coord3d : public coord {
71 public:
73  integer x;
75  integer y;
77  integer z;
78  // operators are defined in script_base.nut
79  coord(int x, int y, int z);
80  coord3d operator + (coord3d other);
81  coord3d operator - (coord other);
82  coord3d operator + (coord3d other);
83  coord3d operator - (coord other);
84  coord3d operator - ();
85  coord3d operator * (integer fac);
86  coord3d operator / (integer fac);
92  string _tostring();
99  string href(string text);
100 };
110 class dir {
111 public:
114  static const dir none;
115  static const dir north;
116  static const dir east;
117  static const dir northeast;
118  static const dir south;
119  static const dir northsouth;
120  static const dir southeast;
121  static const dir northsoutheast;
122  static const dir west;
123  static const dir northwest;
124  static const dir eastwest;
125  static const dir northeastwest;
126  static const dir southwest;
127  static const dir northsouthwest;
128  static const dir southeastwest;
129  static const dir all;
131 
135  static bool is_single(dir d);
140  static bool is_twoway(dir d);
145  static bool is_threeway(dir d);
150  static bool is_curve(dir d);
155  static bool is_straight(dir d);
160  static dir double(dir d);
165  static dir backward(dir d);
170  static slope to_slope(dir d);
174  static coord to_coord();
175 };
180 class slope {
181 public:
184  static const slope flat;
185  static const slope north;
186  static const slope west;
187  static const slope east;
188  static const slope south;
189  static const slope northwest;
190  static const slope northeast;
191  static const slope southeast;
192  static const slope southwest;
193  static const slope raised;
194  static const slope all_up_slope = 82;
195  static const slope all_down_slope = 83;
196 
197 
202  static dir to_dir(slope s);
203 };
212 {
216 bool is_valid();
217 }
integer y
y-coordinate
Definition: api_simple.cc:75
integer raw
raw integer value of date
Definition: api_simple.cc:11
integer ticks
current time in ticks
Definition: api_simple.cc:21
integer month
month in 0..11
Definition: api_simple.cc:13
static const slope east
East slope.
Definition: api_simple.cc:187
static const slope northwest
NW corner.
Definition: api_simple.cc:189
integer next_month_ticks
new month will start at this time
Definition: api_simple.cc:23
static const slope southwest
SW corner.
Definition: api_simple.cc:192
static const slope north
North slope.
Definition: api_simple.cc:185
static const slope raised
special meaning: used as slope of bridgeheads
Definition: api_simple.cc:193
integer x
x-coordinate
Definition: api_simple.cc:35
static const slope west
West slope.
Definition: api_simple.cc:186
static const slope south
South slope.
Definition: api_simple.cc:188
integer y
y-coordinate
Definition: api_simple.cc:37
dir coord_to_dir(coord dir)
integer x
x-coordinate
Definition: api_simple.cc:73
static const slope southeast
SE corner.
Definition: api_simple.cc:191
integer z
z-coordinate - height
Definition: api_simple.cc:77
integer ticks_per_month
length of one in-game month in ticks
Definition: api_simple.cc:22
integer year
year
Definition: api_simple.cc:12
static const slope northeast
NE corner.
Definition: api_simple.cc:190