(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight noai
authortruelight
Wed, 18 Jul 2007 09:20:50 +0000
branchnoai
changeset 9670 820b77e19bb3
parent 9669 366771e15a2c
child 9671 ad29df0de918
(svn r10609) [NoAI] -Add: added GetAirportWidth / GetAirportHeight
[NoAI] -Add: added GetCoverageRadius / GetAirportCoverageRadius
[NoAI] -Fix: AiportAvailable was bugged, returned always true for AT_SMALL
[NoAI] -Change: improved WrightAI to work from 1950 (based on above functions)
bin/ai/regression/regression.nut
bin/ai/regression/regression.txt
bin/ai/wrightai/main.nut
src/ai/api/ai_airport.cpp
src/ai/api/ai_airport.hpp
src/ai/api/ai_airport.hpp.sq
src/ai/api/ai_station.cpp
src/ai/api/ai_station.hpp
src/ai/api/ai_station.hpp.sq
src/ai/api/ai_stationlist.cpp
src/ai/api/ai_stationlist.hpp
src/ai/api/ai_stationlist.hpp.sq
--- a/bin/ai/regression/regression.nut	Wed Jul 18 08:38:50 2007 +0000
+++ b/bin/ai/regression/regression.nut	Wed Jul 18 09:20:50 2007 +0000
@@ -68,7 +68,10 @@
 	print("  GetHangarOfAirport(): " + airport.GetHangarOfAirport(32116));
 
 	for (local i = -1; i < 10; i++) {
-		print("  AiportAvailable(" + i + "):   " + airport.AiportAvailable(i));
+		print("  AiportAvailable(" + i + "):          " + airport.AiportAvailable(i));
+		print("  GetAirportWidth(" + i + "):          " + airport.GetAirportWidth(i));
+		print("  GetAirportHeight(" + i + "):         " + airport.GetAirportHeight(i));
+		print("  GetAirportCoverageRadius(" + i + "): " + airport.GetAirportCoverageRadius(i));
 	}
 
 	print("  GetBankBalance():     " + company.GetBankBalance(AICompany.MY_COMPANY));
@@ -500,7 +503,11 @@
 	print("  GetCargoWaiting(1000, 0): " + station.GetCargoWaiting(1000, 0));
 	print("  GetCargoWaiting(0, 1000): " + station.GetCargoWaiting(0, 1000));
 
-	local list = AIStationList(AIStationList.STATION_BUS_STOP + AIStationList.STATION_TRUCK_STOP);
+	print("  GetCoverageRadius(bus):   " + station.GetCoverageRadius(AIStation.STATION_BUS_STOP));
+	print("  GetCoverageRadius(truck): " + station.GetCoverageRadius(AIStation.STATION_TRUCK_STOP));
+	print("  GetCoverageRadius(train): " + station.GetCoverageRadius(AIStation.STATION_TRAIN));
+
+	local list = AIStationList(AIStation.STATION_BUS_STOP + AIStation.STATION_TRUCK_STOP);
 
 	print("");
 	print("--StationList--");
--- a/bin/ai/regression/regression.txt	Wed Jul 18 08:38:50 2007 +0000
+++ b/bin/ai/regression/regression.txt	Wed Jul 18 09:20:50 2007 +0000
@@ -32,17 +32,50 @@
   IsHangarTile():       false
   IsAirportTile():      false
   GetHangarOfAirport(): -1
-  AiportAvailable(-1):   false
-  AiportAvailable(0):   true
-  AiportAvailable(1):   false
-  AiportAvailable(2):   false
-  AiportAvailable(3):   false
-  AiportAvailable(4):   false
-  AiportAvailable(5):   false
-  AiportAvailable(6):   false
-  AiportAvailable(7):   false
-  AiportAvailable(8):   false
-  AiportAvailable(9):   false
+  AiportAvailable(-1):          false
+  GetAirportWidth(-1):          0
+  GetAirportHeight(-1):         0
+  GetAirportCoverageRadius(-1): 0
+  AiportAvailable(0):          true
+  GetAirportWidth(0):          4
+  GetAirportHeight(0):         3
+  GetAirportCoverageRadius(0): 4
+  AiportAvailable(1):          false
+  GetAirportWidth(1):          6
+  GetAirportHeight(1):         6
+  GetAirportCoverageRadius(1): 5
+  AiportAvailable(2):          false
+  GetAirportWidth(2):          1
+  GetAirportHeight(2):         1
+  GetAirportCoverageRadius(2): 4
+  AiportAvailable(3):          false
+  GetAirportWidth(3):          6
+  GetAirportHeight(3):         6
+  GetAirportCoverageRadius(3): 6
+  AiportAvailable(4):          false
+  GetAirportWidth(4):          7
+  GetAirportHeight(4):         7
+  GetAirportCoverageRadius(4): 8
+  AiportAvailable(5):          false
+  GetAirportWidth(5):          5
+  GetAirportHeight(5):         4
+  GetAirportCoverageRadius(5): 4
+  AiportAvailable(6):          false
+  GetAirportWidth(6):          2
+  GetAirportHeight(6):         2
+  GetAirportCoverageRadius(6): 4
+  AiportAvailable(7):          false
+  GetAirportWidth(7):          9
+  GetAirportHeight(7):         11
+  GetAirportCoverageRadius(7): 10
+  AiportAvailable(8):          false
+  GetAirportWidth(8):          4
+  GetAirportHeight(8):         2
+  GetAirportCoverageRadius(8): 4
+  AiportAvailable(9):          false
+  GetAirportWidth(9):          0
+  GetAirportHeight(9):         0
+  GetAirportCoverageRadius(9): 0
   GetBankBalance():     100000
   BuildAirport():       true
   IsHangarTile():       false
@@ -1110,6 +1143,9 @@
   GetCargoWaiting(0, 0):    0
   GetCargoWaiting(1000, 0): -1
   GetCargoWaiting(0, 1000): -1
+  GetCoverageRadius(bus):   3
+  GetCoverageRadius(truck): 3
+  GetCoverageRadius(train): 4
 
 --StationList--
   Count():             2
--- a/bin/ai/wrightai/main.nut	Wed Jul 18 08:38:50 2007 +0000
+++ b/bin/ai/wrightai/main.nut	Wed Jul 18 09:20:50 2007 +0000
@@ -62,27 +62,26 @@
  */
 function WrightAI::BuildAirportRoute()
 {
+	local airport_type = (AIAirport.AiportAvailable(AIAirport.AT_SMALL) ? AIAirport.AT_SMALL : AIAirport.AT_LARGE);
+
 	/* Get enough money to work with */
 	this.GetMoney(150000);
 
 	print(this.name + ": [INFO] Trying to build an airport route");
-	local limit = 2500;
-	local tile_1 = -1;
-	local tile_2 = -1;
 
-	tile_1 = this.FindSuitableAirportSpot(0);
+	local tile_1 = this.FindSuitableAirportSpot(airport_type, 0);
 	if (tile_1 < 0) return -1;
-	tile_2 = this.FindSuitableAirportSpot(tile_1);
+	local tile_2 = this.FindSuitableAirportSpot(airport_type, tile_1);
 	/* XXX -- If tile_2 isn't found, tile_1 town is added to used list, but never really used */
 	if (tile_2 < 0) return -2;
 
 	/* Build the airports for real */
-	if (!this.airport.BuildAirport(tile_1, AIAirport.AT_LARGE)) {
+	if (!this.airport.BuildAirport(tile_1, airport_type)) {
 		print(this.name + ": [ERROR] Although the testing told us we could build 2 airports, it still failed on the first airport at tile " + tile_1 + ".");
 		/* XXX -- We should free the towns again for an other day */
 		return -3;
 	}
-	if (!this.airport.BuildAirport(tile_2, AIAirport.AT_LARGE)) {
+	if (!this.airport.BuildAirport(tile_2, airport_type)) {
 		print(this.name + ": [ERROR] Although the testing told us we could build 2 airports, it still failed on the second airport at tile " + tile_2 + ".");
 		this.airport.RemoveAirport(tile_1);
 		/* XXX -- We should free the towns again for an other day */
@@ -137,8 +136,14 @@
  * Find a suitable spot for an airport, walking all towns hoping to find one.
  *  When a town is used, it is marked as such and not re-used.
  */
-function WrightAI::FindSuitableAirportSpot(center_tile)
+function WrightAI::FindSuitableAirportSpot(airport_type, center_tile)
 {
+	local airport_x, airport_y, airport_rad;
+
+	airport_x = AIAirport.GetAirportWidth(airport_type);
+	airport_y = AIAirport.GetAirportHeight(airport_type);
+	airport_rad = AIAirport.GetAirportCoverageRadius(airport_type);
+
 	local town_list = AITownList();
 	/* Remove all the towns we already used */
 	town_list.RemoveList(this.towns_used);
@@ -160,7 +165,7 @@
 		local list = AITileList();
 		/* XXX -- We assume we are more than 15 tiles away from the border! */
 		list.AddRectangle(tile - this.map.GetTileIndex(15, 15), tile + this.map.GetTileIndex(15, 15));
-		list.Valuate(AITileListBuildableRectangle(6, 6));
+		list.Valuate(AITileListBuildableRectangle(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 */
@@ -168,7 +173,7 @@
 			list.KeepAboveValue(625);
 		}
 		/* Sort on acceptance, remove places that don't have acceptance */
-		list.Valuate(AITileListCargoAcceptance(0, 6, 6, 4));
+		list.Valuate(AITileListCargoAcceptance(0, airport_x, airport_y, airport_rad));
 		list.RemoveBelowValue(10);
 
 		/* Couldn't find a suitable place for this town, skip to the next */
@@ -180,7 +185,7 @@
 
 			for (tile = list.Begin(); list.HasNext(); tile = list.Next()) {
 				Sleep(1);
-				if (!this.airport.BuildAirport(tile, AIAirport.AT_LARGE)) continue;
+				if (!this.airport.BuildAirport(tile, airport_type)) continue;
 				good_tile = tile;
 				break;
 			}
--- a/src/ai/api/ai_airport.cpp	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_airport.cpp	Wed Jul 18 09:20:50 2007 +0000
@@ -2,10 +2,11 @@
 
 #include "ai_airport.hpp"
 #include "../../command.h"
+#include "../../variables.h"
 #include "../../station_map.h"
 
 
-bool AIAirport::IsHangarTile(TileIndex tile)
+/* static */ bool AIAirport::IsHangarTile(TileIndex tile)
 {
 	/* Outside of the map */
 	if (tile >= ::MapSize()) return false;
@@ -13,7 +14,7 @@
 	return ::IsTileType(tile, MP_STATION) && ::IsHangar(tile);
 }
 
-bool AIAirport::IsAirportTile(TileIndex tile)
+/* static */ bool AIAirport::IsAirportTile(TileIndex tile)
 {
 	/* Outside of the map */
 	if (tile >= ::MapSize()) return false;
@@ -21,18 +22,35 @@
 	return ::IsTileType(tile, MP_STATION) && ::IsAirport(tile);
 }
 
-bool AIAirport::AiportAvailable(AirportType type)
+/* static */ bool AIAirport::AiportAvailable(AirportType type)
 {
-	/* Small airport is always available */
-	if (type == AT_SMALL) return true;
-	/* The rest has to be looked up */
+	if (type > AT_HELISTATION) return 0;
 	return HASBIT(::GetValidAirports(), type);
 }
 
+/* static */ int32 AIAirport::GetAirportWidth(AirportType type)
+{
+	if (type > AT_HELISTATION) return 0;
+	return GetAirport(type)->size_x;
+}
+
+/* static */ int32 AIAirport::GetAirportHeight(AirportType type)
+{
+	if (type > AT_HELISTATION) return 0;
+	return GetAirport(type)->size_y;
+}
+
+/* static */ int32 AIAirport::GetAirportCoverageRadius(AirportType type)
+{
+	if (type > AT_HELISTATION) return 0;
+	return _patches.modified_catchment ? GetAirport(type)->catchment : 4;
+}
+
 bool AIAirport::BuildAirport(TileIndex tile, AirportType type)
 {
 	/* Outside of the map */
 	if (tile >= ::MapSize()) return false;
+	if (type > AT_HELISTATION) return 0;
 
 	return this->DoCommand(tile, type, 0, CMD_BUILD_AIRPORT);
 }
--- a/src/ai/api/ai_airport.hpp	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_airport.hpp	Wed Jul 18 09:20:50 2007 +0000
@@ -38,7 +38,7 @@
 	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @return true if and only if the tile has a hangar.
 	 */
-	bool IsHangarTile(TileIndex tile);
+	static bool IsHangarTile(TileIndex tile);
 
 	/**
 	 * Checks whether the given tile is actually a tile with a airport.
@@ -46,13 +46,34 @@
 	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @return true if and only if the tile has a airport.
 	 */
-	bool IsAirportTile(TileIndex tile);
+	static bool IsAirportTile(TileIndex tile);
 
 	/**
 	 * Check if a certain airport type is already available.
 	 * @param type the type of airport to check.
 	 */
-	bool AiportAvailable(AirportType type);
+	static bool AiportAvailable(AirportType type);
+
+	/**
+	 * Get the width of this type of airport.
+	 * @param type the type of airport.
+	 * @return the width in tiles.
+	 */
+	static int32 GetAirportWidth(AirportType type);
+
+	/**
+	 * Get the height of this type of airport.
+	 * @param type the type of airport.
+	 * @return the height in tiles.
+	 */
+	static int32 GetAirportHeight(AirportType type);
+
+	/**
+	 * Get the coverage radius of this type of airport.
+	 * @param type the type of airport.
+	 * @return the radius in tiles.
+	 */
+	static int32 GetAirportCoverageRadius(AirportType type);
 
 	/**
 	 * Builds a airport with tile at the topleft corner.
--- a/src/ai/api/ai_airport.hpp.sq	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_airport.hpp.sq	Wed Jul 18 09:20:50 2007 +0000
@@ -27,11 +27,14 @@
 	SQAIAirport.DefSQConst(engine, AIAirport::AT_INTERCON,      "AT_INTERCON");
 	SQAIAirport.DefSQConst(engine, AIAirport::AT_HELISTATION,   "AT_HELISTATION");
 
-	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetClassName, "GetClassName", 1, "x");
+	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetClassName,             "GetClassName",             1, "x");
+	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsHangarTile,             "IsHangarTile",             2, "xi");
+	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportTile,            "IsAirportTile",            2, "xi");
+	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::AiportAvailable,          "AiportAvailable",          2, "xi");
+	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth,          "GetAirportWidth",          2, "xi");
+	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportHeight,         "GetAirportHeight",         2, "xi");
+	SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportCoverageRadius, "GetAirportCoverageRadius", 2, "xi");
 
-	SQAIAirport.DefSQMethod(engine, &AIAirport::IsHangarTile,       "IsHangarTile",       2, "xi");
-	SQAIAirport.DefSQMethod(engine, &AIAirport::IsAirportTile,      "IsAirportTile",      2, "xi");
-	SQAIAirport.DefSQMethod(engine, &AIAirport::AiportAvailable,    "AiportAvailable",    2, "xi");
 	SQAIAirport.DefSQMethod(engine, &AIAirport::BuildAirport,       "BuildAirport",       3, "xii");
 	SQAIAirport.DefSQMethod(engine, &AIAirport::RemoveAirport,      "RemoveAirport",      2, "xi");
 	SQAIAirport.DefSQMethod(engine, &AIAirport::GetHangarOfAirport, "GetHangarOfAirport", 2, "xi");
--- a/src/ai/api/ai_station.cpp	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_station.cpp	Wed Jul 18 09:20:50 2007 +0000
@@ -4,8 +4,10 @@
 
 #include "ai_station.hpp"
 #include "ai_cargo.hpp"
+#include "../../debug.h"
 #include "../../station.h"
 #include "../../station_map.h"
+#include "../../variables.h"
 
 /* static */ bool AIStation::IsValidStation(StationID station_id)
 {
@@ -40,3 +42,20 @@
 
 	return ::GetStation(station_id)->goods[cargo_id].rating * 101 >> 8;
 }
+
+/* static */ int32 AIStation::GetCoverageRadius(AIStation::StationType type)
+{
+	if (type == STATION_AIRPORT) {
+		DEBUG(ai, 0, "GetCoverageRadius(): coverage radius of airports needs to be requested via AIAirport::GetAirportCoverageRadius(), as it requires AirportType");
+		return 0;
+	}
+	if (!_patches.modified_catchment) return 3;
+
+	switch (type) {
+		case STATION_TRAIN:      return CA_TRAIN;
+		case STATION_TRUCK_STOP: return CA_TRUCK;
+		case STATION_BUS_STOP:   return CA_BUS;
+		case STATION_DOCK:       return CA_DOCK;
+		default:                 return CA_NONE;
+	}
+}
--- a/src/ai/api/ai_station.hpp	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_station.hpp	Wed Jul 18 09:20:50 2007 +0000
@@ -13,6 +13,18 @@
 class AIStation : public AIObject {
 public:
 	/**
+	 * Type of stations known in the game.
+	 */
+	enum StationType {
+		STATION_ANY        = 0x00,
+		STATION_TRAIN      = 0x01,
+		STATION_TRUCK_STOP = 0x02,
+		STATION_BUS_STOP   = 0x04,
+		STATION_AIRPORT    = 0x08,
+		STATION_DOCK       = 0x10,
+	};
+
+	/**
 	 * The name of the class, needed by several sub-processes.
 	 */
 	static const char *GetClassName() { return "AIStation"; }
@@ -59,6 +71,14 @@
 	 * @return the rating in percent of the cargo on the station.
 	 */
 	static int32 GetCargoRating(StationID station_id, CargoID cargo_id);
+
+	/**
+	 * Get the coverage radius of this type of station.
+	 * @param type the type of station.
+	 * @return the radius in tiles.
+	 */
+	static int32 GetCoverageRadius(AIStation::StationType type);
 };
+DECLARE_ENUM_AS_BIT_SET(AIStation::StationType);
 
 #endif /* AI_STATION_HPP */
--- a/src/ai/api/ai_station.hpp.sq	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_station.hpp.sq	Wed Jul 18 09:20:50 2007 +0000
@@ -1,6 +1,10 @@
 #include "ai_station.hpp"
 
 namespace SQConvert {
+	/* Allow enums to be used as Squirrel parameters */
+	template <> AIStation::StationType GetParam(ForceType<AIStation::StationType>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStation::StationType)tmp; }
+	template <> int Return<AIStation::StationType>(HSQUIRRELVM vm, AIStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; }
+
 	/* Allow AIStation to be used as Squirrel parameter */
 	template <> AIStation *GetParam(ForceType<AIStation *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStation *)instance; }
 	template <> AIStation &GetParam(ForceType<AIStation &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStation *)instance; }
@@ -13,12 +17,20 @@
 	SQAIStation.PreRegister(engine);
 	SQAIStation.AddConstructor<void (AIStation::*)(), 1>(engine, "x");
 
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetClassName,    "GetClassName",    1, "x");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::IsValidStation,  "IsValidStation",  2, "xi");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetStationID,    "GetStationID",    2, "xi");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetLocation,     "GetLocation",     2, "xi");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoWaiting, "GetCargoWaiting", 3, "xii");
-	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoRating,  "GetCargoRating",  3, "xii");
+	SQAIStation.DefSQConst(engine, AIStation::STATION_ANY,        "STATION_ANY");
+	SQAIStation.DefSQConst(engine, AIStation::STATION_TRAIN,      "STATION_TRAIN");
+	SQAIStation.DefSQConst(engine, AIStation::STATION_TRUCK_STOP, "STATION_TRUCK_STOP");
+	SQAIStation.DefSQConst(engine, AIStation::STATION_BUS_STOP,   "STATION_BUS_STOP");
+	SQAIStation.DefSQConst(engine, AIStation::STATION_AIRPORT,    "STATION_AIRPORT");
+	SQAIStation.DefSQConst(engine, AIStation::STATION_DOCK,       "STATION_DOCK");
+
+	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetClassName,      "GetClassName",      1, "x");
+	SQAIStation.DefSQStaticMethod(engine, &AIStation::IsValidStation,    "IsValidStation",    2, "xi");
+	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetStationID,      "GetStationID",      2, "xi");
+	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetLocation,       "GetLocation",       2, "xi");
+	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoWaiting,   "GetCargoWaiting",   3, "xii");
+	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoRating,    "GetCargoRating",    3, "xii");
+	SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCoverageRadius, "GetCoverageRadius", 2, "xi");
 
 	SQAIStation.PostRegister(engine);
 }
