bin/ai/regression/regression.nut
branchnoai
changeset 10344 b7e9f5c65e30
parent 10291 11cb78922367
child 10360 3234cb59de55
equal deleted inserted replaced
10343:0ccd326f082e 10344:b7e9f5c65e30
  1174 	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
  1174 	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
  1175 		print("    " + i + " => " + list.GetValue(i));
  1175 		print("    " + i + " => " + list.GetValue(i));
  1176 	}
  1176 	}
  1177 }
  1177 }
  1178 
  1178 
       
  1179 function Regression::PrintSubsidy(subsidy_id)
       
  1180 {
       
  1181 	print("      --Subsidy (" + subsidy_id + ") --");
       
  1182 	print("        IsValidSubsidy():     " + AISubsidy.IsValidSubsidy(subsidy_id));
       
  1183 	print("        IsAwarded():          " + AISubsidy.IsAwarded(subsidy_id));
       
  1184 	print("        GetAwardedTo():       " + AISubsidy.GetAwardedTo(subsidy_id));
       
  1185 	print("        GetExpireDate():      " + AISubsidy.GetExpireDate(subsidy_id));
       
  1186 	print("        SourceIsTown():       " + AISubsidy.SourceIsTown(subsidy_id));
       
  1187 	print("        GetSource():          " + AISubsidy.GetSource(subsidy_id));
       
  1188 	print("        DestionationIsTown(): " + AISubsidy.DestinationIsTown(subsidy_id));
       
  1189 	print("        GetDestionation():    " + AISubsidy.GetDestination(subsidy_id));
       
  1190 	print("        GetCargoType():       " + AISubsidy.GetCargoType(subsidy_id));
       
  1191 }
       
  1192 
  1179 
  1193 
  1180 function Regression::Start()
  1194 function Regression::Start()
  1181 {
  1195 {
  1182 	this.TestInit();
  1196 	this.TestInit();
  1183 	this.Std();
  1197 	this.Std();
  1204 	this.TownList();
  1218 	this.TownList();
  1205 	this.Tunnel();
  1219 	this.Tunnel();
  1206 	this.Vehicle();
  1220 	this.Vehicle();
  1207 	/* Order has to be after Vehicle */
  1221 	/* Order has to be after Vehicle */
  1208 	this.Order();
  1222 	this.Order();
       
  1223 	PrintSubsidy(0);
  1209 
  1224 
  1210 	/* Sleep now, to give time for events to happen */
  1225 	/* Sleep now, to give time for events to happen */
  1211 	Sleep(4000);
  1226 	Sleep(4000);
  1212 
  1227 
  1213 	while (AIEventController.IsEventWaiting()) {
  1228 	while (AIEventController.IsEventWaiting()) {
  1216 		print("    GetEventType:        " + e.GetEventType());
  1231 		print("    GetEventType:        " + e.GetEventType());
  1217 		switch (e.GetEventType()) {
  1232 		switch (e.GetEventType()) {
  1218 			case AIEvent.AI_ET_SUBSIDY_OFFER:
  1233 			case AIEvent.AI_ET_SUBSIDY_OFFER:
  1219 				local c = AIEventSubsidyOffer.Convert(e);
  1234 				local c = AIEventSubsidyOffer.Convert(e);
  1220 				print("      EventName:         SubsidyOffer");
  1235 				print("      EventName:         SubsidyOffer");
  1221 				print("      CargoID:           " + c.GetCargoID());
  1236 				PrintSubsidy(c.GetSubsidyID());
  1222 				print("      GetFromTownID:     " + c.GetFromTownID());
       
  1223 				print("      GetToTownID:       " + c.GetToTownID());
       
  1224 				print("      GetFromIndustryID: " + c.GetFromIndustryID());
       
  1225 				print("      GetToIndustryID:   " + c.GetToIndustryID());
       
  1226 				break;
  1237 				break;
  1227 
  1238 
  1228 			default:
  1239 			default:
  1229 				print("      Unknown Event");
  1240 				print("      Unknown Event");
  1230 				break;
  1241 				break;