changeset 10760:fa27ef400cf1 draft

(svn r15093) -Fix [NoAI]: check if a tile is valid before using IsTileType (bug found by Zuu, patch by Yexo)
author truebrain <truebrain@openttd.org>
date Thu, 15 Jan 2009 17:00:47 +0000
parents 54b74d104a09
children 7ab736050373
files src/ai/api/ai_station.cpp
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/api/ai_station.cpp
+++ b/src/ai/api/ai_station.cpp
@@ -26,7 +26,7 @@
 
 /* static */ StationID AIStation::GetStationID(TileIndex tile)
 {
-	if (!::IsTileType(tile, MP_STATION)) return INVALID_STATION;
+	if (!::IsValidTile(tile) || !::IsTileType(tile, MP_STATION)) return INVALID_STATION;
 	return ::GetStationIndex(tile);
 }