From 2ab3bd515d178caa03286f3373fa77921c70e7a0 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Wed, 13 Jun 2018 20:44:26 +0100 Subject: [PATCH] Fix #7673: Vehicle names cut in invention list (#7675) * Fix #7673: Vehicle names cut in invention list The string formatting was formatting based on the size of the pointer to the buffer, not the buffer itself, this truncated all vehicle names to 8 characters. * Adjust Long Vehicle Names For Vertical Scrollbar The ellipsis in long vehicle names were being cut off by the scrollbar. Reduced the string formatting length by vertical scrollbar size - 1. The extra 1 is for the fact that the second column starts + 1 from the middlepoint of the box. --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/EditorInventionsList.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 222f09a4ce..485053a8b3 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -2,6 +2,7 @@ ------------------------------------------------------------------------ - Feature: [#6998] Guests now wait for passing vehicles before crossing railway tracks. - Fix: [#7653] Finances money spinner is too narrow for big loans. +- Fix: [#7673] Vehicle names are cut off in invention list. - Fix: [#7674] Rides show up as random numbers in guest's ride list. 0.2.0 (2018-06-10) diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index c9127b14bf..ec576486bd 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -801,12 +801,12 @@ static void window_editor_inventions_list_scrollpaint(rct_window *w, rct_drawpix if (researchItem->type == RESEARCH_ENTRY_TYPE_RIDE && !RideGroupManager::RideTypeIsIndependent(researchItem->baseRideType)) { const rct_string_id rideGroupName = get_ride_naming(researchItem->baseRideType, get_ride_entry(researchItem->entryIndex)).name; - format_string(groupNamePtr, sizeof(groupNameBuffer), STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, (void*) &rideGroupName); - format_string(vehicleNamePtr, sizeof(vehicleNamePtr), itemNameId, nullptr); + format_string(groupNamePtr, Util::CountOf(groupNameBuffer), STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, (void*) &rideGroupName); + format_string(vehicleNamePtr, Util::CountOf(vehicleNameBuffer), itemNameId, nullptr); } else { - format_string(groupNamePtr, sizeof(groupNameBuffer), itemNameId, nullptr); + format_string(groupNamePtr, Util::CountOf(groupNameBuffer), itemNameId, nullptr); vehicleNamePtr = nullptr; } @@ -817,7 +817,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window *w, rct_drawpix // Draw vehicle name if (vehicleNamePtr) { - gfx_clip_string(vehicleNameBuffer, columnSplitOffset); + gfx_clip_string(vehicleNameBuffer, columnSplitOffset - 11); gfx_draw_string(dpi, vehicleNameBuffer, colour, columnSplitOffset + 1, itemY); } }