OpenTTD Source: src/autoreplace_base.h Source File

OpenTTD Source 15.3

autoreplace_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 AUTOREPLACE_BASE_H
11#define AUTOREPLACE_BASE_H
12
13#include "core/pool_type.hpp"
14#include "autoreplace_type.h"
15#include "engine_type.h"
16#include "group_type.h"
17
18using EngineRenewID = PoolID<uint16_t, struct EngineRenewIDTag, 64000, 0xFFFF>;
19
25 using EngineRenewPool = Pool<EngineRenew, EngineRenewID, 16>;
26extern EngineRenewPool _enginerenew_pool;
27
33 struct EngineRenew : EngineRenewPool::PoolItem<&_enginerenew_pool> {
34 EngineID from = EngineID::Invalid();
35 EngineID to = EngineID::Invalid();
36 EngineRenew *next = nullptr;
37 GroupID group_id = GroupID::Invalid();
38 bool replace_when_old = false;
39
40 EngineRenew() {}
41 EngineRenew(EngineID from, EngineID to, GroupID group_id, bool replace_when_old, EngineRenew *next) :
42 from(from), to(to), next(next), group_id(group_id), replace_when_old(replace_when_old) {}
43 ~EngineRenew() {}
44};
45
46#endif /* AUTOREPLACE_BASE_H */
_enginerenew_pool
EngineRenewPool _enginerenew_pool("EngineRenew")
The pool of autoreplace "orders".
autoreplace_type.h
Types related to autoreplacing.
engine_type.h
Types related to engines.
group_type.h
Types of a group.
pool_type.hpp
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
EngineRenew
Struct to store engine replacements.
Definition autoreplace_base.h:33
EngineRenew::replace_when_old
bool replace_when_old
Do replacement only when vehicle is old.
Definition autoreplace_base.h:38
PoolID
Templated helper to make a PoolID a single POD value.
Definition pool_type.hpp:43
Pool::PoolItem
Base class for all PoolItems.
Definition pool_type.hpp:285
Pool
Base class for all pools.
Definition pool_type.hpp:133