(svn r13569) [NoAI] -Fix: for some silly reason STATION_ANY was 0x00, instead of 0x1F, greatly increasing the complexity of bitmask-checks, for no clear reason noai
authortruebrain
Wed, 18 Jun 2008 20:20:44 +0000
branchnoai
changeset 11012 2a79a3bbe92a
parent 11011 63df4d05c0bf
child 11014 13060e4514d5
(svn r13569) [NoAI] -Fix: for some silly reason STATION_ANY was 0x00, instead of 0x1F, greatly increasing the complexity of bitmask-checks, for no clear reason
src/ai/api/ai_station.hpp
src/ai/api/ai_station.hpp.sq
src/ai/api/ai_stationlist.cpp
--- a/src/ai/api/ai_station.hpp	Wed Jun 18 20:14:48 2008 +0000
+++ b/src/ai/api/ai_station.hpp	Wed Jun 18 20:20:44 2008 +0000
@@ -41,12 +41,12 @@
 	 */
 	enum StationType {
 		/* Values are important, as they represent the internal state of the game. */
-		STATION_ANY        = 0x00, //!< All station types
 		STATION_TRAIN      = 0x01, //!< Train station
 		STATION_TRUCK_STOP = 0x02, //!< Truck station
 		STATION_BUS_STOP   = 0x04, //!< Bus station
 		STATION_AIRPORT    = 0x08, //!< Airport
 		STATION_DOCK       = 0x10, //!< Dock
+		STATION_ANY        = 0x1F, //!< All station types
 	};
 
 	/**
--- a/src/ai/api/ai_station.hpp.sq	Wed Jun 18 20:14:48 2008 +0000
+++ b/src/ai/api/ai_station.hpp.sq	Wed Jun 18 20:20:44 2008 +0000
@@ -28,12 +28,12 @@
 	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
 	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS,            "ERR_STATION_TOO_MANY_STATIONS");
 	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN");
-	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.DefSQConst(engine, AIStation::STATION_ANY,                              "STATION_ANY");
 
 	AIError::RegisterErrorMap(STR_306C_STATION_TOO_SPREAD_OUT,       AIStation::ERR_STATION_TOO_LARGE);
 	AIError::RegisterErrorMap(STR_300D_TOO_CLOSE_TO_ANOTHER_AIRPORT, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
--- a/src/ai/api/ai_stationlist.cpp	Wed Jun 18 20:14:48 2008 +0000
+++ b/src/ai/api/ai_stationlist.cpp	Wed Jun 18 20:20:44 2008 +0000
@@ -13,7 +13,7 @@
 {
 	Station *st;
 	FOR_ALL_STATIONS(st) {
-		if (st->owner == _current_player && (station_type == AIStation::STATION_ANY || (st->facilities & station_type) != 0)) this->AddItem(st->index);
+		if (st->owner == _current_player && (st->facilities & station_type) != 0) this->AddItem(st->index);
 	}
 }