2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2005-01-12 11:21:28 +00:00
|
|
|
#ifndef SIGNS_H
|
|
|
|
#define SIGNS_H
|
|
|
|
|
2005-02-04 14:45:32 +00:00
|
|
|
#include "pool.h"
|
|
|
|
|
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
|
|
|
|
2005-02-04 14:45:32 +00:00
|
|
|
extern MemoryPool _sign_pool;
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2005-02-04 14:45:32 +00:00
|
|
|
/**
|
|
|
|
* Get the pointer to the sign with index 'index'
|
|
|
|
*/
|
2006-08-22 16:38:50 +00:00
|
|
|
static inline Sign *GetSign(SignID index)
|
2005-01-12 11:21:28 +00:00
|
|
|
{
|
2006-08-22 16:38:50 +00:00
|
|
|
return (Sign *)GetItemFromPool(&_sign_pool, index);
|
2005-02-04 14:45:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current size of the SignPool
|
|
|
|
*/
|
|
|
|
static inline uint16 GetSignPoolSize(void)
|
|
|
|
{
|
|
|
|
return _sign_pool.total_items;
|
2005-01-12 11:21:28 +00:00
|
|
|
}
|
|
|
|
|
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-22 15:33:35 +00:00
|
|
|
#define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1 < GetSignPoolSize()) ? GetSign(ss->index + 1) : 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 */
|