diff options
author | frosch <frosch@openttd.org> | 2012-01-28 19:36:22 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-01-28 19:36:22 +0000 |
commit | c9a7eb257193799be1cddfbe5136525c5c0f54da (patch) | |
tree | ebb23ad409c460de5efb577af3866ca998a72f83 | |
parent | db30bf0bd4f51b2e6ab1a1980c7cefec9f024f5d (diff) | |
download | openttd-c9a7eb257193799be1cddfbe5136525c5c0f54da.tar.xz |
(svn r23866) -Feature: [NewGRF] Give NewGRF defined level crossings and rail depots access to the townzone.
-rw-r--r-- | src/newgrf_railtype.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index 69e65417f..de857f6a6 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -14,6 +14,7 @@ #include "newgrf_spritegroup.h" #include "date_func.h" #include "depot_base.h" +#include "town.h" static uint32 RailTypeGetRandomBits(const ResolverObject *object) { @@ -41,6 +42,7 @@ static uint32 RailTypeGetVariable(const ResolverObject *object, byte variable, u case 0x41: return 0; case 0x42: return 0; case 0x43: return _date; + case 0x44: return HZB_TOWN_EDGE; } } @@ -51,6 +53,15 @@ static uint32 RailTypeGetVariable(const ResolverObject *object, byte variable, u case 0x43: if (IsRailDepotTile(tile)) return Depot::GetByTile(tile)->build_date; return _date; + case 0x44: { + const Town *t = NULL; + if (IsRailDepotTile(tile)) { + t = Depot::GetByTile(tile)->town; + } else if (IsLevelCrossingTile(tile)) { + t = ClosestTownFromTile(tile, UINT_MAX); + } + return t != NULL ? GetTownRadiusGroup(t, tile) : HZB_TOWN_EDGE; + } } DEBUG(grf, 1, "Unhandled rail type tile variable 0x%X", variable); |