summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-09 11:42:51 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-09 11:42:51 +0000
commit52bab5e9bd30a5a8f20eba8a838748e3402fa87a (patch)
tree632d0fff8d1624b7679a98c756e9dbc35c104519
parent0d6c71fc387d491b2f7d3b67c1d3948106a86790 (diff)
downloadopenttd-52bab5e9bd30a5a8f20eba8a838748e3402fa87a.tar.xz
(svn r4793) - Replace list of magic numbers (characters that don't exist) with a call to SpriteExists(), when building the character width cache.
-rw-r--r--gfx.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gfx.c b/gfx.c
index 3dab6b132..d4e91382e 100644
--- a/gfx.c
+++ b/gfx.c
@@ -1611,16 +1611,19 @@ void LoadStringWidthTable(void)
uint i;
// 2 equals space.
+ /* Normal font */
for (i = 2; i != 226; i++) {
- *b++ = i != 97 && (i < 99 || i > 113) && i != 116 && i != 117 && (i < 123 || i > 129) && (i < 151 || i > 153) && i != 155 ? GetSprite(i)->width : 0;
+ *b++ = SpriteExists(i) ? GetSprite(i)->width : 0;
}
+ /* Small font */
for (i = 226; i != 450; i++) {
- *b++ = i != 321 && (i < 323 || i > 353) && i != 367 && (i < 375 || i > 377) && i != 379 ? GetSprite(i)->width + 1 : 0;
+ *b++ = SpriteExists(i) ? GetSprite(i)->width + 1 : 0;
}
+ /* Large font */
for (i = 450; i != 674; i++) {
- *b++ = (i < 545 || i > 577) && i != 588 && i != 590 && i != 591 && i != 593 && (i < 599 || i > 601) && i != 603 ? GetSprite(i)->width + 1 : 0;
+ *b++ = SpriteExists(i) ? GetSprite(i)->width + 1 : 0;
}
}