Changeset - r13795:7af2272ab313
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2009-11-29 00:41:08
rubidium@openttd.org
(svn r18331) -Fix [FS#3334]: news items would with some chat 'bars' not be displayed fully. Fix by erikjanp.
3 files changed with 19 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/news_gui.cpp
Show inline comments
 
@@ -287,7 +287,7 @@ struct NewsWindow : Window {
 
	NewsWindow(const WindowDesc *desc, NewsItem *ni) : Window(), ni(ni)
 
	{
 
		NewsWindow::duration = 555;
 
		const Window *w = FindWindowById(WC_SEND_NETWORK_MSG, 0);
 
		const Window *w = FindWindowByClass(WC_SEND_NETWORK_MSG);
 
		this->chat_height = (w != NULL) ? w->height : 0;
 
		this->status_height = FindWindowById(WC_STATUS_BAR, 0)->height;
 

	
src/window.cpp
Show inline comments
 
@@ -593,6 +593,22 @@ Window *FindWindowById(WindowClass cls, 
 
}
 

	
 
/**
 
 * 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 
 
		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;
src/window_func.h
Show inline comments
 
@@ -16,6 +16,7 @@
 
#include "company_type.h"
 

	
 
Window *FindWindowById(WindowClass cls, WindowNumber number);
 
Window *FindWindowByClass(WindowClass cls);
 
void ChangeWindowOwner(Owner old_owner, Owner new_owner);
 

	
 
void ResizeWindow(Window *w, int x, int y);
0 comments (0 inline, 0 general)