2008-01-07 09:19:53 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-01-07 09:19:53 +00:00
|
|
|
/** @file autoreplace_base.h Base class for autoreplaces/autorenews. */
|
|
|
|
|
|
|
|
#ifndef AUTOREPLACE_BASE_H
|
|
|
|
#define AUTOREPLACE_BASE_H
|
|
|
|
|
2009-05-22 15:39:22 +00:00
|
|
|
#include "core/pool_type.hpp"
|
2008-01-07 09:19:53 +00:00
|
|
|
#include "autoreplace_type.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "engine_type.h"
|
|
|
|
#include "group_type.h"
|
2008-01-07 09:19:53 +00:00
|
|
|
|
2008-09-13 15:49:29 +00:00
|
|
|
typedef uint16 EngineRenewID;
|
|
|
|
|
2008-01-07 09:19:53 +00:00
|
|
|
/**
|
|
|
|
* Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is
|
|
|
|
* placed here so the only exception to this rule, the saveload code, can use
|
|
|
|
* it.
|
|
|
|
*/
|
2009-05-22 15:13:50 +00:00
|
|
|
typedef Pool<EngineRenew, EngineRenewID, 16, 64000> EngineRenewPool;
|
|
|
|
extern EngineRenewPool _enginerenew_pool;
|
2008-01-07 09:19:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Struct to store engine replacements. DO NOT USE outside of engine.c. Is
|
|
|
|
* placed here so the only exception to this rule, the saveload code, can use
|
|
|
|
* it.
|
|
|
|
*/
|
2009-05-22 15:13:50 +00:00
|
|
|
struct EngineRenew : EngineRenewPool::PoolItem<&_enginerenew_pool> {
|
2008-01-07 09:19:53 +00:00
|
|
|
EngineID from;
|
|
|
|
EngineID to;
|
|
|
|
EngineRenew *next;
|
|
|
|
GroupID group_id;
|
2012-04-17 19:44:02 +00:00
|
|
|
bool replace_when_old; ///< Do replacement only when vehicle is old.
|
2008-01-07 09:19:53 +00:00
|
|
|
|
2009-05-22 15:13:50 +00:00
|
|
|
EngineRenew(EngineID from = INVALID_ENGINE, EngineID to = INVALID_ENGINE) : from(from), to(to) {}
|
|
|
|
~EngineRenew() {}
|
2008-01-07 09:19:53 +00:00
|
|
|
};
|
|
|
|
|
2009-05-22 14:23:36 +00:00
|
|
|
#define FOR_ALL_ENGINE_RENEWS_FROM(var, start) FOR_ALL_ITEMS_FROM(EngineRenew, enginerenew_index, var, start)
|
|
|
|
#define FOR_ALL_ENGINE_RENEWS(var) FOR_ALL_ENGINE_RENEWS_FROM(var, 0)
|
2008-01-07 09:19:53 +00:00
|
|
|
|
|
|
|
#endif /* AUTOREPLACE_BASE_H */
|