diff options
author | rubidium <rubidium@openttd.org> | 2009-11-29 00:41:08 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-29 00:41:08 +0000 |
commit | 5d38d06313b3c2bc440283cc15cb1e86aa48cbf4 (patch) | |
tree | d19238f07c89292ae2e0517137724917438c236f /src/window.cpp | |
parent | b00a5f1069b5bcf37af5d601e3e2828d0d09a1f0 (diff) | |
download | openttd-5d38d06313b3c2bc440283cc15cb1e86aa48cbf4.tar.xz |
(svn r18331) -Fix [FS#3334]: news items would with some chat 'bars' not be displayed fully. Fix by erikjanp.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp index 5a00f3909..5fe73b7e5 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -593,6 +593,22 @@ Window *FindWindowById(WindowClass cls, WindowNumber number) } /** + * Find any window by its class. Useful when searching for a window that uses + * the window number as a WindowType, like WC_SEND_NETWORK_MSG. + * @param cls Window class + * @return Pointer to the found window, or \c NULL if not available + */ +Window *FindWindowByClass(WindowClass cls) +{ + Window *w; + FOR_ALL_WINDOWS_FROM_BACK(w) { + if (w->window_class == cls) return w; + } + + return NULL; +} + +/** * Delete a window by its class and window number (if it is open). * @param cls Window class * @param number Number of the window within the window class @@ -807,7 +823,7 @@ void Window::InitializeData(WindowClass cls, int window_number, uint32 desc_flag if (FindWindowById(WC_MAIN_TOOLBAR, 0) != NULL) w = w->z_back; if (FindWindowById(WC_STATUS_BAR, 0) != NULL) w = w->z_back; if (FindWindowById(WC_NEWS_WINDOW, 0) != NULL) w = w->z_back; - if (FindWindowById(WC_SEND_NETWORK_MSG, 0) != NULL) w = w->z_back; + if (FindWindowByClass(WC_SEND_NETWORK_MSG) != NULL) w = w->z_back; if (w == NULL) { _z_back_window->z_front = this; |