(svn r13851) -Fix (r9393): GetTownByTile() is only valid for houses and roads.
authorfrosch
Sun, 27 Jul 2008 18:36:11 +0000
changeset 9726 7cc08b5b0787
parent 9725 982452c3357e
child 9727 3c06f03dadbe
(svn r13851) -Fix (r9393): GetTownByTile() is only valid for houses and roads.
src/newgrf_station.cpp
--- a/src/newgrf_station.cpp	Sun Jul 27 15:17:16 2008 +0000
+++ b/src/newgrf_station.cpp	Sun Jul 27 18:36:11 2008 +0000
@@ -18,7 +18,7 @@
 #include "newgrf_spritegroup.h"
 #include "newgrf_sound.h"
 #include "cargotype.h"
-#include "town_map.h"
+#include "town.h"
 #include "newgrf_town.h"
 #include "gfx_func.h"
 #include "date_func.h"
@@ -361,12 +361,12 @@
 
 	if (object->scope == VSG_SCOPE_PARENT) {
 		/* Pass the request on to the town of the station */
-		Town *t;
+		const Town *t;
 
 		if (st != NULL) {
 			t = st->town;
 		} else if (tile != INVALID_TILE) {
-			t = GetTownByTile(tile);
+			t = ClosestTownFromTile(tile, UINT_MAX);
 		} else {
 			*available = false;
 			return UINT_MAX;