Codechange: Use GrfSpecFeature type instead of uint8_t. (#14253)

This commit is contained in:
Peter Nelson
2025-05-12 08:44:39 +01:00
committed by GitHub
parent 2516c435b7
commit 0aacd7acb3
16 changed files with 69 additions and 66 deletions
+5 -5
View File
@@ -33,7 +33,7 @@
#include "../safeguards.h"
static CargoType TranslateCargo(uint8_t feature, uint8_t ctype)
static CargoType TranslateCargo(GrfSpecFeature feature, uint8_t ctype)
{
/* Special cargo types for purchase list and stations */
if ((feature == GSF_STATIONS || feature == GSF_ROADSTOPS) && ctype == 0xFE) return CargoGRFFileProps::SG_DEFAULT_NA;
@@ -75,7 +75,7 @@ static bool IsValidGroupID(uint16_t groupid, std::string_view function)
return true;
}
static void VehicleMapSpriteGroup(ByteReader &buf, uint8_t feature, uint8_t idcount)
static void VehicleMapSpriteGroup(ByteReader &buf, GrfSpecFeature feature, uint8_t idcount)
{
static std::vector<EngineID> last_engines; // Engine IDs are remembered in case the next action is a wagon override.
bool wagover = false;
@@ -104,7 +104,7 @@ static void VehicleMapSpriteGroup(ByteReader &buf, uint8_t feature, uint8_t idco
/* No engine could be allocated?!? Deal with it. Okay,
* this might look bad. Also make sure this NewGRF
* gets disabled, as a half loaded one is bad. */
HandleChangeInfoResult("VehicleMapSpriteGroup", CIR_INVALID_ID, 0, 0);
HandleChangeInfoResult("VehicleMapSpriteGroup", CIR_INVALID_ID, feature, 0);
return;
}
@@ -714,7 +714,7 @@ static void FeatureMapSpriteGroup(ByteReader &buf)
* W cid cargo ID (sprite group ID) for this type of cargo
* W def-cid default cargo ID (sprite group ID) */
uint8_t feature = buf.ReadByte();
GrfSpecFeature feature{buf.ReadByte()};
uint8_t idcount = buf.ReadByte();
if (feature >= GSF_END) {
@@ -736,7 +736,7 @@ static void FeatureMapSpriteGroup(ByteReader &buf)
}
/* Mark the feature as used by the grf (generic callbacks do not count) */
SetBit(_cur_gps.grffile->grf_features, feature);
_cur_gps.grffile->grf_features.Set(feature);
GrfMsg(6, "FeatureMapSpriteGroup: Feature 0x{:02X}, {} ids", feature, idcount);