diff options
author | alberth <alberth@openttd.org> | 2009-11-02 05:12:58 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-11-02 05:12:58 +0000 |
commit | cb7c9b09ff05c1065a3cb8835205cc779ede117e (patch) | |
tree | 3aed78988c3b087adf71bcdfc2cfcf90ec5143a8 /src | |
parent | 726edbf3c040581e21819fc3adbb9ed19dc3e952 (diff) | |
download | openttd-cb7c9b09ff05c1065a3cb8835205cc779ede117e.tar.xz |
(svn r17945) -Fix (r17940): Absence of main toolbar and/or status bar should not be fatal.
Diffstat (limited to 'src')
-rw-r--r-- | src/misc_gui.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 4c373345d..faf03d621 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -593,9 +593,9 @@ public: * Add a fixed distance 20 to make it less cluttered. */ const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); - int scr_top = w->top + w->height + 20; + int scr_top = ((w != NULL) ? w->top + w->height : 0) + 20; w = FindWindowById(WC_STATUS_BAR, 0); - int scr_bot = w->top - 20; + int scr_bot = ((w != NULL) ? w->top : _screen.height) - 20; Point pt = RemapCoords2(this->position.x, this->position.y); const ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; @@ -810,9 +810,9 @@ struct TooltipsWindow : public Window * Add a fixed distance 2 so the tooltip floats free from both bars. */ const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); - int scr_top = w->top + w->height + 2; + int scr_top = ((w != NULL) ? w->top + w->height : 0) + 2; w = FindWindowById(WC_STATUS_BAR, 0); - int scr_bot = w->top - 2; + int scr_bot = ((w != NULL) ? w->top : _screen.height) - 2; Point pt; |