tron@2186: /* $Id$ */ tron@2186: truelight@988: #ifndef SIGNS_H truelight@988: #define SIGNS_H truelight@988: matthijs@5216: #include "oldpool.h" truelight@1283: truelight@4349: typedef struct Sign { truelight@988: StringID str; truelight@988: ViewportSign sign; truelight@988: int32 x; truelight@988: int32 y; truelight@988: byte z; celestar@5650: PlayerByte owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games. truelight@988: truelight@4349: SignID index; truelight@4349: } Sign; truelight@988: matthijs@5216: DECLARE_OLD_POOL(Sign, Sign, 2, 16000) truelight@1283: matthijs@5247: static inline SignID GetMaxSignIndex(void) truelight@4354: { truelight@4354: /* TODO - This isn't the real content of the function, but truelight@4354: * with the new pool-system this will be replaced with one that matthijs@5247: * _really_ returns the highest index. Now it just returns truelight@4354: * the next safe value we are sure about everything is below. truelight@4354: */ matthijs@5247: return GetSignPoolSize() - 1; matthijs@5247: } matthijs@5247: matthijs@5247: static inline uint GetNumSigns(void) matthijs@5247: { truelight@4354: return GetSignPoolSize(); truelight@4354: } truelight@4354: truelight@4346: /** truelight@4346: * Check if a Sign really exists. truelight@4346: */ truelight@4349: static inline bool IsValidSign(const Sign *si) truelight@4346: { truelight@4349: return si->str != STR_NULL; truelight@4346: } truelight@4346: truelight@4352: static inline bool IsValidSignID(uint index) truelight@4352: { truelight@4352: return index < GetSignPoolSize() && IsValidSign(GetSign(index)); truelight@4352: } truelight@4352: truelight@4400: void DestroySign(Sign *si); truelight@4400: truelight@4384: static inline void DeleteSign(Sign *si) truelight@4384: { truelight@4400: DestroySign(si); truelight@4384: si->str = STR_NULL; truelight@4384: } truelight@4384: tron@4979: #define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (IsValidSign(ss)) truelight@1283: #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0) truelight@988: truelight@1575: VARDEF bool _sign_sort_dirty; truelight@1575: tron@1093: void UpdateAllSignVirtCoords(void); tron@1977: void PlaceProc_Sign(TileIndex tile); truelight@988: truelight@988: /* misc.c */ truelight@4349: void ShowRenameSignWindow(const Sign *si); truelight@988: truelight@988: #endif /* SIGNS_H */