OpenTTD Source 20261123-master-g1c55c72fd0
signs_base.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#ifndef SIGNS_BASE_H
11#define SIGNS_BASE_H
12
13#include "gfx_type.h"
14#include "signs_type.h"
15#include "viewport_type.h"
16#include "core/pool_type.hpp"
17#include "company_type.h"
18
19typedef Pool<Sign, SignID, 16> SignPool;
20extern SignPool _sign_pool;
21
22struct Sign : SignPool::PoolItem<&_sign_pool> {
23 std::string name{};
25 int32_t x = 0;
26 int32_t y = 0;
27 int32_t z = 0;
30
31 Sign(SignID index) : SignPool::PoolItem<&_sign_pool>(index) {}
32 Sign(SignID index, Owner owner, int32_t x, int32_t y, int32_t z, const std::string &name) :
33 SignPool::PoolItem<&_sign_pool>(index), name(name), x(x), y(y), z(z), owner(owner) {}
34 ~Sign();
35
36 void UpdateVirtCoord();
37};
38
39#endif /* SIGNS_BASE_H */
Types related to companies.
static constexpr Owner INVALID_OWNER
An invalid owner.
Types related to the graphics and/or input devices.
Colours
One of 16 base colours used for companies and windows/widgets.
Definition gfx_type.h:283
@ White
White.
Definition gfx_type.h:300
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
SignPool _sign_pool("Sign")
Initialize the sign-pool.
Types related to signs.
PoolID< uint16_t, struct SignIDTag, 64000, 0xFFFF > SignID
The type of the IDs of signs.
Definition signs_type.h:16
Base class for all pools.
Colours text_colour
Colour of the sign's text. Only relevant for OWNER_DEITY.
Definition signs_base.h:29
Owner owner
Placed by this company. Anyone can delete them though. OWNER_NONE for gray signs from old games.
Definition signs_base.h:28
void UpdateVirtCoord()
Update the coordinate of one sign.
Definition signs.cpp:38
~Sign()
Destroy the sign.
Definition signs.cpp:28
Specialised ViewportSign that tracks whether it is valid for entering into a Kdtree.
Types related to viewports.