autoreplace_base.h
Go to the documentation of this file.00001
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