(svn r27763) -Update from Eints:
[openttd.git] / bin / ai / regression / tst_regression / main.nut
blobf575f53fffab0d0e0103877ab6d0bf0c1cdf6db1
1 /* $Id$ */
3 class Regression extends AIController {
4 function Start();
5 };
9 function Regression::TestInit()
11 print("");
12 print("--TestInit--");
13 print(" Ops: " + this.GetOpsTillSuspend());
14 print(" TickTest: " + this.GetTick());
15 this.Sleep(1);
16 print(" TickTest: " + this.GetTick());
17 print(" Ops: " + this.GetOpsTillSuspend());
18 print(" SetCommandDelay: " + AIController.SetCommandDelay(1));
19 print(" IsValid(vehicle.plane_speed): " + AIGameSettings.IsValid("vehicle.plane_speed"));
20 print(" vehicle.plane_speed: " + AIGameSettings.GetValue("vehicle.plane_speed"));
21 require("require.nut");
22 print(" min(6, 3): " + min(6, 3));
23 print(" min(3, 6): " + min(3, 6));
24 print(" max(6, 3): " + max(6, 3));
25 print(" max(3, 6): " + max(3, 6));
27 print(" AIList Consistency Tests");
28 print("");
29 print(" Value Descending");
30 local list = AIList();
31 list.AddItem( 5, 10);
32 list.AddItem(10, 10);
33 list.AddItem(15, 20);
34 list.AddItem(20, 20);
35 list.AddItem(25, 30);
36 list.AddItem(30, 30);
37 list.AddItem(35, 40);
38 list.AddItem(40, 40);
40 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
41 list.RemoveItem(i - 10);
42 list.RemoveItem(i - 5);
43 list.RemoveItem(i);
44 print(" " + i);
47 list.AddItem(10, 10);
48 list.AddItem(20, 20);
49 list.AddItem(30, 30);
50 list.AddItem(40, 40);
52 print("");
53 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
54 list.SetValue(i, 2);
55 print(" " + i);
57 print("");
58 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
59 print(" " + i);
62 list = AIList();
63 list.Sort(AIList.SORT_BY_VALUE, AIList.SORT_ASCENDING);
64 print("");
65 print(" Value Ascending");
66 list.AddItem( 5, 10);
67 list.AddItem(10, 10);
68 list.AddItem(15, 20);
69 list.AddItem(20, 20);
70 list.AddItem(25, 30);
71 list.AddItem(30, 30);
72 list.AddItem(35, 40);
73 list.AddItem(40, 40);
75 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
76 list.RemoveItem(i + 10);
77 list.RemoveItem(i + 5);
78 list.RemoveItem(i);
79 print(" " + i);
82 list.AddItem(10, 10);
83 list.AddItem(20, 20);
84 list.AddItem(30, 30);
85 list.AddItem(40, 40);
87 print("");
88 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
89 list.SetValue(i, 50);
90 print(" " + i);
92 print("");
93 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
94 print(" " + i);
97 list = AIList();
98 list.Sort(AIList.SORT_BY_ITEM, AIList.SORT_DESCENDING);
99 print("");
100 print(" Item Descending");
101 list.AddItem( 5, 10);
102 list.AddItem(10, 10);
103 list.AddItem(15, 20);
104 list.AddItem(20, 20);
105 list.AddItem(25, 30);
106 list.AddItem(30, 30);
107 list.AddItem(35, 40);
108 list.AddItem(40, 40);
110 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
111 list.RemoveItem(i - 10);
112 list.RemoveItem(i - 5);
113 list.RemoveItem(i);
114 print(" " + i);
117 list.AddItem(10, 10);
118 list.AddItem(20, 20);
119 list.AddItem(30, 30);
120 list.AddItem(40, 40);
122 print("");
123 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
124 list.SetValue(i, 2);
125 print(" " + i);
127 print("");
128 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
129 print(" " + i);
132 list = AIList();
133 list.Sort(AIList.SORT_BY_ITEM, AIList.SORT_ASCENDING);
134 print("");
135 print(" Item Ascending");
136 list.AddItem( 5, 10);
137 list.AddItem(10, 10);
138 list.AddItem(15, 20);
139 list.AddItem(20, 20);
140 list.AddItem(25, 30);
141 list.AddItem(30, 30);
142 list.AddItem(35, 40);
143 list.AddItem(40, 40);
145 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
146 list.RemoveItem(i + 10);
147 list.RemoveItem(i + 5);
148 list.RemoveItem(i);
149 print(" " + i);
152 list.AddItem(10, 10);
153 list.AddItem(20, 20);
154 list.AddItem(30, 30);
155 list.AddItem(40, 40);
157 print("");
158 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
159 list.SetValue(i, 50);
160 print(" " + i);
162 print("");
163 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
164 print(" " + i);
167 list.Clear();
168 foreach (idx, val in list) {
169 print(" " + idx);
172 print(" Ops: " + this.GetOpsTillSuspend());
175 function Regression::Std()
177 print("");
178 print("--Std--");
179 print(" abs(-21): " + abs(-21));
180 print(" abs( 21): " + abs(21));
183 function Regression::Base()
185 print("");
186 print("--AIBase--");
187 print(" Rand(): " + AIBase.Rand());
188 print(" Rand(): " + AIBase.Rand());
189 print(" Rand(): " + AIBase.Rand());
190 print(" RandRange(0): " + AIBase.RandRange(0));
191 print(" RandRange(0): " + AIBase.RandRange(0));
192 print(" RandRange(0): " + AIBase.RandRange(0));
193 print(" RandRange(1): " + AIBase.RandRange(1));
194 print(" RandRange(1): " + AIBase.RandRange(1));
195 print(" RandRange(1): " + AIBase.RandRange(1));
196 print(" RandRange(2): " + AIBase.RandRange(2));
197 print(" RandRange(2): " + AIBase.RandRange(2));
198 print(" RandRange(2): " + AIBase.RandRange(2));
199 print(" RandRange(1000000): " + AIBase.RandRange(1000000)); // 32 bit tests
200 print(" RandRange(1000000): " + AIBase.RandRange(1000000));
201 print(" RandRange(1000000): " + AIBase.RandRange(1000000));
202 print(" Chance(1, 2): " + AIBase.Chance(1, 2));
203 print(" Chance(1, 2): " + AIBase.Chance(1, 2));
204 print(" Chance(1, 2): " + AIBase.Chance(1, 2));
206 AIRoad.SetCurrentRoadType(AIRoad.ROADTYPE_ROAD);
209 function Regression::Airport()
211 print("");
212 print("--AIAirport--");
214 print(" IsHangarTile(): " + AIAirport.IsHangarTile(32116));
215 print(" IsAirportTile(): " + AIAirport.IsAirportTile(32116));
216 print(" GetHangarOfAirport(): " + AIAirport.GetHangarOfAirport(32116));
217 print(" GetAirportType(): " + AIAirport.GetAirportType(32116));
219 for (local i = -1; i < 10; i++) {
220 print(" IsAirportInformationAvailable(" + i + "): " + AIAirport.IsAirportInformationAvailable(i));
221 print(" IsValidAirportType(" + i + "): " + AIAirport.IsValidAirportType(i));
222 print(" GetAirportWidth(" + i + "): " + AIAirport.GetAirportWidth(i));
223 print(" GetAirportHeight(" + i + "): " + AIAirport.GetAirportHeight(i));
224 print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
227 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
228 print(" GetPrice(): " + AIAirport.GetPrice(0));
229 print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, AIStation.STATION_JOIN_ADJACENT));
230 print(" IsHangarTile(): " + AIAirport.IsHangarTile(32116));
231 print(" IsAirportTile(): " + AIAirport.IsAirportTile(32116));
232 print(" GetAirportType(): " + AIAirport.GetAirportType(32119));
233 print(" GetHangarOfAirport(): " + AIAirport.GetHangarOfAirport(32116));
234 print(" IsHangarTile(): " + AIAirport.IsHangarTile(32119));
235 print(" IsAirportTile(): " + AIAirport.IsAirportTile(32119));
236 print(" GetAirportType(): " + AIAirport.GetAirportType(32119));
237 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
239 print(" RemoveAirport(): " + AIAirport.RemoveAirport(32118));
240 print(" IsHangarTile(): " + AIAirport.IsHangarTile(32119));
241 print(" IsAirportTile(): " + AIAirport.IsAirportTile(32119));
242 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
243 print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, AIStation.STATION_JOIN_ADJACENT));
246 function Regression::Bridge()
248 local j = 0;
250 print("");
251 print("--Bridge--");
252 for (local i = -1; i < 14; i++) {
253 if (AIBridge.IsValidBridge(i)) j++;
254 print(" Bridge " + i);
255 print(" IsValidBridge(): " + AIBridge.IsValidBridge(i));
256 print(" GetName(): " + AIBridge.GetName(i));
257 print(" GetMaxSpeed(): " + AIBridge.GetMaxSpeed(i));
258 print(" GetPrice(): " + AIBridge.GetPrice(i, 5));
259 print(" GetMaxLength(): " + AIBridge.GetMaxLength(i));
260 print(" GetMinLength(): " + AIBridge.GetMinLength(i));
262 print(" Valid Bridges: " + j);
264 print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
265 print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
266 print(" RemoveBridge(): " + AIBridge.RemoveBridge(33155));
267 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
268 print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
269 print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
270 print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
271 print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
272 print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33155));
273 print(" GetBridgeID(): " + AIBridge.GetBridgeID(33155));
274 print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
275 print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
276 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
277 print(" RemoveBridge(): " + AIBridge.RemoveBridge(33155));
278 print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
281 function Regression::BridgeList()
283 local list = AIBridgeList();
285 print("");
286 print("--BridgeList--");
287 print(" Count(): " + list.Count());
288 list.Valuate(AIBridge.GetMaxSpeed);
289 print(" MaxSpeed ListDump:");
290 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
291 print(" " + i + " => " + list.GetValue(i));
293 list.Valuate(AIBridge.GetPrice, 5);
294 print(" Price ListDump:");
295 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
296 print(" " + i + " => " + list.GetValue(i));
298 list.Valuate(AIBridge.GetMaxLength);
299 print(" MaxLength ListDump:");
300 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
301 print(" " + i + " => " + list.GetValue(i));
303 list.Valuate(AIBridge.GetMinLength);
304 print(" MinLength ListDump:");
305 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
306 print(" " + i + " => " + list.GetValue(i));
309 list = AIBridgeList_Length(14);
311 print("");
312 print("--BridgeList_Length--");
313 print(" Count(): " + list.Count());
314 list.Valuate(AIBridge.GetMaxSpeed);
315 print(" MaxSpeed ListDump:");
316 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
317 print(" " + i + " => " + list.GetValue(i));
319 list.Valuate(AIBridge.GetPrice, 14);
320 print(" Price ListDump:");
321 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
322 print(" " + i + " => " + list.GetValue(i));
326 function Regression::Cargo()
328 print("");
329 print("--AICargo--");
330 for (local i = -1; i < 15; i++) {
331 print(" Cargo " + i);
332 print(" IsValidCargo(): " + AICargo.IsValidCargo(i));
333 print(" GetCargoLabel(): '" + AICargo.GetCargoLabel(i)+ "'");
334 print(" IsFreight(): " + AICargo.IsFreight(i));
335 print(" HasCargoClass(): " + AICargo.HasCargoClass(i, AICargo.CC_PASSENGERS));
336 print(" GetTownEffect(): " + AICargo.GetTownEffect(i));
337 print(" GetCargoIncome(0, 0): " + AICargo.GetCargoIncome(i, 0, 0));
338 print(" GetCargoIncome(10, 10): " + AICargo.GetCargoIncome(i, 10, 10));
339 print(" GetCargoIncome(100, 10): " + AICargo.GetCargoIncome(i, 100, 10));
340 print(" GetCargoIncome(10, 100): " + AICargo.GetCargoIncome(i, 10, 100));
341 print(" GetRoadVehicleTypeForCargo(): " + AIRoad.GetRoadVehicleTypeForCargo(i));
345 function Regression::CargoList()
347 local list = AICargoList();
349 print("");
350 print("--CargoList--");
351 print(" Count(): " + list.Count());
352 list.Valuate(AICargo.IsFreight);
353 print(" IsFreight ListDump:");
354 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
355 print(" " + i + " => " + list.GetValue(i));
358 list.Valuate(AICargo.GetCargoIncome, 100, 100);
359 print(" CargoIncomes(100, 100) ListDump:");
360 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
361 print(" " + i + " => " + list.GetValue(i));
364 list = AICargoList_IndustryAccepting(8);
365 print("");
366 print("--CargoList_IndustryAccepting--");
367 print(" Count(): " + list.Count());
368 print(" ListDump:");
369 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
370 print(" " + i);
373 list = AICargoList_IndustryProducing(4);
374 print("");
375 print("--CargoList_IndustryProducing--");
376 print(" Count(): " + list.Count());
377 print(" ListDump:");
378 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
379 print(" " + i);
383 function Regression::Company()
385 print("");
386 print("--Company--");
388 /* Test AIXXXMode() in scopes */
390 local test = AITestMode();
391 print(" SetName(): " + AICompany.SetName("Regression"));
392 print(" SetName(): " + AICompany.SetName("Regression"));
394 local exec = AIExecMode();
395 print(" SetName(): " + AICompany.SetName("Regression"));
396 print(" SetName(): " + AICompany.SetName("Regression"));
397 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
401 print(" GetName(): " + AICompany.GetName(AICompany.COMPANY_SELF));
402 print(" GetPresidentName(): " + AICompany.GetPresidentName(AICompany.COMPANY_SELF));
403 print(" SetPresidentName(): " + AICompany.SetPresidentName("Regression AI"));
404 print(" GetPresidentName(): " + AICompany.GetPresidentName(AICompany.COMPANY_SELF));
405 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
406 print(" GetName(): " + AICompany.GetName(240));
407 print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
408 print(" GetMaxLoanAmount(): " + AICompany.GetMaxLoanAmount());
409 print(" GetLoanInterval(): " + AICompany.GetLoanInterval());
410 print(" SetLoanAmount(1): " + AICompany.SetLoanAmount(1));
411 print(" SetLoanAmount(100): " + AICompany.SetLoanAmount(100));
412 print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(10000));
413 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
414 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
415 print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
416 print(" SetMinimumLoanAmount(31337): " + AICompany.SetMinimumLoanAmount(31337));
417 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
418 print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
419 print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(AICompany.GetMaxLoanAmount()));
420 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
421 print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
422 print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
423 print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(127, 129)));
424 print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
425 print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 129)));
426 print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
427 print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 128)));
428 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
429 print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
430 print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
431 print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
432 print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
433 print(" SetAutoRenewStatus(false); " + AICompany.SetAutoRenewStatus(false));
434 print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
435 print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
436 print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
437 print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
438 print(" SetAutoRenewMonths(6); " + AICompany.SetAutoRenewMonths(6));
439 print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
440 print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
441 print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
442 print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
443 print(" SetAutoRenewMoney(100000); " + AICompany.SetAutoRenewMoney(100000));
444 for (local i = -1; i <= AICompany.EARLIEST_QUARTER; i++) {
445 print(" Quarter: " + i);
446 print(" GetQuarterlyIncome(); " + AICompany.GetQuarterlyIncome(AICompany.COMPANY_SELF, i));
447 print(" GetQuarterlyExpenses(); " + AICompany.GetQuarterlyExpenses(AICompany.COMPANY_SELF, i));
448 print(" GetQuarterlyCargoDelivered(); " + AICompany.GetQuarterlyCargoDelivered(AICompany.COMPANY_SELF, i));
449 print(" GetQuarterlyPerformanceRating(); " + AICompany.GetQuarterlyPerformanceRating(AICompany.COMPANY_SELF, i));
450 print(" GetQuarterlyCompanyValue(); " + AICompany.GetQuarterlyCompanyValue(AICompany.COMPANY_SELF, i));
454 function Regression::Engine()
456 local j = 0;
458 print("");
459 print("--Engine--");
460 for (local i = -1; i < 257; i++) {
461 if (AIEngine.IsValidEngine(i)) j++;
462 print(" Engine " + i);
463 print(" IsValidEngine(): " + AIEngine.IsValidEngine(i));
464 print(" GetName(): " + AIEngine.GetName(i));
465 print(" GetCargoType(): " + AIEngine.GetCargoType(i));
466 print(" CanRefitCargo(): " + AIEngine.CanRefitCargo(i, 1));
467 print(" GetCapacity(): " + AIEngine.GetCapacity(i));
468 print(" GetReliability(): " + AIEngine.GetReliability(i));
469 print(" GetMaxSpeed(): " + AIEngine.GetMaxSpeed(i));
470 print(" GetPrice(): " + AIEngine.GetPrice(i));
471 print(" GetMaxAge(): " + AIEngine.GetMaxAge(i));
472 print(" GetRunningCost(): " + AIEngine.GetRunningCost(i));
473 print(" GetPower(): " + AIEngine.GetPower(i));
474 print(" GetWeight(): " + AIEngine.GetWeight(i));
475 print(" GetMaxTractiveEffort(): " + AIEngine.GetMaxTractiveEffort(i));
476 print(" GetVehicleType(): " + AIEngine.GetVehicleType(i));
477 print(" GetRailType(): " + AIEngine.GetRailType(i));
478 print(" GetRoadType(): " + AIEngine.GetRoadType(i));
479 print(" GetPlaneType(): " + AIEngine.GetPlaneType(i));
481 print(" Valid Engines: " + j);
484 function Regression::EngineList()
486 local list = AIEngineList(AIVehicle.VT_ROAD);
488 print("");
489 print("--EngineList--");
490 print(" Count(): " + list.Count());
491 list.Valuate(AIEngine.GetCargoType);
492 print(" CargoType ListDump:");
493 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
494 print(" " + i + " => " + list.GetValue(i));
496 list.Valuate(AIEngine.GetCapacity);
497 print(" Capacity ListDump:");
498 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
499 print(" " + i + " => " + list.GetValue(i));
501 list.Valuate(AIEngine.GetReliability);
502 print(" Reliability ListDump:");
503 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
504 print(" " + i + " => " + list.GetValue(i));
506 list.Valuate(AIEngine.GetMaxSpeed);
507 print(" MaxSpeed ListDump:");
508 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
509 print(" " + i + " => " + list.GetValue(i));
511 list.Valuate(AIEngine.GetPrice);
512 print(" Price ListDump:");
513 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
514 print(" " + i + " => " + list.GetValue(i));
518 function Regression::Prices()
520 print("");
521 print("--Prices--");
522 print(" -Rail-");
523 print(" 0,BT_TRACK: " + AIRail.GetBuildCost(0, AIRail.BT_TRACK));
524 print(" 0,BT_SIGNAL: " + AIRail.GetBuildCost(0, AIRail.BT_SIGNAL));
525 print(" 0,BT_DEPOT: " + AIRail.GetBuildCost(0, AIRail.BT_DEPOT));
526 print(" 0,BT_STATION: " + AIRail.GetBuildCost(0, AIRail.BT_STATION));
527 print(" 0,BT_WAYPOINT: " + AIRail.GetBuildCost(0, AIRail.BT_WAYPOINT));
528 print(" 1,BT_TRACK: " + AIRail.GetBuildCost(1, AIRail.BT_TRACK));
529 print(" 1,BT_SIGNAL: " + AIRail.GetBuildCost(1, AIRail.BT_SIGNAL));
530 print(" 1,BT_DEPOT: " + AIRail.GetBuildCost(1, AIRail.BT_DEPOT));
531 print(" 1,BT_STATION: " + AIRail.GetBuildCost(1, AIRail.BT_STATION));
532 print(" 1,BT_WAYPOINT: " + AIRail.GetBuildCost(1, AIRail.BT_WAYPOINT));
533 print(" -Road-");
534 print(" ROADTYPE_ROAD,BT_ROAD: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_ROAD));
535 print(" ROADTYPE_ROAD,BT_DEPOT: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_DEPOT));
536 print(" ROADTYPE_ROAD,BT_BUS_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_BUS_STOP));
537 print(" ROADTYPE_ROAD,BT_TRUCK_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_TRUCK_STOP));
538 print(" ROADTYPE_TRAM,BT_ROAD: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_ROAD));
539 print(" ROADTYPE_TRAM,BT_DEPOT: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_DEPOT));
540 print(" ROADTYPE_TRAM,BT_BUS_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_BUS_STOP));
541 print(" ROADTYPE_TRAM,BT_TRUCK_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_TRUCK_STOP));
542 print(" -Water-");
543 print(" BT_DOCK: " + AIMarine.GetBuildCost(AIMarine.BT_DOCK));
544 print(" BT_DEPOT: " + AIMarine.GetBuildCost(AIMarine.BT_DEPOT));
545 print(" BT_BUOY: " + AIMarine.GetBuildCost(AIMarine.BT_BUOY));
546 print(" -Tile-");
547 print(" BT_FOUNDATION: " + AITile.GetBuildCost(AITile.BT_FOUNDATION));
548 print(" BT_TERRAFORM: " + AITile.GetBuildCost(AITile.BT_TERRAFORM));
549 print(" BT_BUILD_TREES: " + AITile.GetBuildCost(AITile.BT_BUILD_TREES));
550 print(" BT_CLEAR_GRASS: " + AITile.GetBuildCost(AITile.BT_CLEAR_GRASS));
551 print(" BT_CLEAR_ROUGH: " + AITile.GetBuildCost(AITile.BT_CLEAR_ROUGH));
552 print(" BT_CLEAR_ROCKY: " + AITile.GetBuildCost(AITile.BT_CLEAR_ROCKY));
553 print(" BT_CLEAR_FIELDS: " + AITile.GetBuildCost(AITile.BT_CLEAR_FIELDS));
554 print(" BT_CLEAR_HOUSE: " + AITile.GetBuildCost(AITile.BT_CLEAR_HOUSE));
557 function cost_callback(old_path, new_tile, new_direction, self) { if (old_path == null) return 0; return old_path.GetCost() + 1; }
558 function estimate_callback(tile, direction, goals, self) { return goals[0] - tile; }
559 function neighbours_callback(path, cur_tile, self) { return [[cur_tile + 1, 1]]; }
560 function check_direction_callback(tile, existing_direction, new_direction, self) { return false; }
562 function Regression::Group()
564 print ("");
565 print("--Group--");
566 print(" SetAutoReplace(): " + AIGroup.SetAutoReplace(AIGroup.GROUP_ALL, 116, 117));
567 print(" GetEngineReplacement(): " + AIGroup.GetEngineReplacement(AIGroup.GROUP_ALL, 116));
568 print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_ALL, 116));
569 print(" AIRoad.BuildRoadDepot(): " + AIRoad.BuildRoadDepot(10000, 10001));
570 local vehicle = AIVehicle.BuildVehicle(10000, 116);
571 print(" AIVehicle.BuildVehicle(): " + vehicle);
572 print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_ALL, 116));
573 local group = AIGroup.CreateGroup(AIVehicle.VT_ROAD);
574 print(" CreateGroup(): " + group);
575 print(" MoveVehicle(): " + AIGroup.MoveVehicle(group, vehicle));
576 print(" GetNumEngines(): " + AIGroup.GetNumEngines(group, 116));
577 print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_ALL, 116));
578 print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_DEFAULT, 116));
579 print(" GetName(): " + AIGroup.GetName(0));
580 print(" GetName(): " + AIGroup.GetName(1));
581 print(" AIVehicle.SellVehicle(): " + AIVehicle.SellVehicle(vehicle));
582 print(" AITile.DemolishTile(): " + AITile.DemolishTile(10000));
583 print(" HasWagonRemoval(): " + AIGroup.HasWagonRemoval());
584 print(" EnableWagonRemoval(): " + AIGroup.EnableWagonRemoval(true));
585 print(" HasWagonRemoval(): " + AIGroup.HasWagonRemoval());
586 print(" EnableWagonRemoval(): " + AIGroup.EnableWagonRemoval(false));
587 print(" EnableWagonRemoval(): " + AIGroup.EnableWagonRemoval(false));
588 print(" HasWagonRemoval(): " + AIGroup.HasWagonRemoval());
591 function Regression::Industry()
593 local j = 0;
595 print("");
596 print("--Industry--");
597 print(" GetIndustryCount(): " + AIIndustry.GetIndustryCount());
598 local list = AIIndustryList();
599 list.Sort(AIList.SORT_BY_ITEM, AIList.SORT_ASCENDING);
600 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
601 if (AIIndustry.IsValidIndustry(i)) j++;
602 print(" Industry " + i);
603 print(" IsValidIndustry(): " + AIIndustry.IsValidIndustry(i));
604 print(" GetName(): " + AIIndustry.GetName(i));
605 print(" GetLocation(): " + AIIndustry.GetLocation(i));
606 print(" IsCargoAccepted(): " + AIIndustry.IsCargoAccepted(i, 1));
608 local cargo_list = AICargoList();
609 for (local j = cargo_list.Begin(); !cargo_list.IsEnd(); j = cargo_list.Next()) {
610 if (AIIndustry.IsCargoAccepted(i, j) || AIIndustry.GetLastMonthProduction(i,j) >= 0) {
611 print(" GetLastMonthProduction(): " + AIIndustry.GetLastMonthProduction(i, j));
612 print(" GetLastMonthTransported(): " + AIIndustry.GetLastMonthTransported(i, j));
613 print(" GetStockpiledCargo(): " + AIIndustry.GetStockpiledCargo(i, j));
617 print(" Valid Industries: " + j);
618 print(" GetIndustryCount(): " + AIIndustry.GetIndustryCount());
619 print(" GetIndustryID(): " + AIIndustry.GetIndustryID(19694));
620 print(" GetIndustryID(): " + AIIndustry.GetIndustryID(19695));
623 function Regression::IndustryList()
625 local list = AIIndustryList();
627 print("");
628 print("--IndustryList--");
629 print(" Count(): " + list.Count());
630 list.Valuate(AIIndustry.GetLocation);
631 print(" Location ListDump:");
632 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
633 print(" " + i + " => " + list.GetValue(i));
635 list.Valuate(AIIndustry.GetDistanceManhattanToTile, 30000);
636 print(" DistanceManhattanToTile(30000) ListDump:");
637 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
638 print(" " + i + " => " + list.GetValue(i));
640 list.Valuate(AIIndustry.GetDistanceSquareToTile, 30000);
641 print(" DistanceSquareToTile(30000) ListDump:");
642 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
643 print(" " + i + " => " + list.GetValue(i));
645 list.Valuate(AIIndustry.GetAmountOfStationsAround);
646 print(" GetAmountOfStationsAround(30000) ListDump:");
647 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
648 print(" " + i + " => " + list.GetValue(i));
650 list.Valuate(AIIndustry.IsCargoAccepted, 1);
651 print(" CargoAccepted(1) ListDump:");
652 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
653 print(" " + i + " => " + list.GetValue(i));
656 list = AIIndustryList_CargoAccepting(1);
657 print("--IndustryList_CargoAccepting--");
658 print(" Count(): " + list.Count());
659 list.Valuate(AIIndustry.GetLocation);
660 print(" Location ListDump:");
661 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
662 print(" " + i + " => " + list.GetValue(i));
665 list = AIIndustryList_CargoProducing(1);
666 print("--IndustryList_CargoProducing--");
667 print(" Count(): " + list.Count());
668 list.Valuate(AIIndustry.GetLocation);
669 print(" Location ListDump:");
670 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
671 print(" " + i + " => " + list.GetValue(i));
675 function Regression::IndustryTypeList()
677 local list = AIIndustryTypeList();
679 print("");
680 print("--IndustryTypeList--");
681 print(" Count(): " + list.Count());
682 list.Valuate(AIIndustry.GetLocation);
683 print(" Location ListDump:");
684 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
685 print(" Id: " + i);
686 print(" IsRawIndustry(): " + AIIndustryType.IsRawIndustry(i));
687 print(" ProductionCanIncrease(): " + AIIndustryType.ProductionCanIncrease(i));
688 print(" GetConstructionCost(): " + AIIndustryType.GetConstructionCost(i));
689 print(" GetName(): " + AIIndustryType.GetName(i));
690 print(" CanBuildIndustry(): " + AIIndustryType.CanBuildIndustry(i));
691 print(" CanProspectIndustry(): " + AIIndustryType.CanProspectIndustry(i));
692 print(" IsBuiltOnWater(): " + AIIndustryType.IsBuiltOnWater(i));
693 print(" HasHeliport(): " + AIIndustryType.HasHeliport(i));
694 print(" HasDock(): " + AIIndustryType.HasDock(i));
698 function CustomValuator(list_id)
700 return list_id * 4343;
703 function Regression::List()
705 local list = AIList();
707 print("");
708 print("--List--");
710 print(" IsEmpty(): " + list.IsEmpty());
711 list.AddItem(1, 1);
712 list.AddItem(2, 2);
713 for (local i = 1000; i < 1100; i++) {
714 list.AddItem(i, i);
716 list.RemoveItem(1050);
717 list.RemoveItem(1150);
718 list.SetValue(1051, 12);
719 print(" Count(): " + list.Count());
720 print(" HasItem(1050): " + list.HasItem(1050));
721 print(" HasItem(1051): " + list.HasItem(1051));
722 print(" IsEmpty(): " + list.IsEmpty());
723 list.Sort(AIList.SORT_BY_ITEM, AIList.SORT_ASCENDING);
724 print(" List Dump:");
725 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
726 print(" " + i + " => " + list.GetValue(i));
728 list.Valuate(CustomValuator);
729 print(" Custom ListDump:");
730 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
731 print(" " + i + " => " + list.GetValue(i));
733 list.Valuate(function (a) { return a * 42; });
734 print(" Custom ListDump:");
735 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
736 print(" " + i + " => " + list.GetValue(i));
738 list.Valuate(AIBase.RandItem);
739 print(" Randomize ListDump:");
740 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
741 print(" " + i + " => " + list.GetValue(i));
744 list.KeepTop(10);
745 print(" KeepTop(10):");
746 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
747 print(" " + i + " => " + list.GetValue(i));
749 list.KeepBottom(8);
750 print(" KeepBottom(8):");
751 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
752 print(" " + i + " => " + list.GetValue(i));
754 list.RemoveBottom(2);
755 print(" RemoveBottom(2):");
756 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
757 print(" " + i + " => " + list.GetValue(i));
759 list.RemoveTop(2);
760 print(" RemoveTop(2):");
761 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
762 print(" " + i + " => " + list.GetValue(i));
765 local list2 = AIList();
766 list2.AddItem(1003, 0);
767 list2.AddItem(1004, 0);
768 list.RemoveList(list2);
769 print(" RemoveList({1003, 1004}):");
770 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
771 print(" " + i + " => " + list.GetValue(i));
773 list2.AddItem(1005, 0);
774 list.KeepList(list2);
775 print(" KeepList({1003, 1004, 1005}):");
776 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
777 print(" " + i + " => " + list.GetValue(i));
779 list2.Clear();
780 for (local i = 4000; i < 4003; i++) {
781 list2.AddItem(i, i * 2);
783 list2.AddItem(1005, 1005);
784 list.AddList(list2);
785 print(" AddList({1005, 4000, 4001, 4002}):");
786 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
787 print(" " + i + " => " + list.GetValue(i));
789 list[4000] = 50;
790 list[4006] = 12;
792 print(" foreach():");
793 foreach (idx, val in list) {
794 print(" " + idx + " => " + val);
796 print(" []:");
797 print(" 4000 => " + list[4000]);
799 list.Clear();
800 print(" IsEmpty(): " + list.IsEmpty());
802 for (local i = 0; i < 10; i++) {
803 list.AddItem(i, 5 + i / 2);
806 local it = list.Begin();
807 print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
808 list.Sort(list.SORT_BY_VALUE, list.SORT_ASCENDING);
809 it = list.Next();
810 print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
812 it = list.Begin();
813 print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
815 list.SetValue(it + 1, -5);
816 it = list.Next();
817 print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
819 list.RemoveValue(list.GetValue(it) + 1);
820 it = list.Next();
821 print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
823 list.RemoveAboveValue(list.GetValue(it));
824 it = list.Next();
825 print(" " + it + " => " + list.GetValue(it) + " (" + !list.IsEnd() + ")");
827 while (!list.IsEnd()) {
828 it = list.Next();
829 print(" " + it + " => " + list.GetValue(it));
833 function Regression::Map()
835 print("");
836 print("--Map--");
837 print(" GetMapSize(): " + AIMap.GetMapSize());
838 print(" GetMapSizeX(): " + AIMap.GetMapSizeX());
839 print(" GetMapSizeY(): " + AIMap.GetMapSizeY());
840 print(" GetTileX(123): " + AIMap.GetTileX(123));
841 print(" GetTileY(123): " + AIMap.GetTileY(123));
842 print(" GetTileIndex(): " + AIMap.GetTileIndex(123, 0));
843 print(" GetTileIndex(): " + AIMap.GetTileIndex(0, 123));
844 print(" GetTileIndex(): " + AIMap.GetTileIndex(0, 0));
845 print(" GetTileIndex(): " + AIMap.GetTileIndex(-1, -1));
846 print(" GetTileIndex(): " + AIMap.GetTileIndex(10000, 10000));
847 print(" IsValidTile(123): " + AIMap.IsValidTile(123));
848 print(" GetTileX(124): " + AIMap.GetTileX(124));
849 print(" GetTileY(124): " + AIMap.GetTileY(124));
850 print(" IsValidTile(124): " + AIMap.IsValidTile(124));
851 print(" IsValidTile(0): " + AIMap.IsValidTile(0));
852 print(" IsValidTile(-1): " + AIMap.IsValidTile(-1));
853 print(" IsValidTile(): " + AIMap.IsValidTile(AIMap.GetMapSize()));
854 print(" IsValidTile(): " + AIMap.IsValidTile(AIMap.GetMapSize() - AIMap.GetMapSizeX() - 2));
855 print(" DemolishTile(): " + AITile.DemolishTile(19592));
856 print(" DemolishTile(): " + AITile.DemolishTile(19335));
857 print(" Distance");
858 print(" DistanceManhattan(): " + AIMap.DistanceManhattan(1, 10000));
859 print(" DistanceMax(): " + AIMap.DistanceMax(1, 10000));
860 print(" DistanceSquare(): " + AIMap.DistanceSquare(1, 10000));
861 print(" DistanceFromEdge(): " + AIMap.DistanceFromEdge(10000));
864 function Regression::Marine()
866 print("");
867 print("--AIMarine--");
869 print(" IsWaterDepotTile(): " + AIMarine.IsWaterDepotTile(32116));
870 print(" IsDockTile(): " + AIMarine.IsDockTile(32116));
871 print(" IsBuoyTile(): " + AIMarine.IsBuoyTile(32116));
872 print(" IsLockTile(): " + AIMarine.IsLockTile(32116));
873 print(" IsCanalTile(): " + AIMarine.IsCanalTile(32116));
875 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
876 print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, 28478));
877 print(" BuildDock(): " + AIMarine.BuildDock(29253, AIStation.STATION_JOIN_ADJACENT));
878 print(" BuildBuoy(): " + AIMarine.BuildBuoy(28481));
879 print(" BuildLock(): " + AIMarine.BuildLock(28487));
880 print(" HasTransportType(): " + AITile.HasTransportType(32127, AITile.TRANSPORT_WATER));
881 print(" BuildCanal(): " + AIMarine.BuildCanal(32127));
882 print(" HasTransportType(): " + AITile.HasTransportType(32127, AITile.TRANSPORT_WATER));
883 print(" IsWaterDepotTile(): " + AIMarine.IsWaterDepotTile(28479));
884 print(" IsDockTile(): " + AIMarine.IsDockTile(29253));
885 print(" IsBuoyTile(): " + AIMarine.IsBuoyTile(28481));
886 print(" IsLockTile(): " + AIMarine.IsLockTile(28487));
887 print(" IsCanalTile(): " + AIMarine.IsCanalTile(32127));
888 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
890 local list = AIWaypointList(AIWaypoint.WAYPOINT_BUOY);
891 print("");
892 print("--AIWaypointList(BUOY)--");
893 print(" Count(): " + list.Count());
894 print(" Location ListDump:");
895 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
896 print(" " + AIWaypoint.GetLocation(i));
898 print(" HasWaypointType:");
899 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
900 print(" " + AIWaypoint.HasWaypointType(i, AIWaypoint.WAYPOINT_RAIL) + " " + AIWaypoint.HasWaypointType(i, AIWaypoint.WAYPOINT_BUOY) + " " + AIWaypoint.HasWaypointType(i, AIWaypoint.WAYPOINT_ANY));
902 print("");
904 print(" RemoveWaterDepot(): " + AIMarine.RemoveWaterDepot(28479));
905 print(" RemoveDock(): " + AIMarine.RemoveDock(29253));
906 print(" RemoveBuoy(): " + AIMarine.RemoveBuoy(28481));
907 print(" RemoveLock(): " + AIMarine.RemoveLock(28487));
908 print(" RemoveCanal(): " + AIMarine.RemoveCanal(32127));
909 print(" IsWaterDepotTile(): " + AIMarine.IsWaterDepotTile(28479));
910 print(" IsDockTile(): " + AIMarine.IsDockTile(29253));
911 print(" IsBuoyTile(): " + AIMarine.IsBuoyTile(28481));
912 print(" IsLockTile(): " + AIMarine.IsLockTile(28487));
913 print(" IsCanalTile(): " + AIMarine.IsCanalTile(32127));
914 print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
916 print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, 28480));
917 print(" BuildDock(): " + AIMarine.BuildDock(29253, AIStation.STATION_JOIN_ADJACENT));
920 function Regression::Order()
922 print("");
923 print("--Order--");
924 print(" GetOrderCount(): " + AIOrder.GetOrderCount(12));
925 print(" GetOrderDestination(): " + AIOrder.GetOrderDestination(12, 1));
926 print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER));
927 print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER | AIOrder.OF_UNLOAD));
928 print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER | AIOrder.OF_FULL_LOAD));
929 print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.OF_SERVICE_IF_NEEDED));
930 print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.OF_STOP_IN_DEPOT));
931 print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(0, AIOrder.OF_SERVICE_IF_NEEDED | AIOrder.OF_GOTO_NEAREST_DEPOT));
932 print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_LOAD_PERCENTAGE, AIOrder.CF_EQUALS));
933 print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_RELIABILITY, AIOrder.CF_IS_TRUE));
934 print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_REQUIRES_SERVICE, AIOrder.CF_IS_FALSE));
935 print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_AGE, AIOrder.CF_INVALID));
936 print(" IsValidVehicleOrder(): " + AIOrder.IsValidVehicleOrder(12, 1));
937 print(" IsGotoStationOrder(): " + AIOrder.IsGotoStationOrder(12, 1));
938 print(" IsGotoDepotOrder(): " + AIOrder.IsGotoDepotOrder(12, 1));
939 print(" IsGotoWaypointOrder(): " + AIOrder.IsGotoWaypointOrder(12, 1));
940 print(" IsConditionalOrder(): " + AIOrder.IsConditionalOrder(12, 1));
941 print(" IsCurrentOrderPartOfOrderList(): " + AIOrder.IsCurrentOrderPartOfOrderList(12));
942 print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 1));
943 print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33416, AIOrder.OF_TRANSFER));
944 print(" InsertOrder(): " + AIOrder.InsertOrder(12, 0, 33416, AIOrder.OF_TRANSFER));
945 print(" GetOrderCount(): " + AIOrder.GetOrderCount(12));
946 print(" IsValidVehicleOrder(): " + AIOrder.IsValidVehicleOrder(12, 1));
947 print(" IsGotoStationOrder(): " + AIOrder.IsGotoStationOrder(12, 1));
948 print(" IsGotoDepotOrder(): " + AIOrder.IsGotoDepotOrder(12, 1));
949 print(" IsGotoWaypointOrder(): " + AIOrder.IsGotoWaypointOrder(12, 1));
950 print(" IsConditionalOrder(): " + AIOrder.IsConditionalOrder(12, 1));
951 print(" IsCurrentOrderPartOfOrderList(): " + AIOrder.IsCurrentOrderPartOfOrderList(12));
952 print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 0));
953 print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 1));
954 print(" GetOrderJumpTo(): " + AIOrder.GetOrderJumpTo(12, 1));
955 print(" RemoveOrder(): " + AIOrder.RemoveOrder(12, 0));
956 print(" SetOrderFlags(): " + AIOrder.SetOrderFlags(12, 0, AIOrder.OF_FULL_LOAD));
957 print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 0));
958 print(" GetOrderDestination(): " + AIOrder.GetOrderDestination(12, 0));
959 print(" CopyOrders(): " + AIOrder.CopyOrders(12, 1));
960 print(" CopyOrders(): " + AIOrder.CopyOrders(13, 12));
961 print(" ShareOrders(): " + AIOrder.ShareOrders(13, 1));
962 print(" ShareOrders(): " + AIOrder.ShareOrders(13, 12));
963 print(" UnshareOrders(): " + AIOrder.UnshareOrders(13));
964 print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33421, AIOrder.OF_NONE));
966 print(" GetStopLocation(): " + AIOrder.GetStopLocation(13, 0));
967 print(" BuildVehicle(): " + AIVehicle.BuildVehicle(23596, 8));
968 print(" BuildRailStation(): " + AIRail.BuildRailStation(7958, AIRail.RAILTRACK_NE_SW, 1, 1, AIStation.STATION_NEW));
969 print(" AppendOrder(): " + AIOrder.AppendOrder(20, 7958, AIOrder.OF_NONE));
970 print(" GetOrderCount(): " + AIOrder.GetOrderCount(20));
971 print(" GetStopLocation(): " + AIOrder.GetStopLocation(20, 0));
972 print(" SetStopLocation(): " + AIOrder.SetStopLocation(20, 0, AIOrder.STOPLOCATION_MIDDLE));
973 print(" GetStopLocation(): " + AIOrder.GetStopLocation(20, 0));
975 local list = AIVehicleList_Station(3);
977 print("");
978 print("--VehicleList_Station--");
979 print(" Count(): " + list.Count());
980 list.Valuate(AIVehicle.GetLocation);
981 print(" Location ListDump:");
982 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
983 print(" " + i + " => " + list.GetValue(i));
985 print(" foreach():");
986 foreach (idx, val in list) {
987 print(" " + idx + " => " + val);
991 function Regression::RailTypeList()
993 local list = AIRailTypeList();
995 print("");
996 print("--RailTypeList--");
997 print(" Count(): " + list.Count());
998 print(" ListDump:");
999 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1000 print(" RailType: " + i);
1001 print(" GetName(): " + AIRail.GetName(i));
1002 print(" IsRailTypeAvailable(): " + AIRail.IsRailTypeAvailable(i));
1003 print(" GetMaxSpeed(): " + AIRail.GetMaxSpeed(i));
1007 function Regression::Rail()
1009 AIRail.SetCurrentRailType(0);
1011 print("");
1012 print("--Rail--");
1013 print(" IsRailTile(): " + AIRail.IsRailTile(10002));
1014 print(" BuildRailTrack(): " + AIRail.BuildRailTrack(10002, AIRail.RAILTRACK_NW_SE));
1015 print(" BuildSignal(): " + AIRail.BuildSignal(10002, 10258, AIRail.SIGNALTYPE_PBS));
1016 print(" RemoveRailTrack(): " + AIRail.RemoveRailTrack(10002, AIRail.RAILTRACK_NW_NE));
1017 print(" RemoveRailTrack(): " + AIRail.RemoveRailTrack(10002, AIRail.RAILTRACK_NW_SE));
1018 print(" BuildRail(): " + AIRail.BuildRail(10002, 10003, 10006));
1019 print(" HasTransportType(): " + AITile.HasTransportType(10005, AITile.TRANSPORT_RAIL));
1020 print(" HasTransportType(): " + AITile.HasTransportType(10006, AITile.TRANSPORT_RAIL));
1021 print(" RemoveRail(): " + AIRail.RemoveRail(10005, 10004, 10001));
1023 print(" Depot");
1024 print(" IsRailTile(): " + AIRail.IsRailTile(33411));
1025 print(" BuildRailDepot(): " + AIRail.BuildRailDepot(0, 1));
1026 print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33411));
1027 print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33414));
1028 print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33412));
1029 print(" GetRailDepotFrontTile(): " + AIRail.GetRailDepotFrontTile(33411));
1030 print(" IsBuildable(): " + AITile.IsBuildable(33411));
1031 local list = AIDepotList(AITile.TRANSPORT_RAIL);
1032 print(" DepotList");
1033 print(" Count(): " + list.Count());
1034 list.Valuate(AITile.GetDistanceManhattanToTile, 0);
1035 print(" Depot distance from (0,0) ListDump:");
1036 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1037 print(" " + i + " => " + list.GetValue(i));
1039 print(" RemoveDepot(): " + AITile.DemolishTile(33411));
1040 print(" BuildRailDepot(): " + AIRail.BuildRailDepot(23596, 23597));
1042 print(" Station");
1043 print(" BuildRailStation(): " + AIRail.BuildRailStation(0, AIRail.RAILTRACK_NE_SW, 1, 1, AIStation.STATION_NEW));
1044 print(" BuildRailStation(): " + AIRail.BuildRailStation(7958, AIRail.RAILTRACK_NE_SW, 4, 5, AIStation.STATION_NEW));
1045 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7957));
1046 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7958));
1047 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7959));
1048 print(" RemoveRailStationTileRectangle():" + AIRail.RemoveRailStationTileRectangle(7959, 7959, false));
1049 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7957));
1050 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7958));
1051 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7959));
1052 print(" DemolishTile(): " + AITile.DemolishTile(7960));
1053 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7957));
1054 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7958));
1055 print(" IsRailStationTile(): " + AIRail.IsRailStationTile(7959));
1058 function Regression::Road()
1060 print("");
1061 print("--Road--");
1062 print(" Road");
1063 print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
1064 print(" BuildRoad(): " + AIRoad.BuildRoad(0, 1));
1065 print(" BuildRoad(): " + AIRoad.BuildRoad(33411, 33411));
1066 print(" HasTransportType(): " + AITile.HasTransportType(33413, AITile.TRANSPORT_ROAD));
1067 print(" BuildRoad(): " + AIRoad.BuildRoad(33411, 33414));
1068 print(" HasTransportType(): " + AITile.HasTransportType(33413, AITile.TRANSPORT_ROAD));
1069 print(" AreRoadTilesConnected(): " + AIRoad.AreRoadTilesConnected(33412, 33413));
1070 print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
1071 print(" HasRoadType(Road): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
1072 print(" HasRoadType(Tram): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
1073 print(" GetNeighbourRoadCount(): " + AIRoad.GetNeighbourRoadCount(33412));
1074 print(" RemoveRoad(): " + AIRoad.RemoveRoad(33411, 33411));
1075 print(" RemoveRoad(): " + AIRoad.RemoveRoad(33411, 33412));
1076 print(" RemoveRoad(): " + AIRoad.RemoveRoad(19590, 19590));
1077 print(" RemoveRoad(): " + AIRoad.RemoveRoad(33411, 33414));
1078 print(" BuildOneWayRoad(): " + AIRoad.BuildOneWayRoad(33411, 33414));
1079 print(" AreRoadTilesConnected(): " + AIRoad.AreRoadTilesConnected(33412, 33413));
1080 print(" AreRoadTilesConnected(): " + AIRoad.AreRoadTilesConnected(33413, 33412));
1081 print(" BuildOneWayRoad(): " + AIRoad.BuildOneWayRoad(33413, 33412));
1082 print(" AreRoadTilesConnected(): " + AIRoad.AreRoadTilesConnected(33412, 33413));
1083 print(" AreRoadTilesConnected(): " + AIRoad.AreRoadTilesConnected(33413, 33412));
1084 print(" BuildOneWayRoad(): " + AIRoad.BuildOneWayRoad(33412, 33413));
1085 print(" BuildOneWayRoad(): " + AIRoad.BuildOneWayRoad(33413, 33412));
1086 print(" AreRoadTilesConnected(): " + AIRoad.AreRoadTilesConnected(33412, 33413));
1087 print(" AreRoadTilesConnected(): " + AIRoad.AreRoadTilesConnected(33413, 33412));
1088 print(" RemoveRoad(): " + AIRoad.RemoveRoad(33411, 33412));
1089 print(" IsRoadTypeAvailable(Road): " + AIRoad.IsRoadTypeAvailable(AIRoad.ROADTYPE_ROAD));
1090 print(" IsRoadTypeAvailable(Tram): " + AIRoad.IsRoadTypeAvailable(AIRoad.ROADTYPE_TRAM));
1091 print(" SetCurrentRoadType(Tram): " + AIRoad.SetCurrentRoadType(AIRoad.ROADTYPE_TRAM));
1092 print(" GetCurrentRoadType(): " + AIRoad.GetCurrentRoadType());
1094 print(" Depot");
1095 print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
1096 print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(0, 1));
1097 print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33411));
1098 print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33414));
1099 print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33412));
1100 print(" HasRoadType(Road): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
1101 print(" HasRoadType(Tram): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
1102 print(" GetLastError(): " + AIError.GetLastError());
1103 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
1104 print(" GetErrorCategory(): " + AIError.GetErrorCategory());
1105 print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
1106 print(" GetRoadDepotFrontTile(): " + AIRoad.GetRoadDepotFrontTile(33411));
1107 print(" IsRoadDepotTile(): " + AIRoad.IsRoadDepotTile(33411));
1108 print(" IsBuildable(): " + AITile.IsBuildable(33411));
1109 local list = AIDepotList(AITile.TRANSPORT_ROAD);
1110 print(" DepotList");
1111 print(" Count(): " + list.Count());
1112 list.Valuate(AITile.GetDistanceManhattanToTile, 0);
1113 print(" Depot distance from (0,0) ListDump:");
1114 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1115 print(" " + i + " => " + list.GetValue(i));
1117 print(" RemoveRoadDepot(): " + AIRoad.RemoveRoadDepot(33411));
1118 print(" RemoveRoadDepot(): " + AIRoad.RemoveRoadDepot(33411));
1120 print(" Station");
1121 print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
1122 print(" BuildRoadStation(): " + AIRoad.BuildRoadStation(0, 1, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1123 print(" BuildRoadStation(): " + AIRoad.BuildRoadStation(33411, 33411, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1124 print(" BuildRoadStation(): " + AIRoad.BuildRoadStation(33411, 33414, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1125 print(" BuildRoadStation(): " + AIRoad.BuildRoadStation(33411, 33412, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1126 print(" IsStationTile(): " + AITile.IsStationTile(33411));
1127 print(" IsStationTile(): " + AITile.IsStationTile(33412));
1128 print(" HasRoadType(Road): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
1129 print(" HasRoadType(Tram): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
1130 print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
1131 print(" GetDriveThroughBackTile(): " + AIRoad.GetDriveThroughBackTile(33411));
1132 print(" GetRoadStationFrontTile(): " + AIRoad.GetRoadStationFrontTile(33411));
1133 print(" IsRoadStationTile(): " + AIRoad.IsRoadStationTile(33411));
1134 print(" IsDriveThroughRoadStationTile: " + AIRoad.IsDriveThroughRoadStationTile(33411));
1135 print(" RemoveRoadStation(): " + AIRoad.RemoveRoadStation(33411));
1136 print(" RemoveRoadStation(): " + AIRoad.RemoveRoadStation(33411));
1138 print(" Station Types");
1139 print(" BuildRoadStation(bus): " + AIRoad.BuildRoadStation(33411, 33410, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1140 print(" BuildRoadStation(truck): " + AIRoad.BuildRoadStation(33421, 33422, AIRoad.ROADVEHTYPE_TRUCK, AIStation.STATION_JOIN_ADJACENT));
1141 print(" BuildRoadStation(truck): " + AIRoad.BuildRoadStation(33412, 33413, AIRoad.ROADVEHTYPE_TRUCK, AIStation.STATION_JOIN_ADJACENT));
1142 print(" BuildRoadStation(bus): " + AIRoad.BuildRoadStation(33411 + 256, 33411, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1143 print(" BuildRoadStation(truck): " + AIRoad.BuildRoadStation(33412 + 256, 33412 + 256 + 256, AIRoad.ROADVEHTYPE_TRUCK, AIStation.STATION_JOIN_ADJACENT));
1144 print(" BuildDriveThroughRoadStation(bus-drive): " + AIRoad.BuildDriveThroughRoadStation(33413, 33412, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1145 print(" BuildDriveThroughRoadStation(truck-drive): " + AIRoad.BuildDriveThroughRoadStation(33414, 33413, AIRoad.ROADVEHTYPE_TRUCK, AIStation.STATION_JOIN_ADJACENT));
1146 print(" BuildDriveThroughRoadStation(bus-drive): " + AIRoad.BuildDriveThroughRoadStation(33415, 33414, AIRoad.ROADVEHTYPE_BUS, AIStation.STATION_JOIN_ADJACENT));
1147 print(" BuildDriveThroughRoadStation(truck-drive): " + AIRoad.BuildDriveThroughRoadStation(33416, 33415, AIRoad.ROADVEHTYPE_TRUCK, AIStation.STATION_JOIN_ADJACENT));
1148 print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33417, 33418));
1149 print(" GetRoadStationFrontTile(): " + AIRoad.GetRoadStationFrontTile(33411 + 256));
1150 print(" GetRoadStationFrontTile(): " + AIRoad.GetRoadStationFrontTile(33412 + 256));
1151 print(" IsDriveThroughRoadStationTile: " + AIRoad.IsDriveThroughRoadStationTile(33415));
1152 print(" IsBuildable(): " + AITile.IsBuildable(33415));
1153 print(" GetDriveThroughBackTile(): " + AIRoad.GetDriveThroughBackTile(33415));
1154 print(" GetRoadStationFrontTile(): " + AIRoad.GetRoadStationFrontTile(33415));
1155 print(" IsRoadTile(): " + AIRoad.IsRoadTile(33415));
1158 function Regression::Sign()
1160 local j = 0;
1162 print("");
1163 print("--Sign--");
1164 print(" BuildSign(33410, 'Some Sign'): " + AISign.BuildSign(33410, "Some Sign"));
1165 print(" BuildSign(33411, 'Test'): " + AISign.BuildSign(33411, "Test"));
1166 print(" SetName(1, 'Test2'): " + AISign.SetName(1, "Test2"));
1167 local sign_id = AISign.BuildSign(33409, "Some other Sign");
1168 print(" BuildSign(33409, 'Some other Sign'): " + sign_id);
1169 print(" RemoveSign(" + sign_id + "): " + AISign.RemoveSign(sign_id));
1170 print("");
1171 local list = AISignList();
1172 list.Sort(AIList.SORT_BY_ITEM, AIList.SORT_ASCENDING);
1173 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1174 j++;
1175 print(" Sign " + i);
1176 print(" IsValidSign(): " + AISign.IsValidSign(i));
1177 print(" GetName(): " + AISign.GetName(i));
1178 print(" GetLocation(): " + AISign.GetLocation(i));
1180 print(" Valid Signs: " + j);
1183 function Regression::Station()
1185 print("");
1186 print("--Station--");
1187 print(" IsValidStation(0): " + AIStation.IsValidStation(0));
1188 print(" IsValidStation(1000): " + AIStation.IsValidStation(1000));
1189 print(" GetName(0): " + AIStation.GetName(0));
1190 print(" SetName(0): " + AIStation.SetName(0, "Look, a station"));
1191 print(" GetName(0): " + AIStation.GetName(0));
1192 print(" GetLocation(1): " + AIStation.GetLocation(1));
1193 print(" GetLocation(1000): " + AIStation.GetLocation(1000));
1194 print(" GetStationID(33411): " + AIStation.GetStationID(33411));
1195 print(" GetStationID(34411): " + AIStation.GetStationID(34411));
1196 print(" GetStationID(33411): " + AIStation.GetStationID(33411));
1197 print(" HasRoadType(3, TRAM): " + AIStation.HasRoadType(3, AIRoad.ROADTYPE_TRAM));
1198 print(" HasRoadType(3, ROAD): " + AIStation.HasRoadType(3, AIRoad.ROADTYPE_ROAD));
1199 print(" HasRoadType(33411, TRAM): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_TRAM));
1200 print(" HasRoadType(33411, ROAD): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
1201 print(" HasStationType(3, BUS): " + AIStation.HasStationType(3, AIStation.STATION_BUS_STOP));
1202 print(" HasStationType(3, TRAIN): " + AIStation.HasStationType(3, AIStation.STATION_TRAIN));
1204 print(" GetCoverageRadius(BUS): " + AIStation.GetCoverageRadius(AIStation.STATION_BUS_STOP));
1205 print(" GetCoverageRadius(TRUCK): " + AIStation.GetCoverageRadius(AIStation.STATION_TRUCK_STOP));
1206 print(" GetCoverageRadius(TRAIN): " + AIStation.GetCoverageRadius(AIStation.STATION_TRAIN));
1208 print(" GetNearestTown(): " + AIStation.GetNearestTown(0));
1209 print(" GetNearestTown(): " + AIStation.GetNearestTown(10000));
1210 print(" GetNearestTown(): " + AIStation.GetNearestTown(3));
1212 print("");
1213 print("--CargoWaiting--");
1214 for (local cargo = 0; cargo <= 1000; cargo += 1000) {
1215 for (local station0 = 0; station0 <= 1000; station0 += 1000) {
1216 print(" GetCargoWaiting(" + station0 + ", " + cargo + "): " +
1217 AIStation.GetCargoWaiting(station0, cargo));
1218 for (local station1 = 0; station1 <= 1000; station1 += 1000) {
1219 print(" GetCargoWaitingFrom(" + station0 + ", " + station1 + ", " + cargo + "): " +
1220 AIStation.GetCargoWaitingFrom(station0, station1, cargo));
1221 print(" GetCargoWaitingVia(" + station0 + ", " + station1 + ", " + cargo + "): " +
1222 AIStation.GetCargoWaitingFrom(station0, station1, cargo));
1223 for (local station2 = 0; station2 <= 1000; station2 += 1000) {
1224 print(" GetCargoWaitingFromVia(" + station0 + ", " + station1 + ", " + station2 + ", " + cargo + "): " +
1225 AIStation.GetCargoWaitingFromVia(station0, station1, station2, cargo));
1231 print("");
1232 print("--CargoPlanned--");
1233 for (local cargo = 0; cargo <= 1000; cargo += 1000) {
1234 for (local station0 = 0; station0 <= 1000; station0 += 1000) {
1235 print(" GetCargoPlanned(" + station0 + ", " + cargo + "): " +
1236 AIStation.GetCargoPlanned(station0, cargo));
1237 for (local station1 = 0; station1 <= 1000; station1 += 1000) {
1238 print(" GetCargoPlannedFrom(" + station0 + ", " + station1 + ", " + cargo + "): " +
1239 AIStation.GetCargoPlannedFrom(station0, station1, cargo));
1240 print(" GetCargoPlannedVia(" + station0 + ", " + station1 + ", " + cargo + "): " +
1241 AIStation.GetCargoPlannedFrom(station0, station1, cargo));
1242 for (local station2 = 0; station2 <= 1000; station2 += 1000) {
1243 print(" GetCargoPlannedFromVia(" + station0 + ", " + station1 + ", " + station2 + ", " + cargo + "): " +
1244 AIStation.GetCargoPlannedFromVia(station0, station1, station2, cargo));
1251 function Regression::Tile()
1253 print("");
1254 print("--Tile--");
1255 print(" HasTreeOnTile(): " + AITile.HasTreeOnTile(33148));
1256 print(" IsFarmTile(): " + AITile.IsFarmTile(32892));
1257 print(" IsRockTile(): " + AITile.IsRockTile(31606));
1258 print(" IsRoughTile(): " + AITile.IsRoughTile(33674));
1259 print(" HasTreeOnTile(): " + AITile.HasTreeOnTile(33404));
1260 print(" IsFarmTile(): " + AITile.IsFarmTile(33404));
1261 print(" IsRockTile(): " + AITile.IsRockTile(33404));
1262 print(" IsRoughTile(): " + AITile.IsRoughTile(33404));
1263 print(" IsSnowTile(): " + AITile.IsSnowTile(33404));
1264 print(" IsDesertTile(): " + AITile.IsDesertTile(33404));
1265 print(" PlantTree(): " + AITile.PlantTree(33404));
1266 print(" HasTreeOnTile(): " + AITile.HasTreeOnTile(33404));
1267 print(" PlantTree(): " + AITile.PlantTree(33404));
1268 print(" HasTreeOnTile(): " + AITile.HasTreeOnTile(33661));
1269 print(" PlantTreeRectangle(): " + AITile.PlantTreeRectangle(33404, 2, 2));
1270 print(" HasTreeOnTile(): " + AITile.HasTreeOnTile(33661));
1273 function Regression::TileList()
1275 local list = AITileList();
1277 print("");
1278 print("--TileList--");
1279 print(" Count(): " + list.Count());
1280 list.AddRectangle(27631 - 256 * 1, 256 * 1 + 27631 + 2);
1281 print(" Count(): " + list.Count());
1283 list.Valuate(AITile.GetSlope);
1284 print(" Slope(): done");
1285 print(" Count(): " + list.Count());
1286 print(" ListDump:");
1287 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1288 print(" " + i + " => " + list.GetValue(i));
1289 print(" " + i + " => " + AITile.GetComplementSlope(list.GetValue(i)));
1290 print(" " + i + " => " + AITile.IsSteepSlope(list.GetValue(i)));
1291 print(" " + i + " => " + AITile.IsHalftileSlope(list.GetValue(i)));
1293 list.Clear();
1295 print("");
1296 print("--TileList--");
1297 print(" Count(): " + list.Count());
1298 list.AddRectangle(34436, 256 * 2 + 34436 + 8);
1299 print(" Count(): " + list.Count());
1301 list.Valuate(AITile.GetCornerHeight, AITile.CORNER_N);
1302 print(" Height(): done");
1303 print(" Count(): " + list.Count());
1304 print(" ListDump:");
1305 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1306 print(" " + i + " => " + list.GetValue(i));
1309 list.Valuate(AITile.GetCornerHeight, AITile.CORNER_N);
1310 print(" CornerHeight(North): done");
1311 print(" Count(): " + list.Count());
1312 print(" ListDump:");
1313 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1314 print(" " + i + " => " + list.GetValue(i));
1317 list.Valuate(AITile.GetMinHeight);
1318 print(" MinHeight(): done");
1319 print(" Count(): " + list.Count());
1320 print(" ListDump:");
1321 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1322 print(" " + i + " => " + list.GetValue(i));
1325 list.Valuate(AITile.GetMaxHeight);
1326 print(" MaxHeight(): done");
1327 print(" Count(): " + list.Count());
1328 print(" ListDump:");
1329 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1330 print(" " + i + " => " + list.GetValue(i));
1333 list.Valuate(AITile.GetSlope);
1334 list.KeepValue(0);
1335 print(" Slope(): done");
1336 print(" KeepValue(0): done");
1337 print(" Count(): " + list.Count());
1338 print(" ListDump:");
1339 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1340 print(" " + i + " => " + list.GetValue(i));
1343 list.Clear();
1344 list.AddRectangle(41895 - 256 * 2, 256 * 2 + 41895 + 8);
1345 list.Valuate(AITile.IsBuildable);
1346 list.KeepValue(1);
1347 print(" Buildable(): done");
1348 print(" KeepValue(1): done");
1349 print(" Count(): " + list.Count());
1351 list.Valuate(AITile.IsBuildableRectangle, 3, 3);
1352 print(" BuildableRectangle(3, 3) ListDump:");
1353 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1354 print(" " + i + " => " + list.GetValue(i));
1356 list.Valuate(AITile.GetDistanceManhattanToTile, 30000);
1357 print(" DistanceManhattanToTile(30000) ListDump:");
1358 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1359 print(" " + i + " => " + list.GetValue(i));
1361 list.Valuate(AITile.GetDistanceSquareToTile, 30000);
1362 print(" DistanceSquareToTile(30000) ListDump:");
1363 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1364 print(" " + i + " => " + list.GetValue(i));
1367 list.AddRectangle(31895 - 256 * 5, 256 * 5 + 31895 + 8);
1369 list.Valuate(AITile.GetOwner);
1370 print(" GetOwner() ListDump:");
1371 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1372 print(" " + i + " => " + list.GetValue(i));
1374 list.Valuate(AITile.GetTownAuthority);
1375 print(" GetTownAuthority() ListDump:");
1376 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1377 print(" " + i + " => " + list.GetValue(i));
1379 list.Valuate(AITile.GetClosestTown);
1380 print(" GetClosestTown() ListDump:");
1381 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1382 print(" " + i + " => " + list.GetValue(i));
1385 list.Valuate(AITile.GetCargoAcceptance, 0, 1, 1, 3);
1386 list.KeepAboveValue(10);
1387 print(" CargoAcceptance(): done");
1388 print(" KeepAboveValue(10): done");
1389 print(" Count(): " + list.Count());
1390 print(" ListDump:");
1391 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1392 print(" " + i + " => " + list.GetValue(i));
1395 list.Valuate(AIRoad.IsRoadTile);
1396 list.KeepValue(1);
1397 print(" RoadTile(): done");
1398 print(" KeepValue(1): done");
1399 print(" Count(): " + list.Count());
1400 print(" ListDump:");
1401 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1402 print(" " + i + " => " + list.GetValue(i));
1405 list.Valuate(AIRoad.GetNeighbourRoadCount);
1406 list.KeepValue(1);
1407 print(" NeighbourRoadCount():done");
1408 print(" KeepValue(1): done");
1409 print(" Count(): " + list.Count());
1410 print(" ListDump:");
1411 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1412 print(" " + i + " => " + list.GetValue(i));
1415 list.AddRectangle(54421 - 256 * 2, 256 * 2 + 54421 + 8);
1416 list.Valuate(AITile.IsWaterTile);
1417 print(" Water(): done");
1418 print(" Count(): " + list.Count());
1419 print(" ListDump:");
1420 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1421 print(" " + i + " => " + list.GetValue(i));
1424 list = AITileList_IndustryAccepting(0, 3);
1425 print("");
1426 print("--TileList_IndustryAccepting--");
1427 print(" Count(): " + list.Count());
1428 list.Valuate(AITile.GetCargoAcceptance, 3, 1, 1, 3);
1429 print(" Location ListDump:");
1430 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1431 print(" " + i + " => " + list.GetValue(i));
1434 list = AITileList_IndustryProducing(1, 3);
1435 print("");
1436 print("--TileList_IndustryProducing--");
1437 print(" Count(): " + list.Count());
1438 list.Valuate(AITile.GetCargoProduction, 7, 1, 1, 3);
1439 print(" Location ListDump:");
1440 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1441 print(" " + i + " => " + list.GetValue(i));
1444 list = AITileList_StationType(4, AIStation.STATION_BUS_STOP);
1445 print("");
1446 print("--TileList_StationType--");
1447 print(" Count(): " + list.Count());
1448 print(" Location ListDump:");
1449 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1450 print(" " + i + " => " + list.GetValue(i));
1454 function Regression::Town()
1456 local j = 0;
1458 print("");
1459 print("--Town--");
1460 print(" GetTownCount(): " + AITown.GetTownCount());
1461 local list = AITownList();
1462 list.Sort(AIList.SORT_BY_ITEM, AIList.SORT_ASCENDING);
1463 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1464 if (AITown.IsValidTown(i)) j++;
1465 print(" Town " + i);
1466 print(" IsValidTown(): " + AITown.IsValidTown(i));
1467 print(" GetName(): " + AITown.GetName(i));
1468 print(" GetPopulation(): " + AITown.GetPopulation(i));
1469 print(" GetLocation(): " + AITown.GetLocation(i));
1470 print(" GetHouseCount(): " + AITown.GetHouseCount(i));
1471 print(" GetRating(): " + AITown.GetRating(i, AICompany.COMPANY_SELF));
1472 print(" IsCity(): " + AITown.IsCity(i));
1474 print(" Valid Towns: " + j);
1475 print(" GetTownCount(): " + AITown.GetTownCount());
1478 function Regression::TownList()
1480 local list = AITownList();
1482 print("");
1483 print("--TownList--");
1484 print(" Count(): " + list.Count());
1485 list.Valuate(AITown.GetLocation);
1486 print(" Location ListDump:");
1487 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1488 print(" " + i + " => " + list.GetValue(i));
1490 list.Valuate(AITown.GetDistanceManhattanToTile, 30000);
1491 print(" DistanceManhattanToTile(30000) ListDump:");
1492 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1493 print(" " + i + " => " + list.GetValue(i));
1495 list.Valuate(AITown.GetDistanceSquareToTile, 30000);
1496 print(" DistanceSquareToTile(30000) ListDump:");
1497 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1498 print(" " + i + " => " + list.GetValue(i));
1500 list.Valuate(AITown.IsWithinTownInfluence, AITown.GetLocation(0));
1501 print(" IsWithinTownInfluence(" + AITown.GetLocation(0) + ") ListDump:");
1502 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1503 print(" " + i + " => " + list.GetValue(i));
1505 list.Valuate(AITown.GetAllowedNoise);
1506 print(" GetAllowedNoise() ListDump:");
1507 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1508 print(" " + i + " => " + list.GetValue(i));
1510 list.Valuate(AITown.GetPopulation);
1511 list.KeepAboveValue(500);
1512 print(" KeepAboveValue(500): done");
1513 print(" Count(): " + list.Count());
1514 print(" Population ListDump:");
1515 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1516 print(" " + i + " => " + list.GetValue(i));
1519 print(" HasStatue(): " + AITown.HasStatue(list.Begin()));
1520 print(" GetRoadReworkDuration(): " + AITown.GetRoadReworkDuration(list.Begin()));
1521 print(" GetExclusiveRightsCompany(): " + AITown.GetExclusiveRightsCompany(list.Begin()));
1522 print(" GetExclusiveRightsDuration(): " + AITown.GetExclusiveRightsDuration(list.Begin()));
1523 print(" IsActionAvailable(BUILD_STATUE): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
1524 print(" PerformTownAction(BUILD_STATUE): " + AITown.PerformTownAction(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
1525 print(" IsActionAvailable(BUILD_STATUE): " + AITown.IsActionAvailable(list.Begin(), AITown.TOWN_ACTION_BUILD_STATUE));
1526 print(" HasStatue(): " + AITown.HasStatue(list.Begin()));
1529 function Regression::Tunnel()
1531 print("");
1532 print("--Tunnel--");
1533 print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(29050));
1534 print(" RemoveTunnel(): " + AITunnel.RemoveTunnel(29050));
1535 print(" GetOtherTunnelEnd(): " + AITunnel.GetOtherTunnelEnd(29050));
1536 print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VT_ROAD, 29050));
1537 print(" GetOtherTunnelEnd(): " + AITunnel.GetOtherTunnelEnd(29050));
1538 print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(29050));
1539 print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(28026));
1540 print(" RemoveTunnel(): " + AITunnel.RemoveTunnel(29050));
1541 print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(29050));
1543 print(" --Errors--");
1544 print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VT_ROAD, 7529));
1545 print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VT_ROAD, 8043));
1546 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
1547 print(" RemoveTunnel(): " + AITunnel.RemoveTunnel(7529));
1550 function Regression::Vehicle()
1552 local accounting = AIAccounting();
1554 print("");
1555 print("--Vehicle--");
1556 print(" IsValidVehicle(-1): " + AIVehicle.IsValidVehicle(-1));
1557 print(" IsValidVehicle(0): " + AIVehicle.IsValidVehicle(0));
1558 print(" IsValidVehicle(12): " + AIVehicle.IsValidVehicle(12));
1559 print(" ISValidVehicle(9999): " + AIVehicle.IsValidVehicle(9999));
1561 local bank = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
1563 print(" BuildVehicle(): " + AIVehicle.BuildVehicle(33417, 153));
1564 print(" IsValidVehicle(12): " + AIVehicle.IsValidVehicle(12));
1565 print(" CloneVehicle(): " + AIVehicle.CloneVehicle(33417, 12, true));
1567 local bank_after = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
1569 print(" --Accounting--");
1570 print(" GetCosts(): " + accounting.GetCosts());
1571 print(" Should be: " + (bank - bank_after));
1572 print(" ResetCosts(): " + accounting.ResetCosts());
1574 bank = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
1576 print(" SellVehicle(13): " + AIVehicle.SellVehicle(13));
1577 print(" IsInDepot(): " + AIVehicle.IsInDepot(12));
1578 print(" IsStoppedInDepot(): " + AIVehicle.IsStoppedInDepot(12));
1579 print(" StartStopVehicle(): " + AIVehicle.StartStopVehicle(12));
1580 print(" IsInDepot(): " + AIVehicle.IsInDepot(12));
1581 print(" IsStoppedInDepot(): " + AIVehicle.IsStoppedInDepot(12));
1582 print(" SendVehicleToDepot(): " + AIVehicle.SendVehicleToDepot(12));
1583 print(" IsInDepot(): " + AIVehicle.IsInDepot(12));
1584 print(" IsStoppedInDepot(): " + AIVehicle.IsStoppedInDepot(12));
1586 bank_after = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
1588 print(" --Accounting--");
1589 print(" GetCosts(): " + accounting.GetCosts());
1590 print(" Should be: " + (bank - bank_after));
1592 print(" GetName(): " + AIVehicle.GetName(12));
1593 print(" SetName(): " + AIVehicle.SetName(12, "MyVehicleName"));
1594 print(" GetName(): " + AIVehicle.GetName(12));
1595 print(" CloneVehicle(): " + AIVehicle.CloneVehicle(33417, 12, true));
1597 print(" --VehicleData--");
1598 print(" GetLocation(): " + AIVehicle.GetLocation(12));
1599 print(" GetEngineType(): " + AIVehicle.GetEngineType(12));
1600 print(" GetUnitNumber(): " + AIVehicle.GetUnitNumber(12));
1601 print(" GetAge(): " + AIVehicle.GetAge(12));
1602 print(" GetMaxAge(): " + AIVehicle.GetMaxAge(12));
1603 print(" GetAgeLeft(): " + AIVehicle.GetAgeLeft(12));
1604 print(" GetCurrentSpeed(): " + AIVehicle.GetCurrentSpeed(12));
1605 print(" GetRunningCost(): " + AIVehicle.GetRunningCost(12));
1606 print(" GetProfitThisYear(): " + AIVehicle.GetProfitThisYear(12));
1607 print(" GetProfitLastYear(): " + AIVehicle.GetProfitLastYear(12));
1608 print(" GetCurrentValue(): " + AIVehicle.GetCurrentValue(12));
1609 print(" GetVehicleType(): " + AIVehicle.GetVehicleType(12));
1610 print(" GetRoadType(): " + AIVehicle.GetRoadType(12));
1611 print(" GetCapacity(): " + AIVehicle.GetCapacity(12, 10));
1612 print(" GetCargoLoad(): " + AIVehicle.GetCargoLoad(12, 10));
1613 print(" IsInDepot(): " + AIVehicle.IsInDepot(12));
1614 print(" GetNumWagons(): " + AIVehicle.GetNumWagons(12));
1615 print(" GetWagonEngineType(): " + AIVehicle.GetWagonEngineType(12, 0));
1616 print(" GetWagonAge(): " + AIVehicle.GetWagonAge(12, 0));
1617 print(" GetLength(): " + AIVehicle.GetLength(12));
1619 print(" GetOwner(): " + AITile.GetOwner(32119));
1620 print(" BuildVehicle(): " + AIVehicle.BuildVehicle(32119, 219));
1621 print(" IsValidVehicle(14): " + AIVehicle.IsValidVehicle(14));
1622 print(" IsInDepot(14): " + AIVehicle.IsInDepot(14));
1623 print(" IsStoppedInDepot(14): " + AIVehicle.IsStoppedInDepot(14));
1624 print(" IsValidVehicle(15): " + AIVehicle.IsValidVehicle(15));
1625 print(" IsInDepot(15): " + AIVehicle.IsInDepot(15));
1626 print(" IsStoppedInDepot(15): " + AIVehicle.IsStoppedInDepot(15));
1628 print(" BuildVehicle(): " + AIVehicle.BuildVehicle(28479, 204));
1629 print(" IsValidVehicle(16): " + AIVehicle.IsValidVehicle(16));
1630 print(" IsInDepot(16): " + AIVehicle.IsInDepot(16));
1631 print(" IsStoppedInDepot(16): " + AIVehicle.IsStoppedInDepot(16));
1633 print(" BuildRailDepot(): " + AIRail.BuildRailDepot(10008, 10000));
1634 print(" BuildVehicle(): " + AIVehicle.BuildVehicle(10008, 9));
1635 print(" BuildVehicle(): " + AIVehicle.BuildVehicle(10008, 27));
1636 print(" BuildVehicle(): " + AIVehicle.BuildVehicle(10008, 27));
1637 print(" MoveWagonChain(): " + AIVehicle.MoveWagonChain(18, 0, 17, 0));
1638 print(" GetNumWagons(): " + AIVehicle.GetNumWagons(17));
1639 print(" GetLength(): " + AIVehicle.GetLength(17));
1640 print(" GetWagonEngineType(): " + AIVehicle.GetWagonEngineType(17, 0));
1641 print(" GetWagonAge(): " + AIVehicle.GetWagonAge(17, 0));
1642 print(" GetWagonEngineType(): " + AIVehicle.GetWagonEngineType(17, 1));
1643 print(" GetWagonAge(): " + AIVehicle.GetWagonAge(17, 1));
1644 print(" GetWagonEngineType(): " + AIVehicle.GetWagonEngineType(17 2));
1645 print(" GetWagonAge(): " + AIVehicle.GetWagonAge(17, 2));
1646 print(" GetWagonEngineType(): " + AIVehicle.GetWagonEngineType(17 3));
1647 print(" GetWagonAge(): " + AIVehicle.GetWagonAge(17, 3));
1649 print(" --Errors--");
1650 print(" RefitVehicle(): " + AIVehicle.RefitVehicle(12, 0));
1651 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
1652 print(" SellVehicle(): " + AIVehicle.SellVehicle(12));
1653 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
1654 print(" SendVehicleToDepot(): " + AIVehicle.SendVehicleToDepot(13));
1655 print(" GetLastErrorString(): " + AIError.GetLastErrorString());
1657 local list = AIVehicleList();
1659 print("");
1660 print("--VehicleList--");
1661 print(" Count(): " + list.Count());
1662 list.Valuate(AIVehicle.GetLocation);
1663 print(" Location ListDump:");
1664 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1665 print(" " + i + " => " + list.GetValue(i));
1667 list.Valuate(AIVehicle.GetEngineType);
1668 print(" EngineType ListDump:");
1669 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1670 print(" " + i + " => " + list.GetValue(i));
1672 list.Valuate(AIVehicle.GetUnitNumber);
1673 print(" UnitNumber ListDump:");
1674 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1675 print(" " + i + " => " + list.GetValue(i));
1677 list.Valuate(AIVehicle.GetAge);
1678 print(" Age ListDump:");
1679 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1680 print(" " + i + " => " + list.GetValue(i));
1682 list.Valuate(AIVehicle.GetMaxAge);
1683 print(" MaxAge ListDump:");
1684 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1685 print(" " + i + " => " + list.GetValue(i));
1687 list.Valuate(AIVehicle.GetAgeLeft);
1688 print(" AgeLeft ListDump:");
1689 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1690 print(" " + i + " => " + list.GetValue(i));
1692 list.Valuate(AIVehicle.GetCurrentSpeed);
1693 print(" CurrentSpeed ListDump:");
1694 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1695 print(" " + i + " => " + list.GetValue(i));
1697 list.Valuate(AIVehicle.GetRunningCost);
1698 print(" RunningCost ListDump:");
1699 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1700 print(" " + i + " => " + list.GetValue(i));
1702 list.Valuate(AIVehicle.GetProfitThisYear);
1703 print(" ProfitThisYear ListDump:");
1704 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1705 print(" " + i + " => " + list.GetValue(i));
1707 list.Valuate(AIVehicle.GetProfitLastYear);
1708 print(" ProfitLastYear ListDump:");
1709 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1710 print(" " + i + " => " + list.GetValue(i));
1712 list.Valuate(AIVehicle.GetCurrentValue);
1713 print(" CurrentValue ListDump:");
1714 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1715 print(" " + i + " => " + list.GetValue(i));
1717 list.Valuate(AIVehicle.GetVehicleType);
1718 print(" VehicleType ListDump:");
1719 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1720 print(" " + i + " => " + list.GetValue(i));
1722 list.Valuate(AIVehicle.GetRoadType);
1723 print(" RoadType ListDump:");
1724 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1725 print(" " + i + " => " + list.GetValue(i));
1727 list.Valuate(AIVehicle.GetCapacity, 10);
1728 print(" VehicleType ListDump:");
1729 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1730 print(" " + i + " => " + list.GetValue(i));
1732 list.Valuate(AIVehicle.GetCargoLoad, 10);
1733 print(" VehicleType ListDump:");
1734 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
1735 print(" " + i + " => " + list.GetValue(i));
1739 function Regression::PrintSubsidy(subsidy_id)
1741 print(" --Subsidy (" + subsidy_id + ") --");
1742 print(" IsValidSubsidy(): " + AISubsidy.IsValidSubsidy(subsidy_id));
1743 print(" IsAwarded(): " + AISubsidy.IsAwarded(subsidy_id));
1744 print(" GetAwardedTo(): " + AISubsidy.GetAwardedTo(subsidy_id));
1745 print(" GetExpireDate(): " + AISubsidy.GetExpireDate(subsidy_id));
1746 print(" GetSourceType(): " + AISubsidy.GetSourceType(subsidy_id));
1747 print(" GetSourceIndex(): " + AISubsidy.GetSourceIndex(subsidy_id));
1748 print(" GetDestinationType(): " + AISubsidy.GetDestinationType(subsidy_id));
1749 print(" GetDestinationIndex(): " + AISubsidy.GetDestinationIndex(subsidy_id));
1750 print(" GetCargoType(): " + AISubsidy.GetCargoType(subsidy_id));
1753 function Regression::Math()
1755 print("");
1756 print("--Math--");
1757 print(" -2147483648 < -2147483647: " + (-2147483648 < -2147483647));
1758 print(" -2147483648 < -1 : " + (-2147483648 < -1 ));
1759 print(" -2147483648 < 0 : " + (-2147483648 < 0 ));
1760 print(" -2147483648 < 1 : " + (-2147483648 < 1 ));
1761 print(" -2147483648 < 2147483647: " + (-2147483648 < 2147483647));
1763 print(" -2147483647 < -2147483648: " + (-2147483647 < -2147483648));
1764 print(" -1 < -2147483648: " + (-1 < -2147483648));
1765 print(" 0 < -2147483648: " + ( 0 < -2147483648));
1766 print(" 1 < -2147483648: " + ( 1 < -2147483648));
1767 print(" 2147483647 < -2147483648: " + ( 2147483647 < -2147483648));
1769 print(" -1 > 2147483647: " + (-1 > 2147483647));
1770 print(" -1 > 1 : " + (-1 > 1 ));
1771 print(" -1 > 0 : " + (-1 > 0 ));
1772 print(" -1 > -1 : " + (-1 > -1 ));
1773 print(" -1 > -2147483648: " + (-1 > -2147483648));
1775 print(" 1 > 2147483647: " + ( 1 > 2147483647));
1776 print(" 1 > 1 : " + ( 1 > 1 ));
1777 print(" 1 > 0 : " + ( 1 > 0 ));
1778 print(" 1 > -1 : " + ( 1 > -1 ));
1779 print(" 1 > -2147483648: " + ( 1 > -2147483648));
1781 print(" 2147483647 > 2147483646: " + ( 2147483647 > 2147483646));
1782 print(" 2147483647 > 1 : " + ( 2147483647 > 1 ));
1783 print(" 2147483647 > 0 : " + ( 2147483647 > 0 ));
1784 print(" 2147483647 > -1 : " + ( 2147483647 > -1 ));
1785 print(" 2147483647 > -2147483648: " + ( 2147483647 > -2147483648));
1787 print(" 2147483646 > 2147483647: " + ( 2147483646 > 2147483647));
1788 print(" 1 > 2147483647: " + ( 1 > 2147483647));
1789 print(" 0 > 2147483647: " + ( 0 > 2147483647));
1790 print(" -1 > 2147483647: " + (-1 > 2147483647));
1791 print(" -2147483648 > 2147483647: " + (-2147483648 > 2147483647));
1793 print(" 13725 > -2147483648: " + ( 13725 > -2147483648));
1796 function Regression::Start()
1798 this.TestInit();
1799 this.Std();
1800 this.Base();
1801 this.List();
1803 /* Do this first as it gains maximum loan (which is faked to quite a lot). */
1804 this.Company();
1806 this.Airport();
1807 this.Bridge();
1808 this.BridgeList();
1809 this.Cargo();
1810 this.CargoList();
1811 this.Engine();
1812 this.EngineList();
1813 this.Group();
1814 this.Industry();
1815 this.IndustryList();
1816 this.IndustryTypeList();
1817 this.Map();
1818 this.Marine();
1819 this.Prices();
1820 this.Rail();
1821 this.RailTypeList();
1822 this.Road();
1823 this.Sign();
1824 this.Station();
1825 this.Tile();
1826 this.TileList();
1827 this.Town();
1828 this.TownList();
1829 this.Tunnel();
1830 this.Vehicle();
1831 /* Order has to be after Vehicle */
1832 this.Order();
1833 print("");
1834 print(" First Subsidy Test");
1835 PrintSubsidy(0);
1837 while (AIEventController.IsEventWaiting()) {
1838 local e = AIEventController.GetNextEvent();
1839 print(" GetNextEvent: " + (e == null ? "null" : "instance"));
1840 print(" GetEventType: " + e.GetEventType());
1841 switch (e.GetEventType()) {
1842 case AIEvent.ET_SUBSIDY_OFFER: {
1843 local c = AIEventSubsidyOffer.Convert(e);
1844 print(" EventName: SubsidyOffer");
1845 PrintSubsidy(c.GetSubsidyID());
1846 } break;
1848 case AIEvent.ET_VEHICLE_WAITING_IN_DEPOT: {
1849 local c = AIEventVehicleWaitingInDepot.Convert(e);
1850 print(" EventName: VehicleWaitingInDepot");
1851 print(" VehicleID: " + c.GetVehicleID());
1852 } break;
1854 default:
1855 print(" Unknown Event");
1856 break;
1859 print(" IsEventWaiting: false");
1861 this.Math();