summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-23 15:57:34 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-23 15:57:34 +0000
commit14b6860e6212d2dec46c135a8d3c04fb3905f596 (patch)
tree4aa716aace4d2a0072eefd09313a747ee28351b3 /rail_cmd.c
parent4ad0c3cd75eac495268b0e158a2fb38554443029 (diff)
downloadopenttd-14b6860e6212d2dec46c135a8d3c04fb3905f596.tar.xz
(svn r4546) - NewGRF: add support for Action 0x05, type 0x04: replacement signal graphics. Thanks to Purno for supplying data to test
with.
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 355078e04..34f563ec9 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -26,6 +26,7 @@
#include "waypoint.h"
#include "rail.h"
#include "railtypes.h" // include table for railtypes
+#include "newgrf.h"
extern uint16 _custom_sprites_base;
@@ -1047,7 +1048,16 @@ static void DrawSingleSignal(TileIndex tile, byte condition, uint image, uint po
uint x = TileX(tile) * TILE_SIZE + SignalPositions[side][pos].x;
uint y = TileY(tile) * TILE_SIZE + SignalPositions[side][pos].y;
- SpriteID sprite = SignalBase[side][GetSignalVariant(tile)][GetSignalType(tile)] + image + condition;
+ SpriteID sprite;
+
+ /* _signal_base is set by our NewGRF Action 5 loader. If it is 0 then we
+ * just draw the standard signals, else we get the offset from _signal_base
+ * and draw that sprite. All the signal sprites are loaded sequentially. */
+ if (_signal_base == 0 || (GetSignalType(tile) == 0 && GetSignalVariant(tile) == SIG_ELECTRIC)) {
+ sprite = SignalBase[side][GetSignalVariant(tile)][GetSignalType(tile)] + image + condition;
+ } else {
+ sprite = _signal_base + (GetSignalType(tile) - 1) * 16 + GetSignalVariant(tile) * 64 + image + condition;
+ }
AddSortableSpriteToDraw(sprite, x, y, 1, 1, 10, GetSlopeZ(x,y));
}