summaryrefslogtreecommitdiff
path: root/src/transparency_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-07-31 05:47:29 +0000
committerpeter1138 <peter1138@openttd.org>2008-07-31 05:47:29 +0000
commitb7e64bb5a6f79560d6e7b2afb05a3b1684f237b8 (patch)
tree1afe93eabb57e2bec4a313700167aa19922dfd8a /src/transparency_gui.cpp
parent1cd0aa4b7436f7ea78ef7b777d6dc946e405e4f5 (diff)
downloadopenttd-b7e64bb5a6f79560d6e7b2afb05a3b1684f237b8.tar.xz
(svn r13890) -Codechange: Simplify drawing of invisibilty buttons in the transparency gui -- the real widgets above already have coordinates so there is no need to hardcode them again. As an added bonus the invisibility buttons now line up properly.
Diffstat (limited to 'src/transparency_gui.cpp')
-rw-r--r--src/transparency_gui.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp
index 8b6d234db..8d5d594a3 100644
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -55,14 +55,9 @@ public:
}
/* Do not draw button for invisible loading indicators */
- for (uint i = 0; i < 8; i++) {
- if (i < TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS) {
- DrawFrameRect(i * 22, 38, i * 22 + 19, 46, COLOUR_PALE_GREEN, HasBit(_invisibility_opt, i) ? FR_LOWERED : FR_NONE);
- } else if (i == TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS) {
- DrawFrameRect(i * 22, 38, i * 22 + 41, 46, COLOUR_PALE_GREEN, HasBit(_invisibility_opt, i) ? FR_LOWERED : FR_NONE);
- } else { // i > TTW_WIDGET_BRIDGES - TTW_WIDGET_SIGNS
- DrawFrameRect((i + 1) * 22, 38, (i + 1) * 22 + 19, 46, COLOUR_PALE_GREEN, HasBit(_invisibility_opt, i) ? FR_LOWERED : FR_NONE);
- }
+ for (uint i = TTW_WIDGET_SIGNS; i <= TTW_WIDGET_CATENARY; i++) {
+ const Widget *wi = &this->widget[i];
+ DrawFrameRect(wi->left + 1, 38, wi->right - 1, 46, COLOUR_PALE_GREEN, HasBit(_invisibility_opt, i - TTW_WIDGET_SIGNS) ? FR_LOWERED : FR_NONE);
}
}