2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-04-04 01:35:16 +00:00
|
|
|
/** @file signs.h */
|
|
|
|
|
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
|
|
|
|
2007-08-02 13:27:45 +00:00
|
|
|
struct Sign;
|
|
|
|
DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
|
|
|
|
|
|
|
|
struct Sign : PoolItem<Sign, SignID, &_Sign_pool> {
|
2005-01-12 11:21:28 +00:00
|
|
|
StringID str;
|
|
|
|
ViewportSign sign;
|
|
|
|
int32 x;
|
|
|
|
int32 y;
|
|
|
|
byte z;
|
2007-01-10 18:56:51 +00:00
|
|
|
PlayerByte 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
|
|
|
|
2007-08-02 13:27:45 +00:00
|
|
|
/**
|
|
|
|
* Creates a new sign
|
|
|
|
*/
|
|
|
|
Sign(StringID string = STR_NULL);
|
|
|
|
|
|
|
|
/** Destroy the sign */
|
|
|
|
~Sign();
|
|
|
|
|
2007-08-30 20:40:33 +00:00
|
|
|
inline bool IsValid() const { return this->str != STR_NULL; }
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2007-07-20 18:35:33 +00:00
|
|
|
enum {
|
|
|
|
INVALID_SIGN = 0xFFFF,
|
|
|
|
};
|
|
|
|
|
|
|
|
extern SignID _new_sign_id;
|
|
|
|
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static inline SignID GetMaxSignIndex()
|
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;
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
static inline uint GetNumSigns()
|
2006-12-05 13:58:20 +00:00
|
|
|
{
|
2007-07-20 18:35:33 +00:00
|
|
|
extern uint _total_signs;
|
|
|
|
return _total_signs;
|
2006-08-22 20:41:26 +00:00
|
|
|
}
|
|
|
|
|
2006-08-22 18:15:17 +00:00
|
|
|
static inline bool IsValidSignID(uint index)
|
|
|
|
{
|
2007-08-02 13:27:45 +00:00
|
|
|
return index < GetSignPoolSize() && GetSign(index)->IsValid();
|
2006-08-26 14:22:54 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 13:27:45 +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 (ss->IsValid())
|
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;
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void UpdateAllSignVirtCoords();
|
2005-06-24 12:38:35 +00:00
|
|
|
void PlaceProc_Sign(TileIndex tile);
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2007-06-30 17:51:50 +00:00
|
|
|
/* signs_gui.cpp */
|
2006-08-22 16:38:50 +00:00
|
|
|
void ShowRenameSignWindow(const Sign *si);
|
2005-01-12 11:21:28 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ShowSignList();
|
2007-01-21 12:35:35 +00:00
|
|
|
|
2005-01-12 11:21:28 +00:00
|
|
|
#endif /* SIGNS_H */
|