diff options
author | truelight <truelight@openttd.org> | 2005-02-04 14:45:32 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-02-04 14:45:32 +0000 |
commit | 4f5255c36eb39744a0fb0ceda0364ff8d4d3524f (patch) | |
tree | 684f650c3072700fb0cee6a014fae1d38b365317 /signs.h | |
parent | 97728357e442315962c62927032f1daa97ff107d (diff) | |
download | openttd-4f5255c36eb39744a0fb0ceda0364ff8d4d3524f.tar.xz |
(svn r1787) -Add: Dynamic signs (euh.. yeah, this means you can built 64k signs)
Diffstat (limited to 'signs.h')
-rw-r--r-- | signs.h | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -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; |