mirror of https://github.com/OpenTTD/OpenTTD
Change: [NewGRF] Implement GRFv9.
parent
0a99bf7091
commit
06029201fe
|
@ -130,7 +130,7 @@ struct IndustrySpec {
|
||||||
uint16_t callback_mask; ///< Bitmask of industry callbacks that have to be called
|
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
|
bool enabled; ///< entity still available (by default true).newgrf can disable it, though
|
||||||
GRFFileProps grf_prop; ///< properties related to the grf file
|
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_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.
|
std::array<std::variant<CargoLabel, MixedCargoType>, INDUSTRY_ORIGINAL_NUM_INPUTS> accepts_cargo_label; ///< Cargo labels of accepted cargo for default industries.
|
||||||
|
|
354
src/newgrf.cpp
354
src/newgrf.cpp
File diff suppressed because it is too large
Load Diff
|
@ -97,11 +97,11 @@ enum GrfSpecFeature {
|
||||||
static const uint32_t INVALID_GRFID = 0xFFFFFFFF;
|
static const uint32_t INVALID_GRFID = 0xFFFFFFFF;
|
||||||
|
|
||||||
struct GRFLabel {
|
struct GRFLabel {
|
||||||
uint8_t label;
|
uint16_t label;
|
||||||
uint32_t nfo_line;
|
uint32_t nfo_line;
|
||||||
size_t pos;
|
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 */
|
/** Dynamic data of a loaded NewGRF */
|
||||||
|
|
|
@ -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.
|
* For GRF version >= 7 \a cargo is always a translated cargo bit.
|
||||||
* @return CargoID or INVALID_CARGO if the cargo is not available.
|
* @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. */
|
/* 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.. */
|
/* Pre-version 7 uses the bitnum lookup from (standard in v8) instead of climate dependent in some places.. */
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct GRFFile;
|
||||||
|
|
||||||
SpriteID GetCustomCargoSprite(const CargoSpec *cs);
|
SpriteID GetCustomCargoSprite(const CargoSpec *cs);
|
||||||
uint16_t GetCargoCallback(CallbackID callback, uint32_t param1, uint32_t param2, 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> GetClimateDependentCargoTranslationTable();
|
||||||
std::span<const CargoLabel> GetClimateIndependentCargoTranslationTable();
|
std::span<const CargoLabel> GetClimateIndependentCargoTranslationTable();
|
||||||
|
|
|
@ -268,7 +268,7 @@ const SpriteGroup *RandomizedSpriteGroup::Resolve(ResolverObject &object) const
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t mask = ((uint)this->groups.size() - 1) << this->lowest_randbit;
|
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);
|
return SpriteGroup::Resolve(this->groups[index], object, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,8 +148,8 @@ struct DeterministicSpriteGroupAdjust {
|
||||||
DeterministicSpriteGroupAdjustOperation operation;
|
DeterministicSpriteGroupAdjustOperation operation;
|
||||||
DeterministicSpriteGroupAdjustType type;
|
DeterministicSpriteGroupAdjustType type;
|
||||||
uint8_t variable;
|
uint8_t variable;
|
||||||
uint8_t parameter; ///< Used for variables between 0x60 and 0x7F inclusive.
|
|
||||||
uint8_t shift_num;
|
uint8_t shift_num;
|
||||||
|
uint32_t parameter; ///< Used for variables between 0x60 and 0x7F inclusive.
|
||||||
uint32_t and_mask;
|
uint32_t and_mask;
|
||||||
uint32_t add_val;
|
uint32_t add_val;
|
||||||
uint32_t divmod_val;
|
uint32_t divmod_val;
|
||||||
|
|
|
@ -1032,16 +1032,16 @@ static const std::vector<IndustryTileLayout> _tile_table_sugar_mine {
|
||||||
#undef MK
|
#undef MK
|
||||||
|
|
||||||
/** Array with saw sound, for sawmill */
|
/** 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 */
|
/** 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 */
|
/** 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 */
|
/** 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 {
|
enum IndustryTypes {
|
||||||
IT_COAL_MINE = 0,
|
IT_COAL_MINE = 0,
|
||||||
|
|
Loading…
Reference in New Issue