0x00499B7E
| 342 | |
| 343 | // 0x00499B7E |
| 344 | Window* open(uint16_t townId) |
| 345 | { |
| 346 | auto window = WindowManager::bringToFront(WindowType::town, townId); |
| 347 | if (window != nullptr) |
| 348 | { |
| 349 | if (ToolManager::isToolActive(window->type, window->number)) |
| 350 | { |
| 351 | ToolManager::toolCancel(); |
| 352 | } |
| 353 | |
| 354 | window = WindowManager::bringToFront(WindowType::town, townId); |
| 355 | } |
| 356 | |
| 357 | if (window == nullptr) |
| 358 | { |
| 359 | // 0x00499C0D start |
| 360 | const WindowFlags newFlags = WindowFlags::viewportNoShiftPixels | WindowFlags::resizable; |
| 361 | window = WindowManager::createWindow(WindowType::town, kWindowSize, newFlags, Town::getEvents()); |
| 362 | window->number = townId; |
| 363 | window->minWidth = 192; |
| 364 | window->minHeight = 161; |
| 365 | window->maxWidth = 600; |
| 366 | window->maxHeight = 440; |
| 367 | |
| 368 | auto skin = ObjectManager::get<InterfaceSkinObject>(); |
| 369 | if (skin != nullptr) |
| 370 | { |
| 371 | window->setColour(WindowColour::primary, skin->windowTitlebarColour); |
| 372 | window->setColour(WindowColour::secondary, skin->windowColour); |
| 373 | } |
| 374 | // 0x00499C0D end |
| 375 | |
| 376 | window->savedView.clear(); |
| 377 | } |
| 378 | |
| 379 | window->currentTab = 0; |
| 380 | window->invalidate(); |
| 381 | |
| 382 | window->setWidgets(Town::widgets); |
| 383 | window->holdableWidgets = 0; |
| 384 | window->eventHandlers = &Town::getEvents(); |
| 385 | window->activatedWidgets = 0; |
| 386 | window->disabledWidgets = 0; |
| 387 | window->initScrollWidgets(); |
| 388 | Town::initViewport(*window); |
| 389 | |
| 390 | return window; |
| 391 | } |
| 392 | |
| 393 | namespace Population |
| 394 | { |
nothing calls this directly
no test coverage detected