# HG changeset patch # User truebrain # Date 1213820088 0 # Node ID 63df4d05c0bf5416a85ea800537842184f059cd4 # Parent 69532778abab3eee1fc6ebd0d5591208a6aaec87 (svn r13567) [NoAI] -Fix: it turns out AIStation::StationType didn't match ::StationType, as it matches (nameless) FACIL_ enum.. which has not the same order as ::StationTYpe.. things can be confusing from time to time :) diff -r 69532778abab -r 63df4d05c0bf bin/ai/regression/regression.txt --- a/bin/ai/regression/regression.txt Wed Jun 18 19:58:44 2008 +0000 +++ b/bin/ai/regression/regression.txt Wed Jun 18 20:14:48 2008 +0000 @@ -6602,10 +6602,10 @@ --TileList_StationType-- Count(): 4 Location ListDump: - 33668 => 0 - 33416 => 0 - 33414 => 0 - 33412 => 0 + 33667 => 0 + 33415 => 0 + 33413 => 0 + 33411 => 0 --Town-- GetMaxTownID(): 31 diff -r 69532778abab -r 63df4d05c0bf src/ai/api/ai_tilelist.cpp --- a/src/ai/api/ai_tilelist.cpp Wed Jun 18 19:58:44 2008 +0000 +++ b/src/ai/api/ai_tilelist.cpp Wed Jun 18 20:14:48 2008 +0000 @@ -157,10 +157,19 @@ const StationRect *rect = &::GetStation(station_id)->rect; + uint station_type_value = 0; + /* Convert AIStation::StationType to ::StationType, but do it in a + * bitmask, so we can scan for multiple entries at the same time. */ + if ((station_type & AIStation::STATION_TRAIN) != 0) station_type_value |= (1 << ::STATION_RAIL); + if ((station_type & AIStation::STATION_TRUCK_STOP) != 0) station_type_value |= (1 << ::STATION_TRUCK); + if ((station_type & AIStation::STATION_BUS_STOP) != 0) station_type_value |= (1 << ::STATION_BUS); + if ((station_type & AIStation::STATION_AIRPORT) != 0) station_type_value |= (1 << ::STATION_AIRPORT) | (1 << ::STATION_OILRIG); + if ((station_type & AIStation::STATION_DOCK) != 0) station_type_value |= (1 << ::STATION_DOCK) | (1 << ::STATION_OILRIG); + BEGIN_TILE_LOOP(cur_tile, rect->right - rect->left + 1, rect->bottom - rect->top + 1, ::TileXY(rect->left, rect->top)) { if (!::IsTileType(cur_tile, MP_STATION)) continue; if (::GetStationIndex(cur_tile) != station_id) continue; - if (!HasBit(station_type, ::GetStationType(cur_tile))) continue; + if (!HasBit(station_type_value, ::GetStationType(cur_tile))) continue; this->AddTile(cur_tile); } END_TILE_LOOP(cur_tile, rect->right - rect->left + 1, rect->bottom - rect->top + 1, ::TileXY(rect->left, rect->top)) }