OpenTTD Source 20261112-master-gbcbec5e63f
cargo_const.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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#include "../table/sprites.h"
11#ifndef CHECK_UNUSED_STRINGS
12#include "table/strings.h"
13#endif
14
16#define MK_STR_CARGO_PLURAL(label_plural) STR_CARGO_PLURAL_ ## label_plural
17#define MK_STR_CARGO_SINGULAR(label_singular) STR_CARGO_SINGULAR_ ## label_singular
18#define MK_STR_QUANTITY(label_plural) STR_QUANTITY_ ## label_plural
19#define MK_STR_ABBREV(label_plural) STR_ABBREV_ ## label_plural
21#define MK_SPRITE(label_plural) SPR_CARGO_ ## label_plural
22
51#define MK(bt, label, colour, weight, mult, ip, td1, td2, freight, tae, str_plural, str_singular, str_volume, classes) \
52 {label, bt, PixelColour{colour}, PixelColour{colour}, weight, mult, classes, ip, {td1, td2}, freight, tae, TownProductionEffect::Invalid, TOWN_PRODUCTION_DIVISOR, CargoCallbackMasks{}, \
53 MK_STR_CARGO_PLURAL(str_plural), MK_STR_CARGO_SINGULAR(str_singular), str_volume, MK_STR_QUANTITY(str_plural), MK_STR_ABBREV(str_plural), \
54 MK_SPRITE(str_plural), nullptr, nullptr, 0}
55
57static const CargoSpec _default_cargo[] = {
58 MK( 0, CT_PASSENGERS, 152, 1, 0x400, 3185, 0, 24, false, TownAcceptanceEffect::Passengers, PASSENGERS, PASSENGER, STR_PASSENGERS, CargoClasses({CargoClass::Passengers})),
59 MK( 1, CT_COAL, 6, 16, 0x100, 5916, 7, 255, true, TownAcceptanceEffect::None, COAL, COAL, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::NonPotable})),
60 MK( 2, CT_MAIL, 15, 4, 0x200, 4550, 20, 90, false, TownAcceptanceEffect::Mail, MAIL, MAIL, STR_BAGS, CargoClasses({CargoClass::Mail})),
61 /* Oil in temperate and arctic */
62 MK( 3, CT_OIL, 174, 16, 0x100, 4437, 25, 255, true, TownAcceptanceEffect::None, OIL, OIL, STR_LITERS, CargoClasses({CargoClass::Liquid, CargoClass::NonPotable})),
63 /* Oil in subtropic */
64 MK( 3, CT_OIL, 174, 16, 0x100, 4892, 25, 255, true, TownAcceptanceEffect::None, OIL, OIL, STR_LITERS, CargoClasses({CargoClass::Liquid, CargoClass::NonPotable})),
65 MK( 4, CT_LIVESTOCK, 208, 3, 0x100, 4322, 4, 18, true, TownAcceptanceEffect::None, LIVESTOCK, LIVESTOCK, STR_ITEMS, CargoClasses({CargoClass::PieceGoods, CargoClass::NonPotable})),
66 MK( 5, CT_GOODS, 194, 8, 0x200, 6144, 5, 28, true, TownAcceptanceEffect::Goods, GOODS, GOODS, STR_CRATES, CargoClasses({CargoClass::Express})),
67 MK( 6, CT_GRAIN, 191, 16, 0x100, 4778, 4, 40, true, TownAcceptanceEffect::None, GRAIN, GRAIN, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::Potable})),
68 MK( 6, CT_WHEAT, 191, 16, 0x100, 4778, 4, 40, true, TownAcceptanceEffect::None, WHEAT, WHEAT, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::Potable})),
69 MK( 6, CT_MAIZE, 191, 16, 0x100, 4322, 4, 40, true, TownAcceptanceEffect::None, MAIZE, MAIZE, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::Potable})),
70 /* Wood in temperate and arctic */
71 MK( 7, CT_WOOD, 84, 16, 0x100, 5005, 15, 255, true, TownAcceptanceEffect::None, WOOD, WOOD, STR_TONS, CargoClasses({CargoClass::PieceGoods})),
72 /* Wood in subtropic */
73 MK( 7, CT_WOOD, 84, 16, 0x100, 7964, 15, 255, true, TownAcceptanceEffect::None, WOOD, WOOD, STR_TONS, CargoClasses({CargoClass::PieceGoods})),
74 MK( 8, CT_IRON_ORE, 184, 16, 0x100, 5120, 9, 255, true, TownAcceptanceEffect::None, IRON_ORE, IRON_ORE, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::NonPotable})),
75 MK( 9, CT_STEEL, 10, 16, 0x100, 5688, 7, 255, true, TownAcceptanceEffect::None, STEEL, STEEL, STR_TONS, CargoClasses({CargoClass::PieceGoods})),
76 MK( 10, CT_VALUABLES, 202, 2, 0x100, 7509, 1, 32, true, TownAcceptanceEffect::None, VALUABLES, VALUABLES, STR_BAGS, CargoClasses({CargoClass::Armoured})),
77 MK( 10, CT_GOLD, 202, 8, 0x100, 5802, 10, 40, true, TownAcceptanceEffect::None, GOLD, GOLD, STR_BAGS, CargoClasses({CargoClass::Armoured})),
78 MK( 10, CT_DIAMONDS, 202, 2, 0x100, 5802, 10, 255, true, TownAcceptanceEffect::None, DIAMONDS, DIAMOND, STR_BAGS, CargoClasses({CargoClass::Armoured})),
79 MK( 11, CT_PAPER, 10, 16, 0x100, 5461, 7, 60, true, TownAcceptanceEffect::None, PAPER, PAPER, STR_TONS, CargoClasses({CargoClass::PieceGoods})),
80 MK( 12, CT_FOOD, 48, 16, 0x100, 5688, 0, 30, true, TownAcceptanceEffect::Food, FOOD, FOOD, STR_TONS, CargoClasses({CargoClass::Express, CargoClass::Refrigerated, CargoClass::Potable})),
81 MK( 13, CT_FRUIT, 208, 16, 0x100, 4209, 0, 15, true, TownAcceptanceEffect::None, FRUIT, FRUIT, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::Refrigerated, CargoClass::Potable})),
82 MK( 14, CT_COPPER_ORE, 184, 16, 0x100, 4892, 12, 255, true, TownAcceptanceEffect::None, COPPER_ORE, COPPER_ORE, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::NonPotable})),
83 MK( 15, CT_WATER, 10, 16, 0x100, 4664, 20, 80, true, TownAcceptanceEffect::Water, WATER, WATER, STR_LITERS, CargoClasses({CargoClass::Liquid, CargoClass::Potable})),
84 MK( 16, CT_RUBBER, 6, 16, 0x100, 4437, 2, 20, true, TownAcceptanceEffect::None, RUBBER, RUBBER, STR_LITERS, CargoClasses({CargoClass::Liquid, CargoClass::NonPotable})),
85 MK( 17, CT_SUGAR, 6, 16, 0x100, 4437, 20, 255, true, TownAcceptanceEffect::None, SUGAR, SUGAR, STR_TONS, CargoClasses({CargoClass::Bulk, CargoClass::Potable})),
86 MK( 18, CT_TOYS, 174, 2, 0x100, 5574, 25, 255, true, TownAcceptanceEffect::None, TOYS, TOY, STR_ITEMS, CargoClasses({CargoClass::PieceGoods})),
87 MK( 19, CT_BATTERIES, 208, 4, 0x100, 4322, 2, 30, true, TownAcceptanceEffect::None, BATTERIES, BATTERY, STR_ITEMS, CargoClasses({CargoClass::PieceGoods})),
88 MK( 20, CT_CANDY, 194, 5, 0x200, 6144, 8, 40, true, TownAcceptanceEffect::Goods, SWEETS, SWEETS, STR_BAGS, CargoClasses({CargoClass::Express})),
89 MK( 21, CT_TOFFEE, 191, 16, 0x100, 4778, 14, 60, true, TownAcceptanceEffect::None, TOFFEE, TOFFEE, STR_TONS, CargoClasses({CargoClass::Bulk})),
90 MK( 22, CT_COLA, 84, 16, 0x100, 4892, 5, 75, true, TownAcceptanceEffect::None, COLA, COLA, STR_LITERS, CargoClasses({CargoClass::Liquid})),
91 MK( 23, CT_COTTON_CANDY, 184, 16, 0x100, 5005, 10, 25, true, TownAcceptanceEffect::None, CANDYFLOSS, CANDYFLOSS, STR_TONS, CargoClasses({CargoClass::Bulk})),
92 MK( 24, CT_BUBBLES, 10, 1, 0x100, 5077, 20, 80, true, TownAcceptanceEffect::None, BUBBLES, BUBBLE, STR_ITEMS, CargoClasses({CargoClass::PieceGoods})),
93 MK( 25, CT_PLASTIC, 202, 16, 0x100, 4664, 30, 255, true, TownAcceptanceEffect::None, PLASTIC, PLASTIC, STR_LITERS, CargoClasses({CargoClass::Liquid})),
94 MK( 26, CT_FIZZY_DRINKS, 48, 2, 0x100, 6250, 30, 50, true, TownAcceptanceEffect::Food, FIZZY_DRINKS, FIZZY_DRINK, STR_ITEMS, CargoClasses({CargoClass::PieceGoods})),
95
96 /* Void slot in temperate */
97 MK(0xFF, CT_INVALID, 1, 0, 0x100, 5688, 0, 30, true, TownAcceptanceEffect::None, NOTHING, NOTHING, STR_TONS, CargoClasses({})),
98 /* Void slot in arctic */
99 MK(0xFF, CT_INVALID, 184, 0, 0x100, 5120, 9, 255, true, TownAcceptanceEffect::None, NOTHING, NOTHING, STR_TONS, CargoClasses({})),
100};
101
102
110
#define MK(bt, label, colour, weight, mult, ip, td1, td2, freight, tae, str_plural, str_singular, str_volume, classes)
Construction macro for a CargoSpec structure.
Definition cargo_const.h:51
static const CargoSpec _default_cargo[]
Cargo types available by default.
Definition cargo_const.h:57
static const std::variant< CargoLabel, int > _default_climate_cargo[NUM_LANDSCAPE][NUM_ORIGINAL_CARGO]
Table of cargo types available in each climate, by default.
static constexpr CargoLabel CT_INVALID
Invalid cargo type.
Definition cargo_type.h:74
static constexpr CargoLabel CT_PLASTIC
Cargo label for plastic.
Definition cargo_type.h:67
static constexpr CargoLabel CT_WATER
Cargo label for water.
Definition cargo_type.h:55
static constexpr CargoLabel CT_RUBBER
Cargo label for rubber.
Definition cargo_type.h:51
static constexpr CargoLabel CT_BUBBLES
Cargo label for bubbles.
Definition cargo_type.h:66
static constexpr CargoLabel CT_GRAIN
Cargo label for grain.
Definition cargo_type.h:38
static constexpr CargoLabel CT_IRON_ORE
Cargo label for iron ore.
Definition cargo_type.h:40
static constexpr CargoLabel CT_COAL
Cargo label for coal.
Definition cargo_type.h:33
static constexpr CargoLabel CT_FOOD
Cargo label for food.
Definition cargo_type.h:48
static constexpr CargoType NUM_ORIGINAL_CARGO
Original number of cargo types.
Definition cargo_type.h:76
static constexpr CargoLabel CT_MAIL
Cargo label for mail.
Definition cargo_type.h:34
static constexpr CargoLabel CT_TOYS
Cargo label for toys.
Definition cargo_type.h:60
static constexpr CargoLabel CT_WOOD
Cargo label for wood.
Definition cargo_type.h:39
static constexpr CargoLabel CT_WHEAT
Cargo label for wheat.
Definition cargo_type.h:45
static constexpr CargoLabel CT_CANDY
Cargo label for candies/sweets.
Definition cargo_type.h:62
static constexpr CargoLabel CT_GOODS
Cargo label for goods.
Definition cargo_type.h:37
static constexpr CargoLabel CT_PASSENGERS
Cargo label for passengers.
Definition cargo_type.h:32
static constexpr CargoLabel CT_MAIZE
Cargo label for maize.
Definition cargo_type.h:53
static constexpr CargoLabel CT_PAPER
Cargo label for paper.
Definition cargo_type.h:46
static constexpr CargoLabel CT_LIVESTOCK
Cargo label for livestock.
Definition cargo_type.h:36
static constexpr CargoLabel CT_VALUABLES
Cargo label for valuables.
Definition cargo_type.h:42
static constexpr CargoLabel CT_BATTERIES
Cargo label for batteries.
Definition cargo_type.h:61
static constexpr CargoLabel CT_TOFFEE
Cargo label for toffee.
Definition cargo_type.h:63
static constexpr CargoLabel CT_OIL
Cargo label for oil.
Definition cargo_type.h:35
static constexpr CargoLabel CT_GOLD
Cargo label for gold.
Definition cargo_type.h:47
static constexpr CargoLabel CT_FRUIT
Cargo label for fruits.
Definition cargo_type.h:52
static constexpr CargoLabel CT_SUGAR
Cargo label for sugar.
Definition cargo_type.h:59
static constexpr CargoLabel CT_FIZZY_DRINKS
Cargo label for fizzy drinks.
Definition cargo_type.h:68
static constexpr CargoLabel CT_DIAMONDS
Cargo label for diamonds.
Definition cargo_type.h:56
static constexpr CargoLabel CT_STEEL
Cargo label for steel.
Definition cargo_type.h:41
static constexpr CargoLabel CT_COLA
Cargo label for cola.
Definition cargo_type.h:64
static constexpr CargoLabel CT_COPPER_ORE
Cargo label for copper ore.
Definition cargo_type.h:54
static constexpr CargoLabel CT_COTTON_CANDY
Cargo label for cotton candies.
Definition cargo_type.h:65
@ NonPotable
Non-potable / non-food / dirty.
Definition cargotype.h:64
@ Bulk
Bulk cargo (Coal, Grain etc., Ores, Fruit).
Definition cargotype.h:54
@ Mail
Mail.
Definition cargotype.h:51
@ Liquid
Liquids (Oil, Water, Rubber).
Definition cargotype.h:56
@ Passengers
Passengers.
Definition cargotype.h:50
@ Potable
Potable / food / clean.
Definition cargotype.h:63
@ Armoured
Armoured cargo (Valuables, Gold, Diamonds).
Definition cargotype.h:53
@ Refrigerated
Refrigerated cargo (Food, Fruit).
Definition cargotype.h:57
@ Express
Express cargo (Goods, Food, Candy, but also possible for passengers).
Definition cargotype.h:52
@ PieceGoods
Piece goods (Livestock, Wood, Steel, Paper).
Definition cargotype.h:55
EnumBitSet< CargoClass, uint16_t > CargoClasses
Bitset of CargoClass elements.
Definition cargotype.h:69
@ Food
Cargo behaves food/fizzy-drinks-like.
Definition cargotype.h:28
@ Water
Cargo behaves water-like.
Definition cargotype.h:27
@ Mail
Cargo behaves mail-like.
Definition cargotype.h:25
@ Passengers
Cargo behaves passenger-like.
Definition cargotype.h:24
@ None
Cargo has no effect.
Definition cargotype.h:23
@ Goods
Cargo behaves goods/candy-like.
Definition cargotype.h:26
This file contains all sprite-related enums and defines.
Specification of a cargo type.
Definition cargotype.h:76