diff options
author | peter1138 <peter1138@openttd.org> | 2008-01-17 00:06:36 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-01-17 00:06:36 +0000 |
commit | 4d9a9bf6ffed85f0c3f9ec12c8b4a2b7316e703a (patch) | |
tree | f1785a2bf736b45bd3f68e2b2ee3ccf380fb630c | |
parent | bc438a3033339ddb2f0d1f94663ce01e3049c0e6 (diff) | |
download | openttd-4d9a9bf6ffed85f0c3f9ec12c8b4a2b7316e703a.tar.xz |
(svn r11885) -Cleanup: Remove gotos from widget drawing code. A side affect is that it is now possible for any widget type to be shown disabled.
-rw-r--r-- | src/widget.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/widget.cpp b/src/widget.cpp index d9d664b72..9ce132b44 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -210,13 +210,13 @@ void DrawWindowWidgets(const Window *w) /* show different image when clicked for WWT_IMGBTN_2 */ if ((wi->type & WWT_MASK) == WWT_IMGBTN_2 && clicked) img++; DrawSprite(img, PAL_NONE, r.left + 1 + clicked, r.top + 1 + clicked); - goto draw_default; + break; } case WWT_PANEL: { assert(wi->data == 0); DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE); - goto draw_default; + break; } case WWT_TEXTBTN: @@ -231,7 +231,7 @@ void DrawWindowWidgets(const Window *w) if ((wi->type & WWT_MASK) == WWT_TEXTBTN_2 && clicked) str++; DrawStringCentered(((r.left + r.right + 1) >> 1) + clicked, ((r.top + r.bottom + 1) >> 1) - 5 + clicked, str, TC_FROMSTRING); - goto draw_default; + break; } case WWT_TEXT: { @@ -246,7 +246,7 @@ void DrawWindowWidgets(const Window *w) DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_LOWERED | FR_DARKENED); if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, TC_FROMSTRING, r.right - r.left - 10); - goto draw_default; + break; } case WWT_MATRIX: { @@ -290,7 +290,7 @@ void DrawWindowWidgets(const Window *w) GfxFillRect(r.left + 1, x, r.right - 1, x, color); } - goto draw_default; + break; } /* vertical scrollbar */ @@ -426,7 +426,7 @@ void DrawWindowWidgets(const Window *w) GfxFillRect(r.left + 1, r.bottom - 1, r.right - 1, r.bottom - 1, c1); GfxFillRect(r.left, r.bottom, r.right, r.bottom, c2); - goto draw_default; + break; } case WWT_STICKYBOX: { @@ -470,12 +470,13 @@ void DrawWindowWidgets(const Window *w) } DrawStringCenteredTruncated(r.left + 2, r.right - 2, r.top + 2, wi->data, 0x84); -draw_default:; - if (w->IsWidgetDisabled(i)) { - GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, _colour_gradient[wi->color & 0xF][2] | (1 << PALETTE_MODIFIER_GREYOUT)); - } + break; } } + + if (w->IsWidgetDisabled(i)) { + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, _colour_gradient[wi->color & 0xF][2] | (1 << PALETTE_MODIFIER_GREYOUT)); + } } |