MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / windowFitsWithinSpace

Function windowFitsWithinSpace

src/OpenLoco/src/Ui/WindowManager.cpp:464–513  ·  view source on GitHub ↗

* 0x004C9BEA * * @param x @ * @param y @ * @param width @ * @param height @ */

Source from the content-addressed store, hash-verified

462 * @param height @<cx>
463 */
464 static bool windowFitsWithinSpace(Ui::Point position, Ui::Size size)
465 {
466 if (position.x < 0)
467 {
468 return false;
469 }
470
471 if (position.y < 28)
472 {
473 return false;
474 }
475
476 if (position.x + size.width > Ui::width())
477 {
478 return false;
479 }
480
481 if (position.y + size.height > Ui::width())
482 {
483 return false;
484 }
485
486 for (const auto& w : _windows)
487 {
488 if (w.hasFlags(WindowFlags::stickToBack))
489 {
490 continue;
491 }
492 if (position.x + size.width <= w.x)
493 {
494 continue;
495 }
496 if (position.x > w.x + w.width)
497 {
498 continue;
499 }
500 if (position.y + size.height <= w.y)
501 {
502 continue;
503 }
504 if (position.y >= w.y + w.height)
505 {
506 continue;
507 }
508
509 return false;
510 }
511
512 return true;
513 }
514
515 // 0x004C9F27
516 static Window* createWindowOnScreen(

Callers 2

windowFitsOnScreenFunction · 0.85
createWindowFunction · 0.85

Calls 2

widthFunction · 0.85
hasFlagsMethod · 0.45

Tested by

no test coverage detected