1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix #18059: Width and height of custom window not changeable via script (#18061)

This commit is contained in:
Stephan Spengler
2022-09-24 07:06:26 +02:00
committed by GitHub
parent e0a25f3d22
commit 6be41893a4
4 changed files with 40 additions and 8 deletions

View File

@@ -72,9 +72,10 @@
- Fix: [#18009] Visual glitch with litter at edge of sloped path. - Fix: [#18009] Visual glitch with litter at edge of sloped path.
- Fix: [#18025] Fix land ownership in Six Holland, Six Flags Magic Mountain, North America - Grand Canyon and Asia - Great Wall of China Tourism Enhancement scenarios. - Fix: [#18025] Fix land ownership in Six Holland, Six Flags Magic Mountain, North America - Grand Canyon and Asia - Great Wall of China Tourism Enhancement scenarios.
- Fix: [#18026] Park rating drops to 0 with more than 32k guests, total ride excitement or intensity. - Fix: [#18026] Park rating drops to 0 with more than 32k guests, total ride excitement or intensity.
- Fix: [#18051] Visual glitch with Mine Ride's large unbanked turn.
- Fix: [#18032] All non-interactive widgets (labels, groupboxes) produce sound when clicked. - Fix: [#18032] All non-interactive widgets (labels, groupboxes) produce sound when clicked.
- Fix: [#18035] Favourited servers dont get their online status updated. - Fix: [#18035] Favourited servers dont get their online status updated.
- Fix: [#18051] Visual glitch with Mine Ride's large unbanked turn.
- Fix: [#18059] [Plugin] Width and height of custom window not changeable via script.
0.4.1 (2022-07-04) 0.4.1 (2022-07-04)
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@@ -2666,20 +2666,29 @@ declare global {
} }
interface Window { interface Window {
classification: number; readonly classification: number;
number: number; readonly number: number;
x: number; x: number;
y: number; y: number;
/**
* The window is resizable (by the user) if and only if minWidth !== maxWidth or minHeight !== maxHeight.
* In that case, the window displays a small widget in the lower right corner that the user can use to resize the window by clicking and dragging.
*
* When writing to width (or height), if the window is resizable, the new value will be clamped to fit the corresponding min/max values.
* Otherwise, if the window is not resizable, both the width (or height) and the corresponding min/max values are set to the new value.
*
* For the default min/max values, see {@link WindowDesc}.
*/
width: number; width: number;
height: number; height: number;
minWidth: number; minWidth: number;
maxWidth: number; maxWidth: number;
minHeight: number; minHeight: number;
maxHeight: number; maxHeight: number;
isSticky: boolean; readonly isSticky: boolean;
colours: number[]; colours: number[];
title: string; title: string;
widgets: Widget[]; readonly widgets: Widget[];
tabIndex: number; tabIndex: number;
close(): void; close(): void;
@@ -2695,6 +2704,14 @@ declare global {
height: number; height: number;
title: string; title: string;
id?: number; id?: number;
/**
* See {@link Window} for information about the behaviour of min/max width/height after window creation.
*
* Behaviour during window creation:
* If at least one of the parameters min/max width/height is present, the window is considered to be resizable.
* In that case, the min values default to zero (if unspecified) and the max values default to 0xFFFF (if unspecified).
* Otherwise, the min/max width values default to width and the min/max height values default to height.
*/
minWidth?: number; minWidth?: number;
minHeight?: number; minHeight?: number;
maxWidth?: number; maxWidth?: number;

View File

@@ -99,7 +99,14 @@ namespace OpenRCT2::Scripting
auto w = GetWindow(); auto w = GetWindow();
if (w != nullptr) if (w != nullptr)
{ {
window_resize(*w, value - w->width, 0); if (window_can_resize(*w))
{
window_resize(*w, value - w->width, 0);
}
else
{
window_set_resize(*w, value, w->min_height, value, w->max_height);
}
} }
} }
int32_t height_get() const int32_t height_get() const
@@ -116,7 +123,14 @@ namespace OpenRCT2::Scripting
auto w = GetWindow(); auto w = GetWindow();
if (w != nullptr) if (w != nullptr)
{ {
window_resize(*w, 0, value - w->height); if (window_can_resize(*w))
{
window_resize(*w, 0, value - w->height);
}
else
{
window_set_resize(*w, w->min_width, value, w->max_width, value);
}
} }
} }
int32_t minWidth_get() const int32_t minWidth_get() const

View File

@@ -46,7 +46,7 @@ namespace OpenRCT2
namespace OpenRCT2::Scripting namespace OpenRCT2::Scripting
{ {
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 60; static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 61;
// Versions marking breaking changes. // Versions marking breaking changes.
static constexpr int32_t API_VERSION_33_PEEP_DEPRECATION = 33; static constexpr int32_t API_VERSION_33_PEEP_DEPRECATION = 33;