(svn r12414) [NoAI] -Fix r12411: make WrightAI to work again with new Valuator system noai
authortruebrain
Tue, 25 Mar 2008 12:29:07 +0000
branchnoai
changeset 9817 9a3ad56463aa
parent 9816 35e866676c00
child 9818 024b90a58a20
(svn r12414) [NoAI] -Fix r12411: make WrightAI to work again with new Valuator system
bin/ai/wrightai/main.nut
--- a/bin/ai/wrightai/main.nut	Tue Mar 25 12:20:42 2008 +0000
+++ b/bin/ai/wrightai/main.nut	Tue Mar 25 12:29:07 2008 +0000
@@ -104,13 +104,13 @@
 
 	/* When bank balance < 300000, buy cheaper planes */
 	local balance = AICompany.GetBankBalance(AICompany.MY_COMPANY);
-	engine_list.Valuate(AIEngineList_vPrice());
+	engine_list.Valuate(AIEngine.GetPrice);
 	engine_list.KeepBelowValue(balance < 300000 ? 50000 : (balance < 1000000 ? 300000 : 1000000));
 
-	engine_list.Valuate(AIEngineList_vCargoType())
+	engine_list.Valuate(AIEngine.GetCargoType)
 	engine_list.KeepValue(0); // passengers
 
-	engine_list.Valuate(AIEngineList_vCapacity())
+	engine_list.Valuate(AIEngine.GetCapacity)
 	engine_list.KeepTop(1);
 
 	engine = engine_list.Begin();
@@ -153,11 +153,11 @@
 	/* Remove all the towns we already used */
 	town_list.RemoveList(this.towns_used);
 
-	town_list.Valuate(AITownList_vPopulation());
+	town_list.Valuate(AITown.GetPopulation);
 	town_list.KeepAboveValue(500);
 	/* Keep the best 10, if we can't find 2 stations in there, just leave it anyway */
 	town_list.KeepTop(10);
-	town_list.Valuate(AIList_vRandomize());
+	town_list.Valuate(AIBase.RandItem);
 
 	/* Now find 2 suitable towns */
 	for (local town = town_list.Begin(); town_list.HasNext(); town = town_list.Next()) {
@@ -170,15 +170,15 @@
 		local list = AITileList();
 		/* XXX -- We assume we are more than 15 tiles away from the border! */
 		list.AddRectangle(tile - AIMap.GetTileIndex(15, 15), tile + AIMap.GetTileIndex(15, 15));
-		list.Valuate(AITileList_vBuildableRectangle(airport_x, airport_y));
+		list.Valuate(AITile.IsBuildableRectangle, airport_x, airport_y);
 		list.KeepValue(1);
 		if (center_tile != 0) {
 			/* If we have a tile defined, we don't want to be within 25 tiles of this tile */
-			list.Valuate(AITileList_vDistanceSquareToTile(center_tile));
+			list.Valuate(AITile.GetDistanceSquareToTile, center_tile);
 			list.KeepAboveValue(625);
 		}
 		/* Sort on acceptance, remove places that don't have acceptance */
-		list.Valuate(AITileList_vCargoAcceptance(0, airport_x, airport_y, airport_rad));
+		list.Valuate(AITile.GetCargoAcceptance, 0, airport_x, airport_y, airport_rad);
 		list.RemoveBelowValue(10);
 
 		/* Couldn't find a suitable place for this town, skip to the next */
@@ -214,10 +214,10 @@
 function WrightAI::ManageAirRoutes()
 {
 	local list = AIVehicleList();
-	list.Valuate(AIVehicleList_vAge());
+	list.Valuate(AIVehicle.GetAge);
 	/* Give the plane at least 2 years to make a difference */
 	list.KeepAboveValue(365 * 2);
-	list.Valuate(AIVehicleList_vProfitLastYear());
+	list.Valuate(AIVehicle.GetProfitLastYear);
 
 	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
 		local profit = list.GetValue(i);
@@ -246,7 +246,7 @@
 	if (!this.HasMoney(50000)) return;
 
 	list = AIStationList(AIStation.STATION_AIRPORT);
-	list.Valuate(AIStationList_vCargoWaiting(0));
+	list.Valuate(AIStation.GetCargoWaiting, 0);
 	list.KeepAboveValue(250);
 
 	for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
@@ -261,7 +261,7 @@
 		local v = list2.Begin();
 		local dist = this.distance_of_route.rawget(v);
 
-		list2.Valuate(AIVehicleList_vAge());
+		list2.Valuate(AIVehicle.GetAge);
 		list2.KeepBelowValue(dist);
 		/* Do not build a new vehicle if we bought a new one in the last DISTANCE days */
 		if (list2.Count() != 0) continue;