mirror of https://github.com/OpenTTD/OpenTTD
(svn r24272) -Fix: [NewGRF] Load cargo- and railtype-translation during both reservation and activation stage. That way they can be selected using Action7 depending on present cargo- or railtypes.
parent
d3a7a5fce0
commit
9522dbb1a9
|
@ -2442,11 +2442,22 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, By
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x09: // Cargo translation table
|
case 0x09: { // Cargo Translation Table; loading during both reservation and activation stage (in case it is selected depending on defined cargos)
|
||||||
/* This is loaded during the reservation stage, so just skip it here. */
|
if (i == 0) {
|
||||||
/* Each entry is 4 bytes. */
|
if (gvid != 0) {
|
||||||
buf->Skip(4);
|
grfmsg(1, "GlobalVarChangeInfo: Cargo translation table must start at zero");
|
||||||
|
return CIR_INVALID_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(_cur.grffile->cargo_list);
|
||||||
|
_cur.grffile->cargo_max = numinfo;
|
||||||
|
_cur.grffile->cargo_list = MallocT<CargoLabel>(numinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
CargoLabel cl = buf->ReadDWord();
|
||||||
|
_cur.grffile->cargo_list[i] = BSWAP32(cl);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 0x0A: { // Currency display names
|
case 0x0A: { // Currency display names
|
||||||
uint curidx = GetNewgrfCurrencyIdConverted(gvid + i);
|
uint curidx = GetNewgrfCurrencyIdConverted(gvid + i);
|
||||||
|
@ -2560,11 +2571,22 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, By
|
||||||
buf->Skip(8);
|
buf->Skip(8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x12: // Rail type translation table
|
case 0x12: { // Rail type translation table; loading during both reservation and activation stage (in case it is selected depending on defined railtypes)
|
||||||
/* This is loaded during the reservation stage, so just skip it here. */
|
if (i == 0) {
|
||||||
/* Each entry is 4 bytes. */
|
if (gvid != 0) {
|
||||||
buf->Skip(4);
|
grfmsg(1, "GlobalVarChangeInfo: Rail type translation table must start at zero");
|
||||||
|
return CIR_INVALID_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(_cur.grffile->railtype_list);
|
||||||
|
_cur.grffile->railtype_max = numinfo;
|
||||||
|
_cur.grffile->railtype_list = MallocT<RailTypeLabel>(numinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
RailTypeLabel rtl = buf->ReadDWord();
|
||||||
|
_cur.grffile->railtype_list[i] = BSWAP32(rtl);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 0x13: // Gender translation table
|
case 0x13: // Gender translation table
|
||||||
case 0x14: // Case translation table
|
case 0x14: // Case translation table
|
||||||
|
|
Loading…
Reference in New Issue