Close OpenRCT2/OpenRCT2#20830: Display author field on scenery window (#21058)

* Close OpenRCT2/OpenRCT2#20830: Display author field on scenery window

* Apply code formatting fixes

* Apply code formatting fixes

* Fix code review changes
This commit is contained in:
Fredrik Tegnell 2023-12-20 01:15:04 +01:00 committed by GitHub
parent bd4b39ed8a
commit 3f5d4b8941
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 4 deletions

View file

@ -3697,6 +3697,8 @@ STR_6591 :Staff member is currently fixing a ride and cant be fired.
STR_6592 :Staff member is currently inspecting a ride and cant be fired.
STR_6593 :Remove park fences
STR_6594 :Tile Inspector: Toggle wall slope
STR_6595 :{WINDOW_COLOUR_2}Author: {BLACK}{STRING}
STR_6596 :{WINDOW_COLOUR_2}Authors: {BLACK}{STRING}
#############
# Scenarios #

View file

@ -6,6 +6,7 @@
- Feature: [OpenMusic#46] Added Mystic ride music style.
- Feature: [OpenMusic#50] Added Rock style 4 ride music.
- Feature: [#20825] Made setting the game speed a game action.
- Feature: [#20830] Display author field on scenery window.
- Feature: [#20853] [Plugin] Add “BaseTileElement.owner” which is saved in the park file.
- Change: [#20790] Default ride price set to free if park charges for entry.
- Change: [#20880] Restore removed default coaster colours.

View file

@ -422,12 +422,12 @@ public:
else
{
const auto& listWidget = widgets[WIDX_SCENERY_LIST];
const auto nonListHeight = height - listWidget.height() + 2;
const auto nonListHeight = height - listWidget.height() + 12;
const auto numRows = static_cast<int32_t>(CountRows());
const auto maxContentHeight = numRows * SCENERY_BUTTON_HEIGHT;
const auto maxWindowHeight = maxContentHeight + nonListHeight;
const auto windowHeight = std::clamp(maxWindowHeight, _actualMinHeight, 463);
const auto windowHeight = std::clamp(maxWindowHeight, _actualMinHeight, 473);
min_height = windowHeight;
max_height = windowHeight;
@ -743,7 +743,7 @@ public:
ResizeFrameWithPage();
widgets[WIDX_SCENERY_LIST].right = windowWidth - 26;
widgets[WIDX_SCENERY_LIST].bottom = height - 14;
widgets[WIDX_SCENERY_LIST].bottom = height - 24;
widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].left = windowWidth - 25;
widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].left = windowWidth - 25;
@ -793,7 +793,29 @@ public:
auto ft = Formatter();
ft.Add<StringId>(name);
DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + height - 13 }, width - 19, STR_BLACK_STRING, ft);
DrawTextEllipsised(dpi, { windowPos.x + 3, windowPos.y + height - 23 }, width - 19, STR_BLACK_STRING, ft);
auto sceneryObjectType = GetObjectTypeFromSceneryType(selectedSceneryEntry.SceneryType);
auto& objManager = GetContext()->GetObjectManager();
auto sceneryObject = objManager.GetLoadedObject(sceneryObjectType, selectedSceneryEntry.EntryIndex);
if (sceneryObject != nullptr && sceneryObject->GetAuthors().size() > 0)
{
std::string authorsString;
const auto& authors = sceneryObject->GetAuthors();
for (size_t i = 0; i < authors.size(); ++i)
{
if (i > 0)
{
authorsString.append(", ");
}
authorsString.append(authors[i]);
}
ft = Formatter();
ft.Add<const char*>(authorsString.c_str());
DrawTextEllipsised(
dpi, windowPos + ScreenCoordsXY{ 3, height - 13 }, width - 19,
(sceneryObject->GetAuthors().size() == 1 ? STR_SCENERY_AUTHOR : STR_SCENERY_AUTHOR_PLURAL), ft);
}
}
void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override

View file

@ -4004,6 +4004,9 @@ enum : uint16_t
STR_SHORTCUT_TOGGLE_WALL_SLOPE = 6594,
STR_SCENERY_AUTHOR = 6595,
STR_SCENERY_AUTHOR_PLURAL = 6596,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
};