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"
|
|
|
|
|
2005-01-12 11:21:28 +00:00
|
|
|
typedef struct SignStruct {
|
|
|
|
StringID str;
|
|
|
|
ViewportSign sign;
|
|
|
|
int32 x;
|
|
|
|
int32 y;
|
|
|
|
byte z;
|
2005-01-25 15:38:36 +00:00
|
|
|
byte 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
|
|
|
|
|
|
|
uint16 index;
|
|
|
|
} SignStruct;
|
|
|
|
|
2005-02-04 14:45:32 +00:00
|
|
|
extern MemoryPool _sign_pool;
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2005-02-06 22:36:08 +00:00
|
|
|
/**
|
|
|
|
* Check if a Sign really exists.
|
|
|
|
*/
|
|
|
|
static inline bool IsValidSign(SignStruct* ss)
|
|
|
|
{
|
|
|
|
return ss->str != 0;
|
|
|
|
}
|
|
|
|
|
2005-02-04 14:45:32 +00:00
|
|
|
/**
|
|
|
|
* Get the pointer to the sign with index 'index'
|
|
|
|
*/
|
2005-01-12 11:21:28 +00:00
|
|
|
static inline SignStruct *GetSign(uint index)
|
|
|
|
{
|
2005-02-04 14:45:32 +00:00
|
|
|
return (SignStruct*)GetItemFromPool(&_sign_pool, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
}
|
|
|
|
|
2005-05-17 19:36:36 +00:00
|
|
|
static inline bool IsSignIndex(uint index)
|
|
|
|
{
|
|
|
|
return index < GetSignPoolSize();
|
|
|
|
}
|
|
|
|
|
2005-02-04 14:45:32 +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)
|
|
|
|
#define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
|
2005-01-12 11:21:28 +00:00
|
|
|
|
|
|
|
VARDEF SignStruct *_new_sign_struct;
|
|
|
|
|
2005-03-26 21:22:29 +00:00
|
|
|
VARDEF bool _sign_sort_dirty;
|
|
|
|
VARDEF uint16 *_sign_sort;
|
|
|
|
|
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 */
|
2005-07-17 20:14:58 +00:00
|
|
|
void ShowRenameSignWindow(const SignStruct *ss);
|
2005-01-12 11:21:28 +00:00
|
|
|
|
|
|
|
#endif /* SIGNS_H */
|