summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-01-05 19:40:34 +0000
committermichi_cc <michi_cc@openttd.org>2012-01-05 19:40:34 +0000
commitee0fcb25670d1b559cdfdb31e6b7d0da4ec3713d (patch)
tree6801ecd572e6dd07d0b4b045cdcbd1bafea78617 /src/newgrf.cpp
parent69e197c87fc23e5492f4b59f8e1ba8757d65c41e (diff)
downloadopenttd-ee0fcb25670d1b559cdfdb31e6b7d0da4ec3713d.tar.xz
(svn r23758) -Feature: [NewGRF] Alternate rail type label list.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 970ccec25..b8c75107e 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3894,7 +3894,7 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR
int n = buf->ReadByte();
for (int j = 0; j != n; j++) {
RailTypeLabel label = buf->ReadDWord();
- RailType rt = GetRailTypeByLabel(BSWAP32(label));
+ RailType rt = GetRailTypeByLabel(BSWAP32(label), false);
if (rt != INVALID_RAILTYPE) {
switch (prop) {
case 0x0E: SetBit(rti->compatible_railtypes, rt); break;
@@ -3952,6 +3952,11 @@ static ChangeInfoResult RailTypeChangeInfo(uint id, int numinfo, int prop, ByteR
rti->maintenance_multiplier = buf->ReadWord();
break;
+ case 0x1D: // Alternate rail type label list
+ /* Skipped here as this is loaded during reservation stage. */
+ for (int j = buf->ReadByte(); j != 0; j--) buf->ReadDWord();
+ break;
+
default:
ret = CIR_UNKNOWN;
break;
@@ -3965,6 +3970,8 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, Byte
{
ChangeInfoResult ret = CIR_SUCCESS;
+ extern RailtypeInfo _railtypes[RAILTYPE_END];
+
if (id + numinfo > RAILTYPE_END) {
grfmsg(1, "RailTypeReserveInfo: Rail type %u is invalid, max %u, ignoring", id + numinfo, RAILTYPE_END);
return CIR_INVALID_ID;
@@ -3977,7 +3984,7 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, Byte
RailTypeLabel rtl = buf->ReadDWord();
rtl = BSWAP32(rtl);
- RailType rt = GetRailTypeByLabel(rtl);
+ RailType rt = GetRailTypeByLabel(rtl, false);
if (rt == INVALID_RAILTYPE) {
/* Set up new rail type */
rt = AllocateRailType(rtl);
@@ -3999,6 +4006,17 @@ static ChangeInfoResult RailTypeReserveInfo(uint id, int numinfo, int prop, Byte
buf->ReadWord();
break;
+ case 0x1D: // Alternate rail type label list
+ if (_cur.grffile->railtype_map[id + i] != INVALID_RAILTYPE) {
+ int n = buf->ReadByte();
+ for (int j = 0; j != n; j++) {
+ *_railtypes[_cur.grffile->railtype_map[id + i]].alternate_labels.Append() = BSWAP32(buf->ReadDWord());
+ }
+ break;
+ }
+ grfmsg(1, "RailTypeReserveInfo: Ignoring property 1D for rail type %u because no label was set", id + i);
+ /* FALL THROUGH */
+
case 0x0E: // Compatible railtype list
case 0x0F: // Powered railtype list
case 0x18: // Railtype list required for date introduction