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.
This commit is contained in:
Andy Ford 2018-06-13 20:44:26 +01:00 committed by Hielke Morsink
parent 86ca6be58b
commit 2ab3bd515d
2 changed files with 5 additions and 4 deletions

View File

@ -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)

View File

@ -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);
}
}