(svn r13851) -Fix (r9393): GetTownByTile() is only valid for houses and roads.

This commit is contained in:
frosch 2008-07-27 18:36:11 +00:00
parent 1f31e117f0
commit 1aa6e00b48

View File

@ -18,7 +18,7 @@
#include "newgrf_spritegroup.h" #include "newgrf_spritegroup.h"
#include "newgrf_sound.h" #include "newgrf_sound.h"
#include "cargotype.h" #include "cargotype.h"
#include "town_map.h" #include "town.h"
#include "newgrf_town.h" #include "newgrf_town.h"
#include "gfx_func.h" #include "gfx_func.h"
#include "date_func.h" #include "date_func.h"
@ -361,12 +361,12 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
if (object->scope == VSG_SCOPE_PARENT) { if (object->scope == VSG_SCOPE_PARENT) {
/* Pass the request on to the town of the station */ /* Pass the request on to the town of the station */
Town *t; const Town *t;
if (st != NULL) { if (st != NULL) {
t = st->town; t = st->town;
} else if (tile != INVALID_TILE) { } else if (tile != INVALID_TILE) {
t = GetTownByTile(tile); t = ClosestTownFromTile(tile, UINT_MAX);
} else { } else {
*available = false; *available = false;
return UINT_MAX; return UINT_MAX;