OpenTTD Source: src/industry_type.h Source File

OpenTTD Source 15.0-RC2

industry_type.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
10#ifndef INDUSTRY_TYPE_H
11#define INDUSTRY_TYPE_H
12
13#include "core/pool_type.hpp"
14
15using IndustryID = PoolID<uint16_t, struct IndustryIDTag, 64000, 0xFFFF>;
16
17typedef uint16_t IndustryGfx;
18typedef uint8_t IndustryType;
19struct Industry;
20
21struct IndustrySpec;
22struct IndustryTileSpec;
23
25 enum class IndustryRandomTrigger : uint8_t {
26 TileLoop,
27 IndustryTick,
28 CargoReceived,
29};
30using IndustryRandomTriggers = EnumBitSet<IndustryRandomTrigger, uint8_t>;
31
33 enum class IndustryAnimationTrigger : uint8_t {
34 ConstructionStageChanged,
35 TileLoop,
36 IndustryTick,
37 CargoReceived,
38 CargoDistributed,
39};
40using IndustryAnimationTriggers = EnumBitSet<IndustryAnimationTrigger, uint8_t>;
41
42 static const IndustryType NUM_INDUSTRYTYPES_PER_GRF = 128;
43
44 static const IndustryType NEW_INDUSTRYOFFSET = 37;
45 static const IndustryType NUM_INDUSTRYTYPES = 240;
46static const IndustryType IT_INVALID = 0xFF;
47
48 static const IndustryGfx NUM_INDUSTRYTILES_PER_GRF = 255;
49
50 static const IndustryGfx INDUSTRYTILE_NOANIM = 0xFF;
51 static const IndustryGfx NEW_INDUSTRYTILEOFFSET = 175;
52 static const IndustryGfx NUM_INDUSTRYTILES = 512;
53 static const IndustryGfx INVALID_INDUSTRYTILE = NUM_INDUSTRYTILES;
54
55 static const int INDUSTRY_COMPLETED = 3;
56
57 static const int INDUSTRY_NUM_INPUTS = 16;
58 static const int INDUSTRY_NUM_OUTPUTS = 16;
59 static const int INDUSTRY_ORIGINAL_NUM_INPUTS = 3;
60 static const int INDUSTRY_ORIGINAL_NUM_OUTPUTS = 2;
61
62
63void CheckIndustries();
64
65#endif /* INDUSTRY_TYPE_H */
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
NEW_INDUSTRYTILEOFFSET
static const IndustryGfx NEW_INDUSTRYTILEOFFSET
original number of tiles
Definition industry_type.h:51
INDUSTRYTILE_NOANIM
static const IndustryGfx INDUSTRYTILE_NOANIM
flag to mark industry tiles as having no animation
Definition industry_type.h:50
IndustryRandomTrigger
IndustryRandomTrigger
Available industry random triggers.
Definition industry_type.h:25
IndustryRandomTrigger::IndustryTick
@ IndustryTick
The industry has been triggered via its tick.
IndustryRandomTrigger::TileLoop
@ TileLoop
The tile of the industry has been triggered during the tileloop.
IndustryRandomTrigger::CargoReceived
@ CargoReceived
Cargo has been delivered.
NEW_INDUSTRYOFFSET
static const IndustryType NEW_INDUSTRYOFFSET
original number of industry types
Definition industry_type.h:44
INDUSTRY_ORIGINAL_NUM_INPUTS
static const int INDUSTRY_ORIGINAL_NUM_INPUTS
Original number of accepted cargo types.
Definition industry_type.h:59
INDUSTRY_NUM_OUTPUTS
static const int INDUSTRY_NUM_OUTPUTS
Number of cargo types an industry can produce.
Definition industry_type.h:58
NUM_INDUSTRYTILES_PER_GRF
static const IndustryGfx NUM_INDUSTRYTILES_PER_GRF
Maximum number of industry tiles per NewGRF; limited to 255 to allow extending Action3 with an extend...
Definition industry_type.h:48
INDUSTRY_NUM_INPUTS
static const int INDUSTRY_NUM_INPUTS
Number of cargo types an industry can accept.
Definition industry_type.h:57
NUM_INDUSTRYTYPES
static const IndustryType NUM_INDUSTRYTYPES
total number of industry types, new and old; limited to 240 because we need some special ids like IT_...
Definition industry_type.h:45
INVALID_INDUSTRYTILE
static const IndustryGfx INVALID_INDUSTRYTILE
one above amount is considered invalid
Definition industry_type.h:53
CheckIndustries
void CheckIndustries()
Verify whether the generated industries are complete, and warn the user if not.
Definition industry_cmd.cpp:3159
INDUSTRY_ORIGINAL_NUM_OUTPUTS
static const int INDUSTRY_ORIGINAL_NUM_OUTPUTS
Original number of produced cargo types.
Definition industry_type.h:60
IndustryAnimationTrigger
IndustryAnimationTrigger
Animation triggers of the industries.
Definition industry_type.h:33
IndustryAnimationTrigger::CargoDistributed
@ CargoDistributed
Trigger when cargo is distributed.
IndustryAnimationTrigger::ConstructionStageChanged
@ ConstructionStageChanged
Trigger whenever the construction stage changes.
NUM_INDUSTRYTILES
static const IndustryGfx NUM_INDUSTRYTILES
total number of industry tiles, new and old
Definition industry_type.h:52
INDUSTRY_COMPLETED
static const int INDUSTRY_COMPLETED
final stage of industry construction.
Definition industry_type.h:55
NUM_INDUSTRYTYPES_PER_GRF
static const IndustryType NUM_INDUSTRYTYPES_PER_GRF
maximum number of industry types per NewGRF; limited to 128 because bit 7 has a special meaning in so...
Definition industry_type.h:42
pool_type.hpp
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
IndustrySpec
Defines the data structure for constructing industry.
Definition industrytype.h:103
IndustryTileSpec
Defines the data structure of each individual tile of an industry.
Definition industrytype.h:152
Industry
Defines the internal data of a functional industry.
Definition industry.h:62
PoolID
Templated helper to make a PoolID a single POD value.
Definition pool_type.hpp:43