From 4f5255c36eb39744a0fb0ceda0364ff8d4d3524f Mon Sep 17 00:00:00 2001 From: truelight Date: Fri, 4 Feb 2005 14:45:32 +0000 Subject: (svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs) --- signs.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'signs.h') diff --git a/signs.h b/signs.h index 98934ef78..1d19206c5 100644 --- a/signs.h +++ b/signs.h @@ -1,6 +1,8 @@ #ifndef SIGNS_H #define SIGNS_H +#include "pool.h" + typedef struct SignStruct { StringID str; ViewportSign sign; @@ -13,16 +15,26 @@ typedef struct SignStruct { uint16 index; } SignStruct; -VARDEF SignStruct _sign_list[40]; -VARDEF uint _sign_size; +extern MemoryPool _sign_pool; +/** + * Get the pointer to the sign with index 'index' + */ static inline SignStruct *GetSign(uint index) { - assert(index < _sign_size); - return &_sign_list[index]; + return (SignStruct*)GetItemFromPool(&_sign_pool, index); +} + +/** + * Get the current size of the SignPool + */ +static inline uint16 GetSignPoolSize(void) +{ + return _sign_pool.total_items; } -#define FOR_ALL_SIGNS(s) for(s = _sign_list; s != &_sign_list[_sign_size]; s++) +#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) VARDEF SignStruct *_new_sign_struct; -- cgit v1.2.3-54-g00ecf