diff options
author | rubidium <rubidium@openttd.org> | 2006-11-17 18:06:40 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2006-11-17 18:06:40 +0000 |
commit | 532271ba65c994ee8bc93752b515b8fc918b6ab5 (patch) | |
tree | 16007d465076fc4cb96fc31ade61503d37a460f9 | |
parent | 6766496ad1bc8298cc3cbb5a3b025a20f7887f43 (diff) | |
download | openttd-532271ba65c994ee8bc93752b515b8fc918b6ab5.tar.xz |
(svn r7194) -Fix (FS#237): the electric rail type was not set correctly for NewGRFs where the engine traction type was set before the track type of the trains.
-rw-r--r-- | newgrf.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -267,7 +267,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf uint8 tracktype = grf_load_byte(&buf); switch (tracktype) { - case 0: ei[i].railtype = RAILTYPE_RAIL; break; + case 0: ei[i].railtype = rvi[i].engclass == 2 ? RAILTYPE_ELECTRIC : RAILTYPE_RAIL; break; case 1: ei[i].railtype = RAILTYPE_MONO; break; case 2: ei[i].railtype = RAILTYPE_MAGLEV; break; default: @@ -405,12 +405,13 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf engclass = 1; } else if (traction <= 0x31) { engclass = 2; - ei[i].railtype = RAILTYPE_ELECTRIC; } else if (traction <= 0x41) { engclass = 2; } else { break; } + if (ei[i].railtype == RAILTYPE_RAIL && engclass == 2) ei[i].railtype = RAILTYPE_ELECTRIC; + if (ei[i].railtype == RAILTYPE_ELECTRIC && engclass != 2) ei[i].railtype = RAILTYPE_RAIL; rvi[i].engclass = engclass; } |