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.
This commit is contained in:
Peter Nelson 2023-04-30 10:00:43 +01:00 committed by PeterN
parent 10baecd81f
commit e5c9a3e527
1 changed files with 23 additions and 23 deletions

View File

@ -5642,10 +5642,10 @@ static void VehicleMapSpriteGroup(ByteReader *buf, byte feature, uint8 idcount)
static void CanalMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
std::vector<CanalFeature> cfs;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> stations;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> houses;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> industries;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> indtiles;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
static void CargoMapSpriteGroup(ByteReader *buf, uint8 idcount)
{
std::vector<CargoID> cargoes;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> objects;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
std::vector<uint8> 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(ByteReader *buf, uint8 idcount, RoadTramType
std::vector<uint8> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> airports;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> airptiles;
std::vector<uint16_t> 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(ByteReader *buf, uint8 idcount)
return;
}
std::vector<uint8> roadstops;
std::vector<uint16_t> 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(ByteReader *buf)
* 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)