autoreplace_base.h

Go to the documentation of this file.
00001 /* $Id: autoreplace_base.h 11775 2008-01-07 09:19:53Z rubidium $ */
00002 
00005 #ifndef AUTOREPLACE_BASE_H
00006 #define AUTOREPLACE_BASE_H
00007 
00008 #include "oldpool.h"
00009 #include "autoreplace_type.h"
00010 
00016 DECLARE_OLD_POOL(EngineRenew, EngineRenew, 3, 8000)
00017 
00018 
00023 struct EngineRenew : PoolItem<EngineRenew, EngineRenewID, &_EngineRenew_pool> {
00024   EngineID from;
00025   EngineID to;
00026   EngineRenew *next;
00027   GroupID group_id;
00028 
00029   EngineRenew(EngineID from = INVALID_ENGINE, EngineID to = INVALID_ENGINE) : from(from), to(to), next(NULL) {}
00030   ~EngineRenew() { this->from = INVALID_ENGINE; }
00031 
00032   inline bool IsValid() const { return this->from != INVALID_ENGINE; }
00033 };
00034 
00035 #define FOR_ALL_ENGINE_RENEWS_FROM(er, start) for (er = GetEngineRenew(start); er != NULL; er = (er->index + 1U < GetEngineRenewPoolSize()) ? GetEngineRenew(er->index + 1U) : NULL) if (er->IsValid())
00036 #define FOR_ALL_ENGINE_RENEWS(er) FOR_ALL_ENGINE_RENEWS_FROM(er, 0)
00037 
00038 #endif /* AUTOREPLACE_BASE_H */

Generated on Mon Sep 22 20:34:14 2008 for openttd by  doxygen 1.5.6