summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-29 23:56:42 +0000
committeryexo <yexo@openttd.org>2010-01-29 23:56:42 +0000
commit15016e3511b075e999cdb0db45936d5e6b223aa4 (patch)
treed053d2759a7c64b76e429d0367216567ec051534 /bin
parent54f958c8e5c99804d1e46c2fe6b3b5ef5cae3db6 (diff)
downloadopenttd-15016e3511b075e999cdb0db45936d5e6b223aa4.tar.xz
(svn r18955) -Feature: [NoAI] introduce GetBuildCost functions in several classes to get easier cost estimations before you start building
Diffstat (limited to 'bin')
-rw-r--r--bin/ai/regression/regression.nut40
-rw-r--r--bin/ai/regression/regression.txt35
2 files changed, 75 insertions, 0 deletions
diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut
index 8af065abf..763cc698d 100644
--- a/bin/ai/regression/regression.nut
+++ b/bin/ai/regression/regression.nut
@@ -504,6 +504,45 @@ function Regression::EngineList()
}
}
+function Regression::Prices()
+{
+ print("");
+ print("--Prices--");
+ print(" -Rail-");
+ print(" 0,BT_TRACK: " + AIRail.GetBuildCost(0, AIRail.BT_TRACK));
+ print(" 0,BT_SIGNAL: " + AIRail.GetBuildCost(0, AIRail.BT_SIGNAL));
+ print(" 0,BT_DEPOT: " + AIRail.GetBuildCost(0, AIRail.BT_DEPOT));
+ print(" 0,BT_STATION: " + AIRail.GetBuildCost(0, AIRail.BT_STATION));
+ print(" 0,BT_WAYPOINT: " + AIRail.GetBuildCost(0, AIRail.BT_WAYPOINT));
+ print(" 1,BT_TRACK: " + AIRail.GetBuildCost(1, AIRail.BT_TRACK));
+ print(" 1,BT_SIGNAL: " + AIRail.GetBuildCost(1, AIRail.BT_SIGNAL));
+ print(" 1,BT_DEPOT: " + AIRail.GetBuildCost(1, AIRail.BT_DEPOT));
+ print(" 1,BT_STATION: " + AIRail.GetBuildCost(1, AIRail.BT_STATION));
+ print(" 1,BT_WAYPOINT: " + AIRail.GetBuildCost(1, AIRail.BT_WAYPOINT));
+ print(" -Road-");
+ print(" ROADTYPE_ROAD,BT_ROAD: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_ROAD));
+ print(" ROADTYPE_ROAD,BT_DEPOT: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_DEPOT));
+ print(" ROADTYPE_ROAD,BT_BUS_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_BUS_STOP));
+ print(" ROADTYPE_ROAD,BT_TRUCK_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_ROAD, AIRoad.BT_TRUCK_STOP));
+ print(" ROADTYPE_TRAM,BT_ROAD: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_ROAD));
+ print(" ROADTYPE_TRAM,BT_DEPOT: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_DEPOT));
+ print(" ROADTYPE_TRAM,BT_BUS_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_BUS_STOP));
+ print(" ROADTYPE_TRAM,BT_TRUCK_STOP: " + AIRoad.GetBuildCost(AIRoad.ROADTYPE_TRAM, AIRoad.BT_TRUCK_STOP));
+ print(" -Water-");
+ print(" BT_DOCK: " + AIMarine.GetBuildCost(AIMarine.BT_DOCK));
+ print(" BT_DEPOT: " + AIMarine.GetBuildCost(AIMarine.BT_DEPOT));
+ print(" BT_BUOY: " + AIMarine.GetBuildCost(AIMarine.BT_BUOY));
+ print(" -Tile-");
+ print(" BT_FOUNDATION: " + AITile.GetBuildCost(AITile.BT_FOUNDATION));
+ print(" BT_TERRAFORM: " + AITile.GetBuildCost(AITile.BT_TERRAFORM));
+ print(" BT_BUILD_TREES: " + AITile.GetBuildCost(AITile.BT_BUILD_TREES));
+ print(" BT_CLEAR_GRASS: " + AITile.GetBuildCost(AITile.BT_CLEAR_GRASS));
+ print(" BT_CLEAR_ROUGH: " + AITile.GetBuildCost(AITile.BT_CLEAR_ROUGH));
+ print(" BT_CLEAR_ROCKY: " + AITile.GetBuildCost(AITile.BT_CLEAR_ROCKY));
+ print(" BT_CLEAR_FIELDS: " + AITile.GetBuildCost(AITile.BT_CLEAR_FIELDS));
+ print(" BT_CLEAR_HOUSE: " + AITile.GetBuildCost(AITile.BT_CLEAR_HOUSE));
+}
+
function cost_callback(old_path, new_tile, new_direction, self) { if (old_path == null) return 0; return old_path.GetCost() + 1; }
function estimate_callback(tile, direction, goals, self) { return goals[0] - tile; }
function neighbours_callback(path, cur_tile, self) { return [[cur_tile + 1, 1]]; }
@@ -1699,6 +1738,7 @@ function Regression::Start()
this.IndustryTypeList();
this.Map();
this.Marine();
+ this.Prices();
this.Rail();
this.RailTypeList();
this.Road();
diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt
index ab547d3b3..ae8d8e175 100644
--- a/bin/ai/regression/regression.txt
+++ b/bin/ai/regression/regression.txt
@@ -7121,6 +7121,41 @@
BuildWaterDepot(): true
BuildDock(): true
+--Prices--
+ -Rail-
+ 0,BT_TRACK: 75
+ 0,BT_SIGNAL: 48
+ 0,BT_DEPOT: 450
+ 0,BT_STATION: 285
+ 0,BT_WAYPOINT: 450
+ 1,BT_TRACK: -1
+ 1,BT_SIGNAL: -1
+ 1,BT_DEPOT: -1
+ 1,BT_STATION: -1
+ 1,BT_WAYPOINT: -1
+ -Road-
+ ROADTYPE_ROAD,BT_ROAD: 71
+ ROADTYPE_ROAD,BT_DEPOT: 375
+ ROADTYPE_ROAD,BT_BUS_STOP: 150
+ ROADTYPE_ROAD,BT_TRUCK_STOP: 150
+ ROADTYPE_TRAM,BT_ROAD: -1
+ ROADTYPE_TRAM,BT_DEPOT: -1
+ ROADTYPE_TRAM,BT_BUS_STOP: -1
+ ROADTYPE_TRAM,BT_TRUCK_STOP: -1
+ -Water-
+ BT_DOCK: 262
+ BT_DEPOT: 525
+ BT_BUOY: 262
+ -Tile-
+ BT_FOUNDATION: 187
+ BT_TERRAFORM: 187
+ BT_BUILD_TREES: 15
+ BT_CLEAR_GRASS: 15
+ BT_CLEAR_ROUGH: 30
+ BT_CLEAR_ROCKY: 150
+ BT_CLEAR_FIELDS: 375
+ BT_CLEAR_HOUSE: 1200
+
--Rail--
IsRailTile(): false
BuildRailTrack(): true