1
0
Fork 0

Change: [NewGRF] Implement GRFv9.

pull/13309/head
Peter Nelson 2025-01-10 13:00:16 +00:00
parent 0a99bf7091
commit 06029201fe
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
8 changed files with 227 additions and 161 deletions

View File

@ -130,7 +130,7 @@ struct IndustrySpec {
uint16_t callback_mask; ///< Bitmask of industry callbacks that have to be called
bool enabled; ///< entity still available (by default true).newgrf can disable it, though
GRFFileProps grf_prop; ///< properties related to the grf file
std::vector<uint8_t> random_sounds; ///< Random sounds;
std::vector<uint16_t> random_sounds; ///< Random sounds;
std::array<std::variant<CargoLabel, MixedCargoType>, INDUSTRY_ORIGINAL_NUM_OUTPUTS> produced_cargo_label; ///< Cargo labels of produced cargo for default industries.
std::array<std::variant<CargoLabel, MixedCargoType>, INDUSTRY_ORIGINAL_NUM_INPUTS> accepts_cargo_label; ///< Cargo labels of accepted cargo for default industries.

File diff suppressed because it is too large Load Diff

View File

@ -97,11 +97,11 @@ enum GrfSpecFeature {
static const uint32_t INVALID_GRFID = 0xFFFFFFFF;
struct GRFLabel {
uint8_t label;
uint16_t label;
uint32_t nfo_line;
size_t pos;
GRFLabel(uint8_t label, uint32_t nfo_line, size_t pos) : label(label), nfo_line(nfo_line), pos(pos) {}
GRFLabel(uint16_t label, uint32_t nfo_line, size_t pos) : label(label), nfo_line(nfo_line), pos(pos) {}
};
/** Dynamic data of a loaded NewGRF */

View File

@ -77,7 +77,7 @@ uint16_t GetCargoCallback(CallbackID callback, uint32_t param1, uint32_t param2,
* For GRF version >= 7 \a cargo is always a translated cargo bit.
* @return CargoID or INVALID_CARGO if the cargo is not available.
*/
CargoID GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit)
CargoID GetCargoTranslation(uint16_t cargo, const GRFFile *grffile, bool usebit)
{
/* We can't use GetCargoTranslationTable here as the usebit flag changes behviour. */
/* Pre-version 7 uses the bitnum lookup from (standard in v8) instead of climate dependent in some places.. */

View File

@ -31,7 +31,7 @@ struct GRFFile;
SpriteID GetCustomCargoSprite(const CargoSpec *cs);
uint16_t GetCargoCallback(CallbackID callback, uint32_t param1, uint32_t param2, const CargoSpec *cs);
CargoID GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit = false);
CargoID GetCargoTranslation(uint16_t cargo, const GRFFile *grffile, bool usebit = false);
std::span<const CargoLabel> GetClimateDependentCargoTranslationTable();
std::span<const CargoLabel> GetClimateIndependentCargoTranslationTable();

View File

@ -268,7 +268,7 @@ const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const
}
uint32_t mask = ((uint)this->groups.size() - 1) << this->lowest_randbit;
uint8_t index = (scope->GetRandomBits() & mask) >> this->lowest_randbit;
uint16_t index = (scope->GetRandomBits() & mask) >> this->lowest_randbit;
return SpriteGroup::Resolve(this->groups[index], object, false);
}

View File

@ -148,8 +148,8 @@ struct DeterministicSpriteGroupAdjust {
DeterministicSpriteGroupAdjustOperation operation;
DeterministicSpriteGroupAdjustType type;
uint8_t variable;
uint8_t parameter; ///< Used for variables between 0x60 and 0x7F inclusive.
uint8_t shift_num;
uint32_t parameter; ///< Used for variables between 0x60 and 0x7F inclusive.
uint32_t and_mask;
uint32_t add_val;
uint32_t divmod_val;

View File

@ -1032,16 +1032,16 @@ static const std::vector<IndustryTileLayout> _tile_table_sugar_mine {
#undef MK
/** Array with saw sound, for sawmill */
static const std::initializer_list<uint8_t> _sawmill_sounds = { SND_28_SAWMILL };
static const std::initializer_list<uint16_t> _sawmill_sounds = { SND_28_SAWMILL };
/** Array with whistle sound, for factory */
static const std::initializer_list<uint8_t> _factory_sounds = { SND_03_FACTORY };
static const std::initializer_list<uint16_t> _factory_sounds = { SND_03_FACTORY };
/** Array with 3 animal sounds, for farms */
static const std::initializer_list<uint8_t> _farm_sounds = { SND_24_FARM_1, SND_25_FARM_2, SND_26_FARM_3 };
static const std::initializer_list<uint16_t> _farm_sounds = { SND_24_FARM_1, SND_25_FARM_2, SND_26_FARM_3 };
/** Array with... hem... a sound of toyland */
static const std::initializer_list<uint8_t> _plastic_mine_sounds = { SND_33_PLASTIC_MINE };
static const std::initializer_list<uint16_t> _plastic_mine_sounds = { SND_33_PLASTIC_MINE };
enum IndustryTypes {
IT_COAL_MINE = 0,