--- a/src/ai/api/ai_stationlist.cpp	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_stationlist.cpp	Wed Jul 18 09:20:50 2007 +0000
@@ -7,11 +7,11 @@
 #include "../../order.h"
 #include "../../vehicle.h"
 
-AIStationList::AIStationList(AIStationList::StationType type)
+AIStationList::AIStationList(AIStation::StationType type)
 {
 	Station *st;
 	FOR_ALL_STATIONS(st) {
-		if (st->owner == _current_player && (type == AIStationList::STATION_ANY || (st->facilities & type) != 0)) this->AddItem(st->index);
+		if (st->owner == _current_player && (type == AIStation::STATION_ANY || (st->facilities & type) != 0)) this->AddItem(st->index);
 	}
 }
 
--- a/src/ai/api/ai_stationlist.hpp	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_stationlist.hpp	Wed Jul 18 09:20:50 2007 +0000
@@ -6,6 +6,7 @@
 #define AI_STATIONLIST_HPP
 
 #include "ai_abstractlist.hpp"
+#include "ai_station.hpp"
 
 /**
  * Class that creates a list of stations you own.
@@ -13,20 +14,6 @@
 class AIStationList : public AIAbstractList {
 public:
 	/**
-	 * Type of stations to get the list of.
-	 *  You you give BUS_STOP + TRAIN, and a station only has a
-	 *  bus-stop, it will be considered a hit.
-	 */
-	enum StationType {
-		STATION_ANY        = 0x00,
-		STATION_TRAIN      = 0x01,
-		STATION_TRUCK_STOP = 0x02,
-		STATION_BUS_STOP   = 0x04,
-		STATION_AIRPORT    = 0x08,
-		STATION_DOCK       = 0x10,
-	};
-
-	/**
 	 * The name of the class, needed by several sub-processes.
 	 */
 	static const char *GetClassName() { return "AIStationList"; }
