(svn r27763) -Update from Eints:
[openttd.git] / bin / ai / regression / tst_stationlist / main.nut
blob60f3e4a4a7bf4fe085cecc0db881e0b9f06f1f0d
1 /* $Id$ */
3 class Regression extends AIController {
4 function Start();
5 };
8 function Regression::StationList()
10 local list = AIStationList(AIStation.STATION_BUS_STOP + AIStation.STATION_TRUCK_STOP);
12 print("");
13 print("--StationList--");
14 print(" Count(): " + list.Count());
15 list.Valuate(AIStation.GetLocation);
16 print(" Location ListDump:");
17 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
18 print(" " + i + " => " + list.GetValue(i));
20 list.Valuate(AIStation.GetCargoWaiting, 0);
21 print(" CargoWaiting(0) ListDump:");
22 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
23 print(" " + i + " => " + list.GetValue(i));
25 list.Valuate(AIStation.GetCargoWaiting, 1);
26 print(" CargoWaiting(1) ListDump:");
27 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
28 print(" " + i + " => " + list.GetValue(i));
32 function Regression::StationList_Cargo()
34 print("");
35 print("--StationList_Cargo--");
37 for (local mode = AIStationList_Cargo.CM_WAITING; mode <= AIStationList_Cargo.CM_PLANNED; ++mode) {
38 print(" " + mode);
39 for (local selector = AIStationList_Cargo.CS_BY_FROM; selector <= AIStationList_Cargo.CS_FROM_BY_VIA ; ++selector) {
40 print(" " + selector);
41 local list = AIStationList_Cargo(mode, selector, 6, 0, 7);
42 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
43 print(" " + i + " => " + list.GetValue(i));
49 function Regression::StationList_CargoPlanned()
51 print("");
52 print("--StationList_CargoPlanned--");
54 for (local selector = AIStationList_Cargo.CS_BY_FROM; selector <= AIStationList_Cargo.CS_FROM_BY_VIA; ++selector) {
55 print(" " + selector);
56 local list = AIStationList_CargoPlanned(selector, 6, 0, 7);
57 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
58 print(" " + i + " => " + list.GetValue(i));
63 function Regression::StationList_CargoPlannedByFrom()
65 print("");
66 print("--StationList_CargoPlannedByFrom--");
67 local list = AIStationList_CargoPlannedByFrom(2, 0);
68 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
69 print(" " + i + " => " + list.GetValue(i));
73 function Regression::StationList_CargoPlannedByVia()
75 print("");
76 print("--StationList_CargoPlannedByVia--");
77 local list = AIStationList_CargoPlannedByVia(2, 0);
78 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
79 print(" " + i + " => " + list.GetValue(i));
83 function Regression::StationList_CargoPlannedViaByFrom()
85 print("");
86 print("--StationList_CargoPlannedViaByFrom--");
87 local list = AIStationList_CargoPlannedViaByFrom(6, 0, 7);
88 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
89 print(" " + i + " => " + list.GetValue(i));
93 function Regression::StationList_CargoPlannedFromByVia()
95 print("");
96 print("--StationList_CargoPlannedFromByVia--");
97 local list = AIStationList_CargoPlannedFromByVia(6, 0, 7);
98 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
99 print(" " + i + " => " + list.GetValue(i));
103 function Regression::StationList_CargoWaiting()
105 print("");
106 print("--StationList_CargoWaiting--");
108 for (local selector = AIStationList_Cargo.CS_BY_FROM; selector <= AIStationList_Cargo.CS_FROM_BY_VIA; ++selector) {
109 print(" " + selector);
110 local list = AIStationList_CargoWaiting(selector, 6, 0, 7);
111 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
112 print(" " + i + " => " + list.GetValue(i));
117 function Regression::StationList_CargoWaitingByFrom()
119 print("");
120 print("--StationList_CargoWaitingByFrom--");
121 local list = AIStationList_CargoWaitingByFrom(2, 0);
122 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
123 print(" " + i + " => " + list.GetValue(i));
127 function Regression::StationList_CargoWaitingByVia()
129 print("");
130 print("--StationList_CargoWaitingByVia--");
131 local list = AIStationList_CargoWaitingByVia(2, 0);
132 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
133 print(" " + i + " => " + list.GetValue(i));
137 function Regression::StationList_CargoWaitingViaByFrom()
139 print("");
140 print("--StationList_CargoWaitingViaByFrom--");
141 local list = AIStationList_CargoWaitingViaByFrom(6, 0, 7);
142 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
143 print(" " + i + " => " + list.GetValue(i));
147 function Regression::StationList_CargoWaitingFromByVia()
149 print("");
150 print("--StationList_CargoWaitingFromByVia--");
151 local list = AIStationList_CargoWaitingFromByVia(2, 0, 2);
152 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
153 print(" " + i + " => " + list.GetValue(i));
157 function Regression::StationList_Vehicle()
159 local list = AIStationList_Vehicle(12);
161 print("");
162 print("--StationList_Vehicle--");
163 print(" Count(): " + list.Count());
164 list.Valuate(AIStation.GetLocation);
165 print(" Location ListDump:");
166 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
167 print(" " + i + " => " + list.GetValue(i));
169 list.Valuate(AIStation.GetCargoWaiting, 0);
170 print(" CargoWaiting(0) ListDump:");
171 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
172 print(" " + i + " => " + list.GetValue(i));
174 list.Valuate(AIStation.GetCargoWaiting, 1);
175 print(" CargoWaiting(1) ListDump:");
176 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
177 print(" " + i + " => " + list.GetValue(i));
179 list.Valuate(AIStation.GetCargoRating, 1);
180 print(" CargoRating(1) ListDump:");
181 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
182 print(" " + i + " => " + list.GetValue(i));
184 list.Valuate(AIStation.GetDistanceManhattanToTile, 30000);
185 print(" DistanceManhattanToTile(30000) ListDump:");
186 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
187 print(" " + i + " => " + list.GetValue(i));
189 list.Valuate(AIStation.GetDistanceSquareToTile, 30000);
190 print(" DistanceSquareToTile(30000) ListDump:");
191 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
192 print(" " + i + " => " + list.GetValue(i));
194 list.Valuate(AIStation.IsWithinTownInfluence, 0);
195 print(" IsWithinTownInfluence(0) ListDump:");
196 for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
197 print(" " + i + " => " + list.GetValue(i));
201 function Regression::Start()
203 StationList();
204 StationList_Cargo();
205 StationList_CargoPlanned();
206 StationList_CargoPlannedByFrom();
207 StationList_CargoPlannedByVia();
208 StationList_CargoPlannedViaByFrom();
209 StationList_CargoPlannedFromByVia();
210 StationList_CargoWaiting();
211 StationList_CargoWaitingByFrom();
212 StationList_CargoWaitingByVia();
213 StationList_CargoWaitingViaByFrom();
214 StationList_CargoWaitingFromByVia();
215 StationList_Vehicle();