Merge pull request #21855 from Gymnasiast/fix/small-usability

Small usability fixes
This commit is contained in:
Michael Steenbeek 2024-04-25 16:25:12 +02:00 committed by GitHub
commit af46ff5f0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 118 additions and 79 deletions

View File

@ -3,8 +3,11 @@
- Feature: [#11512] Coloured usernames by group on multiplayer servers.
- Feature: [#21734] Park admittance price can now be set via text input.
- Improved: [#21769] Expose “animation is backwards” wall property in Tile Inspector.
- Improved: [#21855] Add a separator between “Load Game” and “Save Game”, to avoid accidental overwriting.
- Change: [#21715] [Plugin] Remove access to the internal `owner` property. Note: `ownership` is still accessible.
- Change: [#21855] Cheats menu dropdown no longer requires dragging.
- Fix: [#866] Boat Hire boats get stuck entering track.
- Fix: [#19559] Custom rides with long descriptions extend into lower widgets.
- Fix: [#21696] Fullscreen window option not correctly applied on macOS.
- Fix: [#21787] Map generator heightmap should respect increased height limits.
- Fix: [#21829] When creating a new scenario, the default name contains formatting codes.

View File

@ -2559,7 +2559,8 @@ static_assert(std::size(RatingNames) == 6);
void VehicleResize()
{
WindowSetResize(*this, 316, 221, 316, 221);
auto bottom = widgets[WIDX_VEHICLE_TRAINS].bottom + 6;
WindowSetResize(*this, 316, bottom, 316, bottom);
}
void VehicleOnMouseDown(WidgetIndex widgetIndex)
@ -2842,6 +2843,19 @@ static_assert(std::size(RatingNames) == 6);
StringId stringId = rideEntry->nausea_multiplier > 0 ? STR_NAUSEA_FACTOR : STR_NAUSEA_FACTOR_NEGATIVE;
DrawTextBasic(dpi, screenCoords, stringId, ft);
}
const auto minimumPreviewStart = screenCoords.y - windowPos.y + kListRowHeight + 5;
if (minimumPreviewStart > widgets[WIDX_VEHICLE_TRAINS_PREVIEW].top)
{
auto heightIncrease = minimumPreviewStart - widgets[WIDX_VEHICLE_TRAINS_PREVIEW].top;
height += heightIncrease;
ResizeFrameWithPage();
for (auto i = EnumValue(WIDX_VEHICLE_TRAINS_PREVIEW); i <= WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE; i++)
{
widgets[i].moveDown(heightIncrease);
}
}
}
struct VehicleDrawInfo

View File

@ -119,19 +119,20 @@ namespace OpenRCT2::Ui::Windows
{
DDIDX_NEW_GAME = 0,
DDIDX_LOAD_GAME = 1,
DDIDX_SAVE_GAME = 2,
DDIDX_SAVE_GAME_AS = 3,
// separator
DDIDX_ABOUT = 5,
DDIDX_OPTIONS = 6,
DDIDX_SCREENSHOT = 7,
DDIDX_GIANT_SCREENSHOT = 8,
DDIDX_SAVE_GAME = 3,
DDIDX_SAVE_GAME_AS = 4,
// separator
DDIDX_FILE_BUG_ON_GITHUB = 10,
DDIDX_UPDATE_AVAILABLE = 11,
DDIDX_ABOUT = 6,
DDIDX_OPTIONS = 7,
DDIDX_SCREENSHOT = 8,
DDIDX_GIANT_SCREENSHOT = 9,
// separator
DDIDX_QUIT_TO_MENU = 13,
DDIDX_EXIT_OPENRCT2 = 14,
DDIDX_FILE_BUG_ON_GITHUB = 11,
DDIDX_UPDATE_AVAILABLE = 12,
// separator
DDIDX_QUIT_TO_MENU = 14,
DDIDX_EXIT_OPENRCT2 = 15,
};
enum TopToolbarViewMenuDdidx
@ -309,6 +310,8 @@ static Widget _topToolbarWidgets[] = {
void RotateMenuDropdown(int16_t dropdownIndex);
void InitFileMenu(Widget& widget);
void InitCheatsMenu(Widget& widget);
void CheatsMenuDropdown(int16_t dropdownIndex);
@ -2560,77 +2563,12 @@ static Widget _topToolbarWidgets[] = {
void OnMouseDown(WidgetIndex widgetIndex) override
{
int32_t numItems = 0;
Widget& widget = widgets[widgetIndex];
switch (widgetIndex)
{
case WIDX_FILE_MENU:
if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
{
gDropdownItems[numItems++].Format = STR_ABOUT;
gDropdownItems[numItems++].Format = STR_OPTIONS;
gDropdownItems[numItems++].Format = STR_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB;
if (OpenRCT2::GetContext()->HasNewVersionInfo())
gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE;
gDropdownItems[numItems++].Format = STR_EMPTY;
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
gDropdownItems[numItems++].Format = STR_QUIT_ROLLERCOASTER_DESIGNER;
else
gDropdownItems[numItems++].Format = STR_QUIT_TRACK_DESIGNS_MANAGER;
gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2;
}
else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
gDropdownItems[numItems++].Format = STR_LOAD_LANDSCAPE;
gDropdownItems[numItems++].Format = STR_SAVE_LANDSCAPE;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_ABOUT;
gDropdownItems[numItems++].Format = STR_OPTIONS;
gDropdownItems[numItems++].Format = STR_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB;
if (OpenRCT2::GetContext()->HasNewVersionInfo())
gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_QUIT_SCENARIO_EDITOR;
gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2;
}
else
{
gDropdownItems[numItems++].Format = STR_NEW_GAME;
gDropdownItems[numItems++].Format = STR_LOAD_GAME;
gDropdownItems[numItems++].Format = STR_SAVE_GAME;
gDropdownItems[numItems++].Format = STR_SAVE_GAME_AS;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_ABOUT;
gDropdownItems[numItems++].Format = STR_OPTIONS;
gDropdownItems[numItems++].Format = STR_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB;
if (OpenRCT2::GetContext()->HasNewVersionInfo())
gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_QUIT_TO_MENU;
gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2;
}
WindowDropdownShowText(
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80,
Dropdown::Flag::StayOpen, numItems);
InitFileMenu(widget);
break;
case WIDX_CHEATS:
InitCheatsMenu(widget);
@ -3709,6 +3647,78 @@ static Widget _topToolbarWidgets[] = {
}
}
void TopToolbar::InitFileMenu(Widget& widget)
{
int32_t numItems = 0;
if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
{
gDropdownItems[numItems++].Format = STR_ABOUT;
gDropdownItems[numItems++].Format = STR_OPTIONS;
gDropdownItems[numItems++].Format = STR_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB;
if (OpenRCT2::GetContext()->HasNewVersionInfo())
gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE;
gDropdownItems[numItems++].Format = STR_EMPTY;
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
gDropdownItems[numItems++].Format = STR_QUIT_ROLLERCOASTER_DESIGNER;
else
gDropdownItems[numItems++].Format = STR_QUIT_TRACK_DESIGNS_MANAGER;
gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2;
}
else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
gDropdownItems[numItems++].Format = STR_LOAD_LANDSCAPE;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_SAVE_LANDSCAPE;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_ABOUT;
gDropdownItems[numItems++].Format = STR_OPTIONS;
gDropdownItems[numItems++].Format = STR_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB;
if (OpenRCT2::GetContext()->HasNewVersionInfo())
gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_QUIT_SCENARIO_EDITOR;
gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2;
}
else
{
gDropdownItems[numItems++].Format = STR_NEW_GAME;
gDropdownItems[numItems++].Format = STR_LOAD_GAME;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_SAVE_GAME;
gDropdownItems[numItems++].Format = STR_SAVE_GAME_AS;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_ABOUT;
gDropdownItems[numItems++].Format = STR_OPTIONS;
gDropdownItems[numItems++].Format = STR_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_FILE_BUG_ON_GITHUB;
if (OpenRCT2::GetContext()->HasNewVersionInfo())
gDropdownItems[numItems++].Format = STR_UPDATE_AVAILABLE;
gDropdownItems[numItems++].Format = STR_EMPTY;
gDropdownItems[numItems++].Format = STR_QUIT_TO_MENU;
gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2;
}
WindowDropdownShowText(
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80,
Dropdown::Flag::StayOpen, numItems);
}
void TopToolbar::InitCheatsMenu(Widget& widget)
{
using namespace Dropdown;
@ -3730,8 +3740,8 @@ static Widget _topToolbarWidgets[] = {
SetItems(items);
WindowDropdownShowText(
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80, 0,
TOP_TOOLBAR_CHEATS_COUNT);
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[0] | 0x80,
Dropdown::Flag::StayOpen, TOP_TOOLBAR_CHEATS_COUNT);
// Disable items that are not yet available in multiplayer
if (NetworkGetMode() != NETWORK_MODE_NONE)

View File

@ -137,6 +137,18 @@ struct Widget
return top - 1;
}
void moveRight(int32_t amount)
{
left += amount;
right += amount;
}
void moveDown(int32_t amount)
{
top += amount;
bottom += amount;
}
bool IsVisible() const
{
return !(flags & WIDGET_FLAGS::IS_HIDDEN);