@@ -35,9 +22,8 @@
 	 * The constructor to make a list of stations.
 	 * @param type The type of station you want a list of.
 	 */
-	AIStationList(AIStationList::StationType type);
+	AIStationList(AIStation::StationType type);
 };
-DECLARE_ENUM_AS_BIT_SET(AIStationList::StationType);
 
 /**
  * Class that creates a list of stations the vehicles goes to.
--- a/src/ai/api/ai_stationlist.hpp.sq	Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_stationlist.hpp.sq	Wed Jul 18 09:20:50 2007 +0000
@@ -1,10 +1,6 @@
 #include "ai_stationlist.hpp"
 
 namespace SQConvert {
-	/* Allow enums to be used as Squirrel parameters */
-	template <> AIStationList::StationType GetParam(ForceType<AIStationList::StationType>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIStationList::StationType)tmp; }
-	template <> int Return<AIStationList::StationType>(HSQUIRRELVM vm, AIStationList::StationType res) { sq_pushinteger(vm, (int32)res); return 1; }
-
 	/* Allow AIStationList to be used as Squirrel parameter */
 	template <> AIStationList *GetParam(ForceType<AIStationList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIStationList *)instance; }
 	template <> AIStationList &GetParam(ForceType<AIStationList &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIStationList *)instance; }
