1
0
Fork 0

Change: [NewGRF] Remove properties removed in GRFv9.

pull/13309/head
Peter Nelson 2025-01-12 10:51:28 +00:00
parent 06029201fe
commit 606ae94f8f
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 45 additions and 11 deletions

View File

@ -1014,6 +1014,7 @@ enum ChangeInfoResult {
CIR_DISABLED, ///< GRF was disabled due to error CIR_DISABLED, ///< GRF was disabled due to error
CIR_UNHANDLED, ///< Variable was parsed but unread CIR_UNHANDLED, ///< Variable was parsed but unread
CIR_UNKNOWN, ///< Variable is unknown CIR_UNKNOWN, ///< Variable is unknown
CIR_REMOVED, ///< Property did exist but has been removed.
CIR_INVALID_ID, ///< Attempt to modify an invalid ID CIR_INVALID_ID, ///< Attempt to modify an invalid ID
}; };
@ -1247,6 +1248,7 @@ static ChangeInfoResult RailVehicleChangeInfo(uint first, uint last, int prop, B
break; break;
case 0x1D: { // Refit cargo case 0x1D: { // Refit cargo
if (_cur.grf_version >= 9) return CIR_REMOVED;
uint32_t mask = buf.ReadDWord(); uint32_t mask = buf.ReadDWord();
_gted[e->index].UpdateRefittability(mask != 0); _gted[e->index].UpdateRefittability(mask != 0);
ei->refit_mask = TranslateRefitMask(mask); ei->refit_mask = TranslateRefitMask(mask);
@ -1468,6 +1470,7 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint first, uint last, int prop, B
break; break;
case 0x16: { // Cargoes available for refitting case 0x16: { // Cargoes available for refitting
if (_cur.grf_version >= 9) return CIR_REMOVED;
uint32_t mask = buf.ReadDWord(); uint32_t mask = buf.ReadDWord();
_gted[e->index].UpdateRefittability(mask != 0); _gted[e->index].UpdateRefittability(mask != 0);
ei->refit_mask = TranslateRefitMask(mask); ei->refit_mask = TranslateRefitMask(mask);
@ -1656,6 +1659,7 @@ static ChangeInfoResult ShipVehicleChangeInfo(uint first, uint last, int prop, B
break; break;
case 0x11: { // Cargoes available for refitting case 0x11: { // Cargoes available for refitting
if (_cur.grf_version >= 9) return CIR_REMOVED;
uint32_t mask = buf.ReadDWord(); uint32_t mask = buf.ReadDWord();
_gted[e->index].UpdateRefittability(mask != 0); _gted[e->index].UpdateRefittability(mask != 0);
ei->refit_mask = TranslateRefitMask(mask); ei->refit_mask = TranslateRefitMask(mask);
@ -1847,6 +1851,7 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint first, uint last, int pro
break; break;
case 0x13: { // Cargoes available for refitting case 0x13: { // Cargoes available for refitting
if (_cur.grf_version >= 9) return CIR_REMOVED;
uint32_t mask = buf.ReadDWord(); uint32_t mask = buf.ReadDWord();
_gted[e->index].UpdateRefittability(mask != 0); _gted[e->index].UpdateRefittability(mask != 0);
ei->refit_mask = TranslateRefitMask(mask); ei->refit_mask = TranslateRefitMask(mask);
@ -2378,12 +2383,15 @@ static ChangeInfoResult IgnoreTownHouseProperty(int prop, ByteReader &buf)
ChangeInfoResult ret = CIR_SUCCESS; ChangeInfoResult ret = CIR_SUCCESS;
switch (prop) { switch (prop) {
case 0x09:
case 0x0B:
case 0x0C:
case 0x0D: case 0x0D:
case 0x0E: case 0x0E:
case 0x0F: case 0x0F:
if (_cur.grf_version >= 9) return CIR_REMOVED;
[[fallthrough]];
case 0x09:
case 0x0B:
case 0x0C:
case 0x11: case 0x11:
case 0x14: case 0x14:
case 0x15: case 0x15:
@ -2408,6 +2416,7 @@ static ChangeInfoResult IgnoreTownHouseProperty(int prop, ByteReader &buf)
break; break;
case 0x1E: case 0x1E:
if (_cur.grf_version >= 9) return CIR_REMOVED;
buf.ReadDWord(); buf.ReadDWord();
break; break;
@ -2536,10 +2545,12 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
case 0x0D: // Passenger acceptance case 0x0D: // Passenger acceptance
case 0x0E: // Mail acceptance case 0x0E: // Mail acceptance
if (_cur.grf_version >= 9) return CIR_REMOVED;
housespec->cargo_acceptance[prop - 0x0D] = buf.ReadByte(); housespec->cargo_acceptance[prop - 0x0D] = buf.ReadByte();
break; break;
case 0x0F: { // Goods/candy, food/fizzy drinks acceptance case 0x0F: { // Goods/candy, food/fizzy drinks acceptance
if (_cur.grf_version >= 9) return CIR_REMOVED;
int8_t goods = buf.ReadByte(); int8_t goods = buf.ReadByte();
/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance. /* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
@ -2624,6 +2635,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint first, uint last, int prop, Byt
break; break;
case 0x1E: { // Accepted cargo types case 0x1E: { // Accepted cargo types
if (_cur.grf_version >= 9) return CIR_REMOVED;
uint32_t cargotypes = buf.ReadDWord(); uint32_t cargotypes = buf.ReadDWord();
/* Check if the cargo types should not be changed */ /* Check if the cargo types should not be changed */
@ -3305,6 +3317,9 @@ static ChangeInfoResult IgnoreIndustryTileProperty(int prop, ByteReader &buf)
case 0x0A: case 0x0A:
case 0x0B: case 0x0B:
case 0x0C: case 0x0C:
if (_cur.grf_version >= 9) return CIR_REMOVED;
[[fallthrough]];
case 0x0F: case 0x0F:
buf.ReadWord(); buf.ReadWord();
break; break;
@ -3400,6 +3415,8 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint first, uint last, int prop,
case 0x0A: // Tile acceptance case 0x0A: // Tile acceptance
case 0x0B: case 0x0B:
case 0x0C: { case 0x0C: {
if (_cur.grf_version >= 9) return CIR_REMOVED;
uint16_t acctp = buf.ReadWord(); uint16_t acctp = buf.ReadWord();
tsp->accepts_cargo[prop - 0x0A] = GetCargoTranslation(GB(acctp, 0, 8), _cur.grffile); tsp->accepts_cargo[prop - 0x0A] = GetCargoTranslation(GB(acctp, 0, 8), _cur.grffile);
tsp->acceptance[prop - 0x0A] = Clamp(GB(acctp, 8, 8), 0, 16); tsp->acceptance[prop - 0x0A] = Clamp(GB(acctp, 8, 8), 0, 16);
@ -3473,10 +3490,13 @@ static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader &buf)
ChangeInfoResult ret = CIR_SUCCESS; ChangeInfoResult ret = CIR_SUCCESS;
switch (prop) { switch (prop) {
case 0x12:
if (_cur.grf_version >= 9) return CIR_REMOVED;
[[fallthrough]];
case 0x09: case 0x09:
case 0x0B: case 0x0B:
case 0x0F: case 0x0F:
case 0x12:
case 0x13: case 0x13:
case 0x14: case 0x14:
case 0x17: case 0x17:
@ -3487,10 +3507,13 @@ static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader &buf)
buf.ReadByte(); buf.ReadByte();
break; break;
case 0x10: // INDUSTRY_ORIGINAL_NUM_OUTPUTS bytes
if (_cur.grf_version >= 9) return CIR_REMOVED;
[[fallthrough]];
case 0x0C: case 0x0C:
case 0x0D: case 0x0D:
case 0x0E: case 0x0E:
case 0x10: // INDUSTRY_ORIGINAL_NUM_OUTPUTS bytes
case 0x1B: case 0x1B:
case 0x1F: case 0x1F:
case 0x24: case 0x24:
@ -3498,10 +3521,13 @@ static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader &buf)
break; break;
case 0x11: // INDUSTRY_ORIGINAL_NUM_INPUTS bytes + 1 case 0x11: // INDUSTRY_ORIGINAL_NUM_INPUTS bytes + 1
case 0x1A:
case 0x1C: case 0x1C:
case 0x1D: case 0x1D:
case 0x1E: case 0x1E:
if (_cur.grf_version >= 9) return CIR_REMOVED;
[[fallthrough]];
case 0x1A:
case 0x20: case 0x20:
case 0x23: case 0x23:
buf.ReadDWord(); buf.ReadDWord();
@ -3788,6 +3814,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
break; break;
case 0x10: // Production cargo types case 0x10: // Production cargo types
if (_cur.grf_version >= 9) return CIR_REMOVED;
for (uint8_t j = 0; j < INDUSTRY_ORIGINAL_NUM_OUTPUTS; j++) { for (uint8_t j = 0; j < INDUSTRY_ORIGINAL_NUM_OUTPUTS; j++) {
indsp->produced_cargo[j] = GetCargoTranslation(buf.ReadByte(), _cur.grffile); indsp->produced_cargo[j] = GetCargoTranslation(buf.ReadByte(), _cur.grffile);
indsp->produced_cargo_label[j] = CT_INVALID; indsp->produced_cargo_label[j] = CT_INVALID;
@ -3795,6 +3822,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
break; break;
case 0x11: // Acceptance cargo types case 0x11: // Acceptance cargo types
if (_cur.grf_version >= 9) return CIR_REMOVED;
for (uint8_t j = 0; j < INDUSTRY_ORIGINAL_NUM_INPUTS; j++) { for (uint8_t j = 0; j < INDUSTRY_ORIGINAL_NUM_INPUTS; j++) {
indsp->accepts_cargo[j] = GetCargoTranslation(buf.ReadByte(), _cur.grffile); indsp->accepts_cargo[j] = GetCargoTranslation(buf.ReadByte(), _cur.grffile);
indsp->accepts_cargo_label[j] = CT_INVALID; indsp->accepts_cargo_label[j] = CT_INVALID;
@ -3804,6 +3832,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
case 0x12: // Production multipliers case 0x12: // Production multipliers
case 0x13: case 0x13:
if (_cur.grf_version >= 9) return CIR_REMOVED;
indsp->production_rate[prop - 0x12] = buf.ReadByte(); indsp->production_rate[prop - 0x12] = buf.ReadByte();
break; break;
@ -3851,11 +3880,12 @@ static ChangeInfoResult IndustriesChangeInfo(uint first, uint last, int prop, By
case 0x1C: // Input cargo multipliers for the three input cargo types case 0x1C: // Input cargo multipliers for the three input cargo types
case 0x1D: case 0x1D:
case 0x1E: { case 0x1E: {
uint32_t multiples = buf.ReadDWord(); if (_cur.grf_version >= 9) return CIR_REMOVED;
indsp->input_cargo_multiplier[prop - 0x1C][0] = GB(multiples, 0, 16); uint32_t multiples = buf.ReadDWord();
indsp->input_cargo_multiplier[prop - 0x1C][1] = GB(multiples, 16, 16); indsp->input_cargo_multiplier[prop - 0x1C][0] = GB(multiples, 0, 16);
break; indsp->input_cargo_multiplier[prop - 0x1C][1] = GB(multiples, 16, 16);
} break;
}
case 0x1F: // Industry name case 0x1F: // Industry name
AddStringForMapping(GRFStringID{buf.ReadWord()}, &indsp->name); AddStringForMapping(GRFStringID{buf.ReadWord()}, &indsp->name);
@ -4968,6 +4998,10 @@ static bool HandleChangeInfoResult(const char *caller, ChangeInfoResult cir, uin
GrfMsg(1, "{}: Ignoring property 0x{:02X} of feature 0x{:02X} (not implemented)", caller, property, feature); GrfMsg(1, "{}: Ignoring property 0x{:02X} of feature 0x{:02X} (not implemented)", caller, property, feature);
return false; return false;
case CIR_REMOVED:
GrfMsg(0, "{}: Ignoring property 0x{:02X} of feature 0x{:02X} (removed)", caller, property, feature);
return true;
case CIR_UNKNOWN: case CIR_UNKNOWN:
GrfMsg(0, "{}: Unknown property 0x{:02X} of feature 0x{:02X}, disabling", caller, property, feature); GrfMsg(0, "{}: Unknown property 0x{:02X} of feature 0x{:02X}, disabling", caller, property, feature);
[[fallthrough]]; [[fallthrough]];