# HG changeset patch # User Peter Nelson # Date 2023-04-30 09:00:43 # Node ID 40edbcd483e2a767b1cb7589511b041cc5f377d1 # Parent 5c6352aa129ca2ee395e7a8b222e7e8edca5734b Change: Read Action 3 IDs as extended-bytes for all features. This can be done because previous the value 0xFF (which indicates an extended byte) was reserved for this purpose. Other features which may not have mentioned reserving 0xFF do not allow this many IDs anyway. This makes Action 3 consistent across all features. The allowable limits for each feature do not change. diff --git a/src/newgrf.cpp b/src/newgrf.cpp --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5642,10 +5642,10 @@ static void VehicleMapSpriteGroup(ByteRe static void CanalMapSpriteGroup(ByteReader *buf, uint8 idcount) { - std::vector cfs; + std::vector cfs; cfs.reserve(idcount); for (uint i = 0; i < idcount; i++) { - cfs.push_back((CanalFeature)buf->ReadByte()); + cfs.push_back(buf->ReadExtendedByte()); } uint8 cidcount = buf->ReadByte(); @@ -5673,10 +5673,10 @@ static void StationMapSpriteGroup(ByteRe return; } - std::vector stations; + std::vector stations; stations.reserve(idcount); for (uint i = 0; i < idcount; i++) { - stations.push_back(buf->ReadByte()); + stations.push_back(buf->ReadExtendedByte()); } uint8 cidcount = buf->ReadByte(); @@ -5731,10 +5731,10 @@ static void TownHouseMapSpriteGroup(Byte return; } - std::vector houses; + std::vector houses; houses.reserve(idcount); for (uint i = 0; i < idcount; i++) { - houses.push_back(buf->ReadByte()); + houses.push_back(buf->ReadExtendedByte()); } /* Skip the cargo type section, we only care about the default group */ @@ -5763,10 +5763,10 @@ static void IndustryMapSpriteGroup(ByteR return; } - std::vector industries; + std::vector industries; industries.reserve(idcount); for (uint i = 0; i < idcount; i++) { - industries.push_back(buf->ReadByte()); + industries.push_back(buf->ReadExtendedByte()); } /* Skip the cargo type section, we only care about the default group */ @@ -5795,10 +5795,10 @@ static void IndustrytileMapSpriteGroup(B return; } - std::vector indtiles; + std::vector indtiles; indtiles.reserve(idcount); for (uint i = 0; i < idcount; i++) { - indtiles.push_back(buf->ReadByte()); + indtiles.push_back(buf->ReadExtendedByte()); } /* Skip the cargo type section, we only care about the default group */ @@ -5822,10 +5822,10 @@ static void IndustrytileMapSpriteGroup(B static void CargoMapSpriteGroup(ByteReader *buf, uint8 idcount) { - std::vector cargoes; + std::vector cargoes; cargoes.reserve(idcount); for (uint i = 0; i < idcount; i++) { - cargoes.push_back((CargoID)buf->ReadByte()); + cargoes.push_back(buf->ReadExtendedByte()); } /* Skip the cargo type section, we only care about the default group */ @@ -5854,10 +5854,10 @@ static void ObjectMapSpriteGroup(ByteRea return; } - std::vector objects; + std::vector objects; objects.reserve(idcount); for (uint i = 0; i < idcount; i++) { - objects.push_back(buf->ReadByte()); + objects.push_back(buf->ReadExtendedByte()); } uint8 cidcount = buf->ReadByte(); @@ -5908,7 +5908,7 @@ static void RailTypeMapSpriteGroup(ByteR std::vector railtypes; railtypes.reserve(idcount); for (uint i = 0; i < idcount; i++) { - uint8 id = buf->ReadByte(); + uint16_t id = buf->ReadExtendedByte(); railtypes.push_back(id < RAILTYPE_END ? _cur.grffile->railtype_map[id] : INVALID_RAILTYPE); } @@ -5942,7 +5942,7 @@ static void RoadTypeMapSpriteGroup(ByteR std::vector roadtypes; roadtypes.reserve(idcount); for (uint i = 0; i < idcount; i++) { - uint8 id = buf->ReadByte(); + uint16_t id = buf->ReadExtendedByte(); roadtypes.push_back(id < ROADTYPE_END ? type_map[id] : INVALID_ROADTYPE); } @@ -5976,10 +5976,10 @@ static void AirportMapSpriteGroup(ByteRe return; } - std::vector airports; + std::vector airports; airports.reserve(idcount); for (uint i = 0; i < idcount; i++) { - airports.push_back(buf->ReadByte()); + airports.push_back(buf->ReadExtendedByte()); } /* Skip the cargo type section, we only care about the default group */ @@ -6008,10 +6008,10 @@ static void AirportTileMapSpriteGroup(By return; } - std::vector airptiles; + std::vector airptiles; airptiles.reserve(idcount); for (uint i = 0; i < idcount; i++) { - airptiles.push_back(buf->ReadByte()); + airptiles.push_back(buf->ReadExtendedByte()); } /* Skip the cargo type section, we only care about the default group */ @@ -6040,10 +6040,10 @@ static void RoadStopMapSpriteGroup(ByteR return; } - std::vector roadstops; + std::vector roadstops; roadstops.reserve(idcount); for (uint i = 0; i < idcount; i++) { - roadstops.push_back(buf->ReadByte()); + roadstops.push_back(buf->ReadExtendedByte()); } uint8 cidcount = buf->ReadByte(); @@ -6100,7 +6100,7 @@ static void FeatureMapSpriteGroup(ByteRe * B feature see action 0 * B n-id bits 0-6: how many IDs this definition applies to * bit 7: if set, this is a wagon override definition (see below) - * B ids the IDs for which this definition applies + * E ids the IDs for which this definition applies * B num-cid number of cargo IDs (sprite group IDs) in this definition * can be zero, in that case the def-cid is used always * B cargo-type type of this cargo type (e.g. mail=2, wood=7, see below)