OpenTTD Source: src/object_type.h Source File

OpenTTD Source 15.0-RC2

object_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 OBJECT_TYPE_H
11#define OBJECT_TYPE_H
12
13#include "core/pool_type.hpp"
14
16 typedef uint16_t ObjectType;
17
18 static const ObjectType OBJECT_TRANSMITTER = 0;
19 static const ObjectType OBJECT_LIGHTHOUSE = 1;
20 static const ObjectType OBJECT_STATUE = 2;
21 static const ObjectType OBJECT_OWNED_LAND = 3;
22 static const ObjectType OBJECT_HQ = 4;
23
24 static const ObjectType NEW_OBJECT_OFFSET = 5;
25 static const ObjectType NUM_OBJECTS = 64000;
26 static const ObjectType NUM_OBJECTS_PER_GRF = NUM_OBJECTS;
27 static const ObjectType INVALID_OBJECT_TYPE = 0xFFFF;
28
30 using ObjectID = PoolID<uint32_t, struct ObjectIDTag, 0xFF0000, 0xFFFFFFFF>;
31
32struct Object;
33struct ObjectSpec;
34
36 enum class ObjectAnimationTrigger : uint8_t {
37 Built,
38 TileLoop,
39 TileLoopNorth,
40};
41using ObjectAnimationTriggers = EnumBitSet<ObjectAnimationTrigger, uint16_t>;
42
43#endif /* OBJECT_TYPE_H */
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
OBJECT_LIGHTHOUSE
static const ObjectType OBJECT_LIGHTHOUSE
The nice lighthouse.
Definition object_type.h:19
ObjectType
uint16_t ObjectType
Types of objects.
Definition object_type.h:16
OBJECT_STATUE
static const ObjectType OBJECT_STATUE
Statue in towns.
Definition object_type.h:20
INVALID_OBJECT_TYPE
static const ObjectType INVALID_OBJECT_TYPE
An invalid object.
Definition object_type.h:27
OBJECT_HQ
static const ObjectType OBJECT_HQ
HeadQuarter of a player.
Definition object_type.h:22
NUM_OBJECTS
static const ObjectType NUM_OBJECTS
Number of supported objects overall.
Definition object_type.h:25
OBJECT_TRANSMITTER
static const ObjectType OBJECT_TRANSMITTER
The large antenna.
Definition object_type.h:18
ObjectAnimationTrigger
ObjectAnimationTrigger
Animation triggers for objects.
Definition object_type.h:36
ObjectAnimationTrigger::Built
@ Built
Triggered when the object is built (for all tiles at the same time).
ObjectAnimationTrigger::TileLoop
@ TileLoop
Triggered in the periodic tile loop.
ObjectAnimationTrigger::TileLoopNorth
@ TileLoopNorth
Triggered every 256 ticks (for all tiles at the same time).
NUM_OBJECTS_PER_GRF
static const ObjectType NUM_OBJECTS_PER_GRF
Number of supported objects per NewGRF.
Definition object_type.h:26
NEW_OBJECT_OFFSET
static const ObjectType NEW_OBJECT_OFFSET
Offset for new objects.
Definition object_type.h:24
OBJECT_OWNED_LAND
static const ObjectType OBJECT_OWNED_LAND
Owned land 'flag'.
Definition object_type.h:21
pool_type.hpp
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
ObjectSpec
Allow incrementing of ObjectClassID variables.
Definition newgrf_object.h:60
Object
An object, such as transmitter, on the map.
Definition object_base.h:23
PoolID
Templated helper to make a PoolID a single POD value.
Definition pool_type.hpp:43