tron@2186: /* $Id$ */ tron@2186: glx@9574: /** @file signs.h */ glx@9574: truelight@988: #ifndef SIGNS_H truelight@988: #define SIGNS_H truelight@988: matthijs@5216: #include "oldpool.h" truelight@1283: rubidium@9694: struct Sign; rubidium@9694: DECLARE_OLD_POOL(Sign, Sign, 2, 16000) rubidium@9694: rubidium@9694: struct Sign : PoolItem { truelight@988: StringID str; truelight@988: ViewportSign sign; truelight@988: int32 x; truelight@988: int32 y; truelight@988: byte z; rubidium@5838: PlayerByte owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games. truelight@988: rubidium@9694: /** rubidium@9694: * Creates a new sign rubidium@9694: */ rubidium@9694: Sign(StringID string = STR_NULL); rubidium@9694: rubidium@9694: /** Destroy the sign */ rubidium@9694: ~Sign(); rubidium@9694: rubidium@9694: bool IsValid() const { return this->str != STR_NULL; } rubidium@9694: rubidium@9694: void QuickFree(); rubidium@6574: }; truelight@988: rubidium@9511: enum { rubidium@9511: INVALID_SIGN = 0xFFFF, rubidium@9511: }; rubidium@9511: rubidium@9511: extern SignID _new_sign_id; rubidium@9511: truelight@1283: rubidium@6573: static inline SignID GetMaxSignIndex() 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: rubidium@6573: static inline uint GetNumSigns() matthijs@5247: { rubidium@9511: extern uint _total_signs; rubidium@9511: return _total_signs; truelight@4354: } truelight@4354: truelight@4352: static inline bool IsValidSignID(uint index) truelight@4352: { rubidium@9694: return index < GetSignPoolSize() && GetSign(index)->IsValid(); truelight@4352: } truelight@4352: rubidium@9694: #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()) truelight@1283: #define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0) truelight@988: truelight@1575: VARDEF bool _sign_sort_dirty; truelight@1575: rubidium@6573: void UpdateAllSignVirtCoords(); tron@1977: void PlaceProc_Sign(TileIndex tile); truelight@988: rubidium@9631: /* signs_gui.cpp */ truelight@4349: void ShowRenameSignWindow(const Sign *si); truelight@988: rubidium@6573: void ShowSignList(); maedhros@6002: truelight@988: #endif /* SIGNS_H */