@@ -2597,24 +2597,25 @@ static ChangeInfoResult TownHouseChangeI
}
/* Always write the full accepts_cargo array, and check each index for being inside the
* provided data. This ensures all values are properly initialized, and also avoids
* any risks of array overrun. */
for (uint i = 0; i < lengthof(housespec->accepts_cargo); i++) {
if (i < count) {
housespec->accepts_cargo[i] = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
housespec->cargo_acceptance[i] = buf->ReadByte();
} else {
housespec->accepts_cargo[i] = INVALID_CARGO;
housespec->cargo_acceptance[i] = 0;
housespec->accepts_cargo_label[i] = CT_INVALID;
break;
default:
ret = CIR_UNKNOWN;
return ret;
@@ -3333,24 +3334,25 @@ static ChangeInfoResult IndustrytilesCha
error->param_value[1] = prop;
return CIR_DISABLED;
for (uint i = 0; i < std::size(tsp->acceptance); i++) {
if (i < num_cargoes) {
tsp->accepts_cargo[i] = GetCargoTranslation(buf->ReadByte(), _cur.grffile);
/* Tile acceptance can be negative to counteract the INDTILE_SPECIAL_ACCEPTS_ALL_CARGO flag */
tsp->acceptance[i] = (int8_t)buf->ReadByte();
tsp->accepts_cargo[i] = INVALID_CARGO;
tsp->acceptance[i] = 0;
tsp->accepts_cargo_label[i] = CT_INVALID;
Status change: