tron@2186: /* $Id$ */ tron@2186: belugas@6916: /** @file signs.h */ belugas@6916: truelight@988: #ifndef SIGNS_H truelight@988: #define SIGNS_H truelight@988: matthijs@5216: #include "oldpool.h" truelight@1283: rubidium@7880: struct Sign; rubidium@7880: DECLARE_OLD_POOL(Sign, Sign, 2, 16000) rubidium@7880: rubidium@7880: struct Sign : PoolItem { peter1138@8754: char *name; 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@7880: /** rubidium@7880: * Creates a new sign rubidium@7880: */ peter1138@8754: Sign(PlayerID owner = INVALID_PLAYER); rubidium@7880: rubidium@7880: /** Destroy the sign */ rubidium@7880: ~Sign(); rubidium@7880: peter1138@8754: inline bool IsValid() const { return this->owner != INVALID_PLAYER; } rubidium@6574: }; truelight@988: rubidium@7791: enum { rubidium@7791: INVALID_SIGN = 0xFFFF, rubidium@7791: }; rubidium@7791: rubidium@7791: extern SignID _new_sign_id; rubidium@7791: 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@7791: extern uint _total_signs; rubidium@7791: return _total_signs; truelight@4354: } truelight@4354: truelight@4352: static inline bool IsValidSignID(uint index) truelight@4352: { rubidium@7880: return index < GetSignPoolSize() && GetSign(index)->IsValid(); truelight@4352: } truelight@4352: rubidium@7880: #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: rubidium@8764: extern bool _sign_sort_dirty; truelight@1575: rubidium@6573: void UpdateAllSignVirtCoords(); tron@1977: void PlaceProc_Sign(TileIndex tile); truelight@988: peter1138@7623: /* signs_gui.cpp */ truelight@4349: void ShowRenameSignWindow(const Sign *si); truelight@988: rubidium@6573: void ShowSignList(); maedhros@6002: truelight@988: #endif /* SIGNS_H */