summaryrefslogtreecommitdiff
path: root/src/elrail.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2010-02-07 22:22:54 +0000
committerpeter1138 <peter1138@openttd.org>2010-02-07 22:22:54 +0000
commit898e879bd90e34505cd7083acecf341fd798d02c (patch)
treef9c016c9dcb7d2e78726296e15aceb6adf4a0e2c /src/elrail.cpp
parent01474412fc95b69ea6595a94eeb8baa0db575e16 (diff)
downloadopenttd-898e879bd90e34505cd7083acecf341fd798d02c.tar.xz
(svn r19056) -Add: [NewGRF] Action 3/2/1 (i.e. new graphics) support for rail types. (To be documented...)
Diffstat (limited to 'src/elrail.cpp')
-rw-r--r--src/elrail.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 0cf7b905d..41b0d5a74 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -64,6 +64,8 @@
#include "elrail_func.h"
#include "engine_base.h"
#include "company_base.h"
+#include "rail.h"
+#include "newgrf_railtype.h"
#include "table/sprites.h"
#include "table/elrail_data.h"
@@ -165,7 +167,9 @@ static TrackBits MaskWireBits(TileIndex t, TrackBits tracks)
*/
static inline SpriteID GetWireBase(TileIndex tile)
{
- return SPR_WIRE_BASE;
+ const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
+ SpriteID wires = GetCustomRailSprite(rti, tile, RTSG_WIRES);
+ return wires == 0 ? SPR_WIRE_BASE : wires;
}
/**
@@ -173,7 +177,9 @@ static inline SpriteID GetWireBase(TileIndex tile)
*/
static inline SpriteID GetPylonBase(TileIndex tile)
{
- return SPR_PYLON_BASE;
+ const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
+ SpriteID pylons = GetCustomRailSprite(rti, tile, RTSG_PYLONS);
+ return pylons == 0 ? SPR_PYLON_BASE : pylons;
}
/** Corrects the tileh for certain tile types. Returns an effective tileh for the track on the tile.