OpenTTD Source: src/newgrf_cargo.h Source File

OpenTTD Source 14.0-beta3

newgrf_cargo.h
Go to the documentation of this file.
1 /*
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/>.
6 */
7
10 #ifndef NEWGRF_CARGO_H
11 #define NEWGRF_CARGO_H
12
13 #include "newgrf_callbacks.h"
14 #include "cargo_type.h"
15 #include "gfx_type.h"
16
22 namespace SpriteGroupCargo {
23 static constexpr CargoID SG_DEFAULT = NUM_CARGO;
24 static constexpr CargoID SG_PURCHASE = NUM_CARGO + 1;
25 static constexpr CargoID SG_DEFAULT_NA = NUM_CARGO + 2;
26 };
27
28 /* Forward declarations of structs used */
29 struct CargoSpec;
30 struct GRFFile;
31
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);
35
36 #endif /* NEWGRF_CARGO_H */
GetCustomCargoSprite
SpriteID GetCustomCargoSprite(const CargoSpec *cs)
Get the custom sprite for the given cargo type.
Definition: newgrf_cargo.cpp:54
newgrf_callbacks.h
CargoSpec
Specification of a cargo type.
Definition: cargotype.h:68
CallbackID
CallbackID
List of implemented NewGRF callbacks.
Definition: newgrf_callbacks.h:20
cargo_type.h
SpriteGroupCargo::SG_DEFAULT
static constexpr CargoID SG_DEFAULT
Default type used when no more-specific cargo matches.
Definition: newgrf_cargo.h:23
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
GetCargoTranslation
CargoID GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit=false)
Translate a GRF-local cargo slot/bitnum into a CargoID.
Definition: newgrf_cargo.cpp:79
SpriteGroupCargo::SG_PURCHASE
static constexpr CargoID SG_PURCHASE
Used in purchase lists before an item exists.
Definition: newgrf_cargo.h:24
SpriteGroupCargo
Sprite Group Cargo types.
Definition: newgrf_cargo.h:22
SpriteGroupCargo::SG_DEFAULT_NA
static constexpr CargoID SG_DEFAULT_NA
Used only by stations and roads when no more-specific cargo matches.
Definition: newgrf_cargo.h:25
NUM_CARGO
static const CargoID NUM_CARGO
Maximum number of cargo types in a game.
Definition: cargo_type.h:74
gfx_type.h
GRFFile
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:107