0x0046B490
| 2406 | |
| 2407 | // 0x0046B490 |
| 2408 | void open() |
| 2409 | { |
| 2410 | auto window = WindowManager::bringToFront(WindowType::map, 0); |
| 2411 | if (window != nullptr) |
| 2412 | { |
| 2413 | return; |
| 2414 | } |
| 2415 | |
| 2416 | auto ptr = malloc(kRenderedMapSize * 2); |
| 2417 | if (ptr == nullptr) |
| 2418 | { |
| 2419 | return; |
| 2420 | } |
| 2421 | |
| 2422 | _mapPixels = static_cast<PaletteIndex_t*>(ptr); |
| 2423 | _mapAltPixels = &_mapPixels[kRenderedMapSize]; |
| 2424 | |
| 2425 | Ui::Size size = { 350, 272 }; |
| 2426 | |
| 2427 | if (Ui::getLastMapWindowAttributes().flags != WindowFlags::none) |
| 2428 | { |
| 2429 | size = { Ui::getLastMapWindowAttributes().size.width, Ui::getLastMapWindowAttributes().size.height }; |
| 2430 | size.width = std::clamp<uint16_t>(size.width, 350, Ui::width()); |
| 2431 | size.height = std::clamp<uint16_t>(size.height, 272, Ui::height() - 56); |
| 2432 | } |
| 2433 | |
| 2434 | window = WindowManager::createWindow(WindowType::map, size, WindowFlags::none, getEvents()); |
| 2435 | window->setWidgets(kWidgets); |
| 2436 | window->initScrollWidgets(); |
| 2437 | window->frameNo = 0; |
| 2438 | |
| 2439 | if (Ui::getLastMapWindowAttributes().flags != WindowFlags::none) |
| 2440 | { |
| 2441 | window->var_88A = Ui::getLastMapWindowAttributes().var88A; |
| 2442 | window->var_88C = Ui::getLastMapWindowAttributes().var88C; |
| 2443 | window->flags |= (Ui::getLastMapWindowAttributes().flags & WindowFlags::maximised); |
| 2444 | } |
| 2445 | |
| 2446 | auto skin = ObjectManager::get<InterfaceSkinObject>(); |
| 2447 | window->setColour(WindowColour::primary, skin->windowTitlebarColour); |
| 2448 | window->setColour(WindowColour::secondary, skin->windowMapColour); |
| 2449 | |
| 2450 | window->var_846 = getCurrentRotation(); |
| 2451 | |
| 2452 | clearMap(); |
| 2453 | |
| 2454 | centerOnViewPoint(); |
| 2455 | |
| 2456 | window->currentTab = 0; |
| 2457 | window->showTownNames = true; |
| 2458 | window->var_854 = 0; |
| 2459 | |
| 2460 | assignIndustryColours(); |
| 2461 | assignRouteColours(); |
| 2462 | |
| 2463 | mapFrameNumber = 0; |
| 2464 | } |
| 2465 |
nothing calls this directly
no test coverage detected