signs_base.h
Go to the documentation of this file.00001
00002
00005 #ifndef SIGNS_BASE_H
00006 #define SIGNS_BASE_H
00007
00008 #include "signs_type.h"
00009 #include "viewport_type.h"
00010 #include "tile_type.h"
00011 #include "oldpool.h"
00012
00013 DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
00014
00015 struct Sign : PoolItem<Sign, SignID, &_Sign_pool> {
00016 char *name;
00017 ViewportSign sign;
00018 int32 x;
00019 int32 y;
00020 byte z;
00021 OwnerByte owner;
00022
00026 Sign(Owner owner = INVALID_OWNER);
00027
00029 ~Sign();
00030
00031 inline bool IsValid() const { return this->owner != INVALID_OWNER; }
00032 };
00033
00034 static inline SignID GetMaxSignIndex()
00035 {
00036
00037
00038
00039
00040
00041 return GetSignPoolSize() - 1;
00042 }
00043
00044 static inline bool IsValidSignID(uint index)
00045 {
00046 return index < GetSignPoolSize() && GetSign(index)->IsValid();
00047 }
00048
00049 #define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (ss->IsValid())
00050 #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
00051
00052 #endif