summaryrefslogtreecommitdiff
path: root/signs.h
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-05-17 19:36:36 +0000
committerDarkvater <darkvater@openttd.org>2005-05-17 19:36:36 +0000
commit21d9e2c934b263c16ddba19013994f567f4e81b0 (patch)
treec543be0e66d8dd3694e7f9692a54795b6791ce93 /signs.h
parent90ca24f7b64f9a23dfe771d4e13f55a10b5d2db9 (diff)
downloadopenttd-21d9e2c934b263c16ddba19013994f567f4e81b0.tar.xz
(svn r2342) - Fix (Regression): _cmd_text is always valid, so test the first character for '\0'. Also for some reason I forgot to validate the p1 param so that might lead to crashes with invalid signes. Fixed as well.
Diffstat (limited to 'signs.h')
-rw-r--r--signs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/signs.h b/signs.h
index 2cc417ca0..4451f8f89 100644
--- a/signs.h
+++ b/signs.h
@@ -41,6 +41,11 @@ static inline uint16 GetSignPoolSize(void)
return _sign_pool.total_items;
}
+static inline bool IsSignIndex(uint index)
+{
+ return index < GetSignPoolSize();
+}
+
#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)