34 return this->cargospec->
label.base();
45 :
ResolverObject(cs->grffile, callback, callback_param1, callback_param2), cargospec(cs)
59 if (group ==
nullptr)
return 0;
61 return group->GetResult();
65 uint16_t GetCargoCallback(
CallbackID callback, uint32_t param1, uint32_t param2,
const CargoSpec *cs)
68 return object.ResolveCallback();
83 if (grffile->grf_version < 7 && usebit) {
85 if (cargo < default_table.size())
return GetCargoIDByLabel(default_table[cargo]);
90 if (cargo < grffile->cargo_list.size())
return GetCargoIDByLabel(grffile->
cargo_list[cargo]);
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
std::span< const CargoLabel > GetDefaultCargoTranslationTable(uint8_t grf_version)
Get default cargo translation table for a NewGRF, used if the NewGRF does not provide its own.
Functions related to debugging.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
CallbackID
List of implemented NewGRF callbacks.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
SpriteID GetCustomCargoSprite(const CargoSpec *cs)
Get the custom sprite for the given cargo type.
CargoID GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit)
Translate a GRF-local cargo slot/bitnum into a CargoID.
Cargo support for NewGRFs.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
CargoResolverObject(const CargoSpec *cs, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Constructor of the cargo resolver.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
Specification of a cargo type.
CargoLabel label
Unique label of the cargo type.
Dynamic data of a loaded NewGRF.
std::vector< CargoLabel > cargo_list
Cargo translation table (local ID -> label)
Interface for SpriteGroup-s to access the gamestate.
uint32_t callback_param2
Second parameter (var 18) of the callback.
CallbackID callback
Callback being resolved.
uint32_t callback_param1
First parameter (var 10) of the callback.
const SpriteGroup * root_spritegroup
Root SpriteGroup to use for resolving.
virtual const SpriteGroup * Resolve([[maybe_unused]] ResolverObject &object) const
Base sprite group resolver.