@@ -15,14 +11,7 @@
 void SQAIStationListRegister(Squirrel *engine) {
 	DefSQClass <AIStationList> SQAIStationList("AIStationList");
 	SQAIStationList.PreRegister(engine, "AIAbstractList");
-	SQAIStationList.AddConstructor<void (AIStationList::*)(AIStationList::StationType type), 2>(engine, "xi");
-
-	SQAIStationList.DefSQConst(engine, AIStationList::STATION_ANY,        "STATION_ANY");
-	SQAIStationList.DefSQConst(engine, AIStationList::STATION_TRAIN,      "STATION_TRAIN");
-	SQAIStationList.DefSQConst(engine, AIStationList::STATION_TRUCK_STOP, "STATION_TRUCK_STOP");
-	SQAIStationList.DefSQConst(engine, AIStationList::STATION_BUS_STOP,   "STATION_BUS_STOP");
-	SQAIStationList.DefSQConst(engine, AIStationList::STATION_AIRPORT,    "STATION_AIRPORT");
-	SQAIStationList.DefSQConst(engine, AIStationList::STATION_DOCK,       "STATION_DOCK");
+	SQAIStationList.AddConstructor<void (AIStationList::*)(AIStation::StationType type), 2>(engine, "xi");
 
 	SQAIStationList.DefSQStaticMethod(engine, &AIStationList::GetClassName, "GetClassName", 1, "x");