summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-08-31 07:13:36 +0000
committertron <tron@openttd.org>2006-08-31 07:13:36 +0000
commitb427ce4e20f5d9a1c2b51de6eae6e1cf64cee21d (patch)
treec147035851d808921e4eed9d276e9fb4dd96b019
parent85bd6c05de745c9ce3a4637febd0d9d62aa25673 (diff)
downloadopenttd-b427ce4e20f5d9a1c2b51de6eae6e1cf64cee21d.tar.xz
(svn r6254) if () cascade -> switch ()
-rw-r--r--texteff.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/texteff.c b/texteff.c
index 531c537dc..53c369c54 100644
--- a/texteff.c
+++ b/texteff.c
@@ -286,35 +286,32 @@ void InitTextEffects(void)
void DrawTextEffects(DrawPixelInfo *dpi)
{
- TextEffect *te;
-
- if (dpi->zoom < 1) {
- for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
- if (te->string_id == INVALID_STRING_ID)
- continue;
-
- /* intersection? */
- if (dpi->left > te->right ||
- dpi->top > te->bottom ||
- dpi->left + dpi->width <= te->x ||
- dpi->top + dpi->height <= te->y)
- continue;
- AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
- }
- } else if (dpi->zoom == 1) {
- for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
- if (te->string_id == INVALID_STRING_ID)
- continue;
-
- /* intersection? */
- if (dpi->left > te->right*2 - te->x ||
- dpi->top > te->bottom*2 - te->y ||
- (dpi->left + dpi->width) <= te->x ||
- (dpi->top + dpi->height) <= te->y)
- continue;
- AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2, 0);
- }
-
+ const TextEffect* te;
+
+ switch (dpi->zoom) {
+ case 0:
+ for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
+ if (te->string_id != INVALID_STRING_ID &&
+ dpi->left <= te->right &&
+ dpi->top <= te->bottom &&
+ dpi->left + dpi->width > te->x &&
+ dpi->top + dpi->height > te->y) {
+ AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
+ }
+ }
+ break;
+
+ case 1:
+ for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
+ if (te->string_id != INVALID_STRING_ID &&
+ dpi->left <= te->right * 2 - te->x &&
+ dpi->top <= te->bottom * 2 - te->y &&
+ dpi->left + dpi->width > te->x &&
+ dpi->top + dpi->height > te->y) {
+ AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2, 0);
+ }
+ }
+ break;
}
}