signs.h
Go to the documentation of this file.00001
00002
00005 #ifndef SIGNS_H
00006 #define SIGNS_H
00007
00008 #include "oldpool.h"
00009
00010 struct Sign;
00011 DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
00012
00013 struct Sign : PoolItem<Sign, SignID, &_Sign_pool> {
00014 char *name;
00015 ViewportSign sign;
00016 int32 x;
00017 int32 y;
00018 byte z;
00019 PlayerByte owner;
00020
00024 Sign(PlayerID owner = INVALID_PLAYER);
00025
00027 ~Sign();
00028
00029 inline bool IsValid() const { return this->owner != INVALID_PLAYER; }
00030 };
00031
00032 enum {
00033 INVALID_SIGN = 0xFFFF,
00034 };
00035
00036 extern SignID _new_sign_id;
00037
00038
00039 static inline SignID GetMaxSignIndex()
00040 {
00041
00042
00043
00044
00045
00046 return GetSignPoolSize() - 1;
00047 }
00048
00049 static inline uint GetNumSigns()
00050 {
00051 extern uint _total_signs;
00052 return _total_signs;
00053 }
00054
00055 static inline bool IsValidSignID(uint index)
00056 {
00057 return index < GetSignPoolSize() && GetSign(index)->IsValid();
00058 }
00059
00060 #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())
00061 #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
00062
00063 extern bool _sign_sort_dirty;
00064
00065 void UpdateAllSignVirtCoords();
00066 void PlaceProc_Sign(TileIndex tile);
00067
00068
00069 void ShowRenameSignWindow(const Sign *si);
00070 void DeleteRenameSignWindow(SignID sign);
00071 void ShowSignList();
00072
00073 #endif