OpenTTD
autoreplace_base.h
Go to the documentation of this file.
1 /* $Id: autoreplace_base.h 24136 2012-04-17 19:44:02Z michi_cc $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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 <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef AUTOREPLACE_BASE_H
13 #define AUTOREPLACE_BASE_H
14 
15 #include "core/pool_type.hpp"
16 #include "autoreplace_type.h"
17 #include "engine_type.h"
18 #include "group_type.h"
19 
20 typedef uint16 EngineRenewID;
21 
29 
35 struct EngineRenew : EngineRenewPool::PoolItem<&_enginerenew_pool> {
36  EngineID from;
37  EngineID to;
38  EngineRenew *next;
39  GroupID group_id;
41 
42  EngineRenew(EngineID from = INVALID_ENGINE, EngineID to = INVALID_ENGINE) : from(from), to(to) {}
43  ~EngineRenew() {}
44 };
45 
46 #define FOR_ALL_ENGINE_RENEWS_FROM(var, start) FOR_ALL_ITEMS_FROM(EngineRenew, enginerenew_index, var, start)
47 #define FOR_ALL_ENGINE_RENEWS(var) FOR_ALL_ENGINE_RENEWS_FROM(var, 0)
48 
49 #endif /* AUTOREPLACE_BASE_H */
Pool< EngineRenew, EngineRenewID, 16, 64000 > EngineRenewPool
Memory pool for engine renew elements.
EngineRenewPool _enginerenew_pool
The pool of autoreplace "orders".
Types related to engines.
bool replace_when_old
Do replacement only when vehicle is old.
Defintion of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle...
uint16 GroupID
Type for all group identifiers.
Definition: group_type.h:15
Base class for all PoolItems.
Definition: pool_type.hpp:146
Base class for all pools.
Definition: pool_type.hpp:83
static const EngineID INVALID_ENGINE
Constant denoting an invalid engine.
Definition: engine_type.h:174
Types related to autoreplacing.
uint16 EngineID
Unique identification number of an engine.
Definition: engine_type.h:22
Struct to store engine replacements.
Types of a group.