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

Function CloseCompanyWindows

src/window.cpp:1223–1234  ·  view source on GitHub ↗

* Close all windows of a company. We identify windows of a company * by looking at the caption colour. If it is equal to the company ID * then we say the window belongs to the company and should be closed * @param id company identifier */

Source from the content-addressed store, hash-verified

1221 * @param id company identifier
1222 */
1223void CloseCompanyWindows(CompanyID id)
1224{
1225 /* Note: the container remains stable, even when deleting windows. */
1226 for (Window *w : Window::Iterate()) {
1227 if (w->owner == id) {
1228 w->Close();
1229 }
1230 }
1231
1232 /* Also delete the company specific windows that don't have a company-colour. */
1233 CloseWindowById(WC_BUY_COMPANY, id);
1234}
1235
1236/**
1237 * Change the owner of all the windows one company can take over from another

Callers 2

~CompanyMethod · 0.85
DoAcquireCompanyFunction · 0.85

Calls 2

CloseWindowByIdFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected