2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file newgrf_cargo.h Cargo support for NewGRFs. */
10 #ifndef NEWGRF_CARGO_H
11 #define NEWGRF_CARGO_H
13 #include "newgrf_callbacks.h"
14 #include "cargo_type.h"
18 * Sprite Group Cargo types.
19 * These special cargo types are used when resolving sprite groups when non-cargo-specific sprites or callbacks are needed,
20 * e.g. in purchase lists, or if no specific cargo type sprite group is supplied.
22 namespace SpriteGroupCargo
{
23 static constexpr CargoID SG_DEFAULT
= NUM_CARGO
; ///< Default type used when no more-specific cargo matches.
24 static constexpr CargoID SG_PURCHASE
= NUM_CARGO
+ 1; ///< Used in purchase lists before an item exists.
25 static constexpr CargoID SG_DEFAULT_NA
= NUM_CARGO
+ 2; ///< Used only by stations and roads when no more-specific cargo matches.
28 /* Forward declarations of structs used */
32 SpriteID
GetCustomCargoSprite(const CargoSpec
*cs
);
33 uint16_t GetCargoCallback(CallbackID callback
, uint32_t param1
, uint32_t param2
, const CargoSpec
*cs
);
34 CargoID
GetCargoTranslation(uint8_t cargo
, const GRFFile
*grffile
, bool usebit
= false);
36 std::span
<const CargoLabel
> GetDefaultCargoTranslationTable(uint8_t grf_version
);
38 #endif /* NEWGRF_CARGO_H */