@@ -531,6 +531,14 @@ namespace OpenRCT2::Ui::Windows
531
531
532
532
widgets[WIDX_FIRE].left = width - 25 ;
533
533
widgets[WIDX_FIRE].right = width - 2 ;
534
+
535
+ if (viewport != nullptr )
536
+ {
537
+ const Widget& viewportWidget = widgets[WIDX_VIEWPORT];
538
+ viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget.left + 1 , viewportWidget.top + 1 };
539
+ viewport->width = widgets[WIDX_VIEWPORT].width () - 1 ;
540
+ viewport->height = widgets[WIDX_VIEWPORT].height () - 1 ;
541
+ }
534
542
}
535
543
536
544
void OverviewDraw (RenderTarget& rt)
@@ -605,21 +613,6 @@ namespace OpenRCT2::Ui::Windows
605
613
{
606
614
WindowSetResize (*this , { WW, WH }, { 500 , 450 });
607
615
608
- if (viewport != nullptr )
609
- {
610
- auto widget = widgets[WIDX_VIEWPORT];
611
- auto newWidth = widget.width () - 1 ;
612
- auto newHeight = widget.height () - 1 ;
613
- viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1 , widget.top + 1 };
614
-
615
- // Update the viewport size
616
- if (viewport->width != newWidth || viewport->height != newHeight)
617
- {
618
- viewport->width = newWidth;
619
- viewport->height = newHeight;
620
- }
621
- }
622
-
623
616
ViewportInit ();
624
617
}
625
618
@@ -1229,7 +1222,10 @@ namespace OpenRCT2::Ui::Windows
1229
1222
return nullptr ;
1230
1223
1231
1224
if (w != nullptr )
1225
+ {
1232
1226
w->Initialise (peep->Id );
1227
+ w->OnResize (); // Initialise viewport after peep id is set
1228
+ }
1233
1229
1234
1230
return w;
1235
1231
}
0 commit comments