2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2005-01-12 11:21:28 +00:00
|
|
|
#ifndef SIGNS_H
|
|
|
|
#define SIGNS_H
|
|
|
|
|
2006-12-03 17:27:43 +00:00
|
|
|
#include "oldpool.h"
|
2005-02-04 14:45:32 +00:00
|
|
|
|
2006-08-22 16:38:50 +00:00
|
|
|
typedef struct Sign {
|
2005-01-12 11:21:28 +00:00
|
|
|
StringID str;
|
|
|
|
ViewportSign sign;
|
|
|
|
int32 x;
|
|
|
|
int32 y;
|
|
|
|
byte z;
|
2006-08-22 16:38:50 +00:00
|
|
|
PlayerID owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games.
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2006-08-22 16:38:50 +00:00
|
|
|
SignID index;
|
|
|
|
} Sign;
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2006-12-03 17:27:43 +00:00
|
|
|
DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2006-12-05 13:58:20 +00:00
|
|
|
static inline SignID GetMaxSignIndex(void)
|
2006-08-22 20:41:26 +00:00
|
|
|
{
|
|
|
|
/* TODO - This isn't the real content of the function, but
|
|
|
|
* with the new pool-system this will be replaced with one that
|
2006-12-05 13:58:20 +00:00
|
|
|
* _really_ returns the highest index. Now it just returns
|
2006-08-22 20:41:26 +00:00
|
|
|
* the next safe value we are sure about everything is below.
|
|
|
|
*/
|
2006-12-05 13:58:20 +00:00
|
|
|
return GetSignPoolSize() - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint GetNumSigns(void)
|
|
|
|
{
|
2006-08-22 20:41:26 +00:00
|
|
|
return GetSignPoolSize();
|
|
|
|
}
|
|
|
|
|
2006-08-22 15:33:35 +00:00
|
|
|
/**
|
|
|
|
* Check if a Sign really exists.
|
|
|
|
*/
|
2006-08-22 16:38:50 +00:00
|
|
|
static inline bool IsValidSign(const Sign *si)
|
2006-08-22 15:33:35 +00:00
|
|
|
{
|
2006-08-22 16:38:50 +00:00
|
|
|
return si->str != STR_NULL;
|
2006-08-22 15:33:35 +00:00
|
|
|
}
|
|
|
|
|
2006-08-22 18:15:17 +00:00
|
|
|
static inline bool IsValidSignID(uint index)
|
|
|
|
{
|
|
|
|
return index < GetSignPoolSize() && IsValidSign(GetSign(index));
|
|
|
|
}
|
|
|
|
|
2006-08-26 19:29:35 +00:00
|
|
|
void DestroySign(Sign *si);
|
|
|
|
|
2006-08-26 14:22:54 +00:00
|
|
|
static inline void DeleteSign(Sign *si)
|
|
|
|
{
|
2006-08-26 19:29:35 +00:00
|
|
|
DestroySign(si);
|
2006-08-26 14:22:54 +00:00
|
|
|
si->str = STR_NULL;
|
|
|
|
}
|
|
|
|
|
2006-10-28 11:43:56 +00:00
|
|
|
#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))
|
2005-02-04 14:45:32 +00:00
|
|
|
#define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2005-03-26 21:22:29 +00:00
|
|
|
VARDEF bool _sign_sort_dirty;
|
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
void UpdateAllSignVirtCoords(void);
|
2005-06-24 12:38:35 +00:00
|
|
|
void PlaceProc_Sign(TileIndex tile);
|
2005-01-12 11:21:28 +00:00
|
|
|
|
|
|
|
/* misc.c */
|
2006-08-22 16:38:50 +00:00
|
|
|
void ShowRenameSignWindow(const Sign *si);
|
2005-01-12 11:21:28 +00:00
|
|
|
|
|
|
|
#endif /* SIGNS_H */
|