MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FindWindowByClass

Function FindWindowByClass

src/window.cpp:1168–1175  ·  view source on GitHub ↗

* Find any window by its class. Useful when searching for a window that uses * the window number as a #WindowClass, like #WC_SEND_NETWORK_MSG. * @param cls Window class * @return Pointer to the found window, or \c nullptr if not available */

Source from the content-addressed store, hash-verified

1166 * @return Pointer to the found window, or \c nullptr if not available
1167 */
1168Window *FindWindowByClass(WindowClass cls)
1169{
1170 for (Window *w : Window::Iterate()) {
1171 if (w->window_class == cls) return w;
1172 }
1173
1174 return nullptr;
1175}
1176
1177/**
1178 * Get the main window, i.e. FindWindowById(WC_MAIN_WINDOW, 0).

Callers 11

OnInitialPositionMethod · 0.85
UpdateNewGRFScanStatusFunction · 0.85
GetAutoPlacePositionFunction · 0.85
OnClickMethod · 0.85
NewsWindowMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
ShowScriptDebugWindowFunction · 0.85
IsOpenMethod · 0.85
NetworkDrawChatMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected