mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r12052) -Fix [FS#1737] (r11494): The cargo translation table was loaded at the right time, but all the other global variables were now loaded too early. ;)
This commit is contained in:
parent
20e9abed47
commit
2588879c6d
|
@ -1488,21 +1488,11 @@ static bool GlobalVarChangeInfo(uint gvid, int numinfo, int prop, byte **bufp, i
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case 0x09: { // Cargo translation table
|
case 0x09: // Cargo translation table
|
||||||
if (gvid != 0) {
|
/* This is loaded during the reservation stage, so just skip it here. */
|
||||||
if (i == 0) grfmsg(1, "InitChangeInfo: Cargo translation table must start at zero");
|
/* Each entry is 4 bytes. */
|
||||||
/* Skip data */
|
buf += 4;
|
||||||
buf += 4;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == 0) {
|
|
||||||
free(_cur_grffile->cargo_list);
|
|
||||||
_cur_grffile->cargo_max = numinfo;
|
|
||||||
_cur_grffile->cargo_list = MallocT<CargoLabel>(numinfo);
|
|
||||||
}
|
|
||||||
CargoLabel cl = grf_load_dword(&buf);
|
|
||||||
_cur_grffile->cargo_list[i] = BSWAP32(cl);
|
|
||||||
} break;
|
|
||||||
|
|
||||||
case 0x0A: { // Currency display names
|
case 0x0A: { // Currency display names
|
||||||
uint curidx = GetNewgrfCurrencyIdConverted(gvid + i);
|
uint curidx = GetNewgrfCurrencyIdConverted(gvid + i);
|
||||||
|
@ -2167,7 +2157,7 @@ static void FeatureChangeInfo(byte *buf, int len)
|
||||||
/* GSF_CANAL */ CanalChangeInfo,
|
/* GSF_CANAL */ CanalChangeInfo,
|
||||||
/* GSF_BRIDGE */ BridgeChangeInfo,
|
/* GSF_BRIDGE */ BridgeChangeInfo,
|
||||||
/* GSF_TOWNHOUSE */ TownHouseChangeInfo,
|
/* GSF_TOWNHOUSE */ TownHouseChangeInfo,
|
||||||
/* GSF_GLOBALVAR */ NULL, /* Global variables are handled during reservation */
|
/* GSF_GLOBALVAR */ GlobalVarChangeInfo,
|
||||||
/* GSF_INDUSTRYTILES */IndustrytilesChangeInfo,
|
/* GSF_INDUSTRYTILES */IndustrytilesChangeInfo,
|
||||||
/* GSF_INDUSTRIES */ IndustriesChangeInfo,
|
/* GSF_INDUSTRIES */ IndustriesChangeInfo,
|
||||||
/* GSF_CARGOS */ NULL, /* Cargo is handled during reservation */
|
/* GSF_CARGOS */ NULL, /* Cargo is handled during reservation */
|
||||||
|
@ -2287,7 +2277,7 @@ static void ReserveChangeInfo(byte *buf, int len)
|
||||||
{
|
{
|
||||||
byte *bufend = buf + len;
|
byte *bufend = buf + len;
|
||||||
|
|
||||||
if (!check_length(len, 6, "InitChangeInfo")) return;
|
if (!check_length(len, 6, "ReserveChangeInfo")) return;
|
||||||
buf++;
|
buf++;
|
||||||
uint8 feature = grf_load_byte(&buf);
|
uint8 feature = grf_load_byte(&buf);
|
||||||
|
|
||||||
|
@ -2307,7 +2297,23 @@ static void ReserveChangeInfo(byte *buf, int len)
|
||||||
ignoring = CargoChangeInfo(index, numinfo, prop, &buf, bufend - buf);
|
ignoring = CargoChangeInfo(index, numinfo, prop, &buf, bufend - buf);
|
||||||
break;
|
break;
|
||||||
case GSF_GLOBALVAR:
|
case GSF_GLOBALVAR:
|
||||||
ignoring = GlobalVarChangeInfo(index, numinfo, prop, &buf, bufend - buf);
|
switch (prop) {
|
||||||
|
case 0x09: // Cargo Translation Table
|
||||||
|
if (index != 0) {
|
||||||
|
grfmsg(1, "ReserveChangeInfo: Cargo translation table must start at zero");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(_cur_grffile->cargo_list);
|
||||||
|
_cur_grffile->cargo_max = numinfo;
|
||||||
|
_cur_grffile->cargo_list = MallocT<CargoLabel>(numinfo);
|
||||||
|
|
||||||
|
for (uint i = 0; i < numinfo; i++) {
|
||||||
|
CargoLabel cl = grf_load_dword(&buf);
|
||||||
|
_cur_grffile->cargo_list[i] = BSWAP32(cl);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue