tron@2186: /* $Id$ */ tron@2186: truelight@988: #ifndef SIGNS_H truelight@988: #define SIGNS_H truelight@988: truelight@1283: #include "pool.h" truelight@1283: truelight@988: typedef struct SignStruct { truelight@988: StringID str; truelight@988: ViewportSign sign; truelight@988: int32 x; truelight@988: int32 y; truelight@988: byte z; tron@2498: PlayerID owner; // placed by this player. Anyone can delete them though. dominik@1165: // OWNER_NONE for gray signs from old games. truelight@988: truelight@988: uint16 index; truelight@988: } SignStruct; truelight@988: truelight@1283: extern MemoryPool _sign_pool; truelight@988: truelight@1283: /** matthijs@1330: * Check if a Sign really exists. matthijs@1330: */ Darkvater@2436: static inline bool IsValidSign(const SignStruct* ss) matthijs@1330: { matthijs@1330: return ss->str != 0; matthijs@1330: } matthijs@1330: matthijs@1330: /** truelight@1283: * Get the pointer to the sign with index 'index' truelight@1283: */ truelight@988: static inline SignStruct *GetSign(uint index) truelight@988: { truelight@1283: return (SignStruct*)GetItemFromPool(&_sign_pool, index); truelight@988: } truelight@988: truelight@1283: /** truelight@1283: * Get the current size of the SignPool truelight@1283: */ truelight@1283: static inline uint16 GetSignPoolSize(void) truelight@1283: { truelight@1283: return _sign_pool.total_items; truelight@1283: } truelight@1283: Darkvater@1837: static inline bool IsSignIndex(uint index) Darkvater@1837: { Darkvater@1837: return index < GetSignPoolSize(); Darkvater@1837: } Darkvater@1837: truelight@1283: #define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1 < GetSignPoolSize()) ? GetSign(ss->index + 1) : NULL) truelight@1283: #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0) truelight@988: truelight@988: VARDEF SignStruct *_new_sign_struct; truelight@988: truelight@1575: VARDEF bool _sign_sort_dirty; truelight@1575: VARDEF uint16 *_sign_sort; truelight@1575: tron@1093: void UpdateAllSignVirtCoords(void); tron@1977: void PlaceProc_Sign(TileIndex tile); truelight@988: truelight@988: /* misc.c */ tron@2116: void ShowRenameSignWindow(const SignStruct *ss); truelight@988: truelight@988: #endif /* SIGNS_H */