autoreplace_base.h

Go to the documentation of this file.
00001 /* $Id: autoreplace_base.h 14313 2008-09-13 15:49:29Z frosch $ */
00002 
00005 #ifndef AUTOREPLACE_BASE_H
00006 #define AUTOREPLACE_BASE_H
00007 
00008 #include "oldpool.h"
00009 #include "autoreplace_type.h"
00010 
00011 typedef uint16 EngineRenewID;
00012 
00018 DECLARE_OLD_POOL(EngineRenew, EngineRenew, 3, 8000)
00019 
00020 
00025 struct EngineRenew : PoolItem<EngineRenew, EngineRenewID, &_EngineRenew_pool> {
00026   EngineID from;
00027   EngineID to;
00028   EngineRenew *next;
00029   GroupID group_id;
00030 
00031   EngineRenew(EngineID from = INVALID_ENGINE, EngineID to = INVALID_ENGINE) : from(from), to(to), next(NULL) {}
00032   ~EngineRenew() { this->from = INVALID_ENGINE; }
00033 
00034   inline bool IsValid() const { return this->from != INVALID_ENGINE; }
00035 };
00036 
00037 #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())
00038 #define FOR_ALL_ENGINE_RENEWS(er) FOR_ALL_ENGINE_RENEWS_FROM(er, 0)
00039 
00040 #endif /* AUTOREPLACE_BASE_H */

Generated on Mon Jun 8 23:04:02 2009 for OpenTTD by  doxygen 1.5.6