mirror of https://github.com/OpenTTD/OpenTTD
(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.
parent
6766496ad1
commit
532271ba65
5
newgrf.c
5
newgrf.c
|
@ -267,7 +267,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
||||||
uint8 tracktype = grf_load_byte(&buf);
|
uint8 tracktype = grf_load_byte(&buf);
|
||||||
|
|
||||||
switch (tracktype) {
|
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 1: ei[i].railtype = RAILTYPE_MONO; break;
|
||||||
case 2: ei[i].railtype = RAILTYPE_MAGLEV; break;
|
case 2: ei[i].railtype = RAILTYPE_MAGLEV; break;
|
||||||
default:
|
default:
|
||||||
|
@ -405,12 +405,13 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
||||||
engclass = 1;
|
engclass = 1;
|
||||||
} else if (traction <= 0x31) {
|
} else if (traction <= 0x31) {
|
||||||
engclass = 2;
|
engclass = 2;
|
||||||
ei[i].railtype = RAILTYPE_ELECTRIC;
|
|
||||||
} else if (traction <= 0x41) {
|
} else if (traction <= 0x41) {
|
||||||
engclass = 2;
|
engclass = 2;
|
||||||
} else {
|
} else {
|
||||||
break;
|
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;
|
rvi[i].engclass = engclass;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue