OpenTTD Source: src/signs_base.h Source File

OpenTTD Source 15.0-RC2

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
10#ifndef SIGNS_BASE_H
11#define SIGNS_BASE_H
12
13#include "signs_type.h"
14#include "viewport_type.h"
15#include "core/pool_type.hpp"
16#include "company_type.h"
17
18typedef Pool<Sign, SignID, 16> SignPool;
19extern SignPool _sign_pool;
20
21 struct Sign : SignPool::PoolItem<&_sign_pool> {
22 std::string name{};
23 TrackedViewportSign sign{};
24 int32_t x = 0;
25 int32_t y = 0;
26 int32_t z = 0;
27 Owner owner = INVALID_OWNER; // placed by this company. Anyone can delete them though. OWNER_NONE for gray signs from old games.
28
29 Sign() {}
30 Sign(Owner owner, int32_t x, int32_t y, int32_t z, const std::string &name) : name(name), x(x), y(y), z(z), owner(owner) {}
31 ~Sign();
32
33 void UpdateVirtCoord();
34};
35
36#endif /* SIGNS_BASE_H */
company_type.h
Types related to companies.
INVALID_OWNER
static constexpr Owner INVALID_OWNER
An invalid owner.
Definition company_type.h:30
pool_type.hpp
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
_sign_pool
SignPool _sign_pool("Sign")
Initialize the sign-pool.
signs_type.h
Types related to signs.
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
Pool::PoolItem
Base class for all PoolItems.
Definition pool_type.hpp:285
Pool
Base class for all pools.
Definition pool_type.hpp:133
Sign
Definition signs_base.h:21
Sign::UpdateVirtCoord
void UpdateVirtCoord()
Update the coordinate of one sign.
Definition signs.cpp:38
Sign::~Sign
~Sign()
Destroy the sign.
Definition signs.cpp:28
TrackedViewportSign
Specialised ViewportSign that tracks whether it is valid for entering into a Kdtree.
Definition viewport_type.h:60
viewport_type.h
Types related to viewports.