mirror of https://github.com/OpenRCT2/OpenRCT2.git
parent
a102892370
commit
14a07359b3
|
@ -219,9 +219,8 @@ static void window_ride_demolish_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
if (ride != nullptr)
|
||||
{
|
||||
auto stringId = (gParkFlags & PARK_FLAGS_NO_MONEY) ? STR_DEMOLISH_RIDE_ID : STR_DEMOLISH_RIDE_ID_MONEY;
|
||||
auto nameArgLen = ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(nameArgLen);
|
||||
ride->FormatNameTo(ft);
|
||||
ft.Add<money32>(_demolishRideCost);
|
||||
|
||||
ScreenCoordsXY stringCoords(w->windowPos.x + WW / 2, w->windowPos.y + (WH / 2) - 3);
|
||||
|
@ -237,9 +236,8 @@ static void window_ride_refurbish_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
if (ride != nullptr)
|
||||
{
|
||||
auto stringId = (gParkFlags & PARK_FLAGS_NO_MONEY) ? STR_REFURBISH_RIDE_ID_NO_MONEY : STR_REFURBISH_RIDE_ID_MONEY;
|
||||
auto nameArgLen = ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(nameArgLen);
|
||||
ride->FormatNameTo(ft);
|
||||
ft.Add<money32>(_demolishRideCost / 2);
|
||||
|
||||
ScreenCoordsXY stringCoords(w->windowPos.x + WW / 2, w->windowPos.y + (WH / 2) - 3);
|
||||
|
|
|
@ -1172,8 +1172,10 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
|
|||
}
|
||||
|
||||
// Ride name
|
||||
uint32_t args[32]{};
|
||||
ride->FormatNameTo(args);
|
||||
uint8_t args[32]{};
|
||||
|
||||
Formatter ft(args);
|
||||
ride->FormatNameTo(ft);
|
||||
gfx_draw_string_left(dpi, stringId, args, COLOUR_BLACK, { 15, y });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1207,7 +1207,7 @@ static void window_finances_marketing_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
auto ride = get_ride(campaign->RideId);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1708,7 +1708,7 @@ void window_guest_rides_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto ride = get_ride(peep->FavouriteRide);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
}
|
||||
gfx_draw_string_left_clipped(dpi, STR_FAVOURITE_RIDE, gCommonFormatArgs, COLOUR_BLACK, screenCoords, w->width - 14);
|
||||
|
@ -1741,7 +1741,8 @@ void window_guest_rides_scroll_paint(rct_window* w, rct_drawpixelinfo* dpi, int3
|
|||
auto ride = get_ride(w->list_item_positions[list_index]);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, COLOUR_BLACK, { 0, y - 1 });
|
||||
}
|
||||
}
|
||||
|
@ -1965,7 +1966,12 @@ static rct_string_id window_guest_inventory_format_item(Peep* peep, int32_t item
|
|||
case SHOP_ITEM_PHOTO:
|
||||
ride = get_ride(peep->Photo1RideRef);
|
||||
if (ride != nullptr)
|
||||
ride->FormatNameTo(gCommonFormatArgs + 6);
|
||||
{
|
||||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
|
||||
break;
|
||||
case SHOP_ITEM_UMBRELLA:
|
||||
ft.Rewind();
|
||||
|
@ -1988,7 +1994,7 @@ static rct_string_id window_guest_inventory_format_item(Peep* peep, int32_t item
|
|||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ft.Add<rct_string_id>(STR_PEEP_INVENTORY_VOUCHER_RIDE_FREE);
|
||||
ride->FormatNameTo(gCommonFormatArgs + 8);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
break;
|
||||
case VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE:
|
||||
|
@ -2017,17 +2023,29 @@ static rct_string_id window_guest_inventory_format_item(Peep* peep, int32_t item
|
|||
case SHOP_ITEM_PHOTO2:
|
||||
ride = get_ride(peep->Photo2RideRef);
|
||||
if (ride != nullptr)
|
||||
ride->FormatNameTo(gCommonFormatArgs + 6);
|
||||
{
|
||||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
break;
|
||||
case SHOP_ITEM_PHOTO3:
|
||||
ride = get_ride(peep->Photo3RideRef);
|
||||
if (ride != nullptr)
|
||||
ride->FormatNameTo(gCommonFormatArgs + 6);
|
||||
{
|
||||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
break;
|
||||
case SHOP_ITEM_PHOTO4:
|
||||
ride = get_ride(peep->Photo4RideRef);
|
||||
if (ride != nullptr)
|
||||
ride->FormatNameTo(gCommonFormatArgs + 6);
|
||||
{
|
||||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
|
|||
if (ride != nullptr)
|
||||
{
|
||||
ft.Add<rct_string_id>(ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE) ? STR_IN_RIDE : STR_ON_RIDE);
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
_window_guest_list_selected_filter = 0;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
|
@ -307,7 +307,7 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
|
|||
if (ride != nullptr)
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_QUEUING_FOR);
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
_window_guest_list_selected_filter = 0;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
|
@ -322,7 +322,7 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
|
|||
if (ride != nullptr)
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_NONE);
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
_window_guest_list_selected_filter = 1;
|
||||
_window_guest_list_highlighted_index = 0xFFFF;
|
||||
|
|
|
@ -426,13 +426,14 @@ static void window_maze_construction_tooldown(rct_window* w, rct_widgetindex wid
|
|||
static void window_maze_construction_invalidate(rct_window* w)
|
||||
{
|
||||
auto ride = get_ride(_currentRideIndex);
|
||||
auto ft = Formatter::Common();
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs + 4);
|
||||
ft.Increment(4);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(4);
|
||||
ft.Add<rct_string_id>(STR_NONE);
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ static void window_new_campaign_mousedown(rct_window* w, rct_widgetindex widgetI
|
|||
Formatter ft(reinterpret_cast<uint8_t*>(&gDropdownItemsArgs[numItems]));
|
||||
if (ride->custom_name.empty())
|
||||
{
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -343,7 +343,9 @@ static void window_new_campaign_invalidate(rct_window* w)
|
|||
if (ride != nullptr)
|
||||
{
|
||||
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].text = STR_STRINGID;
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -2641,7 +2641,8 @@ static void window_ride_main_invalidate(rct_window* w)
|
|||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK))
|
||||
w->disabled_widgets |= (1 << WIDX_DEMOLISH);
|
||||
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
uint32_t spriteIds[] = {
|
||||
SPR_CLOSED,
|
||||
|
@ -3091,7 +3092,6 @@ static void window_ride_vehicle_invalidate(rct_window* w)
|
|||
rideEntry = ride->GetRideEntry();
|
||||
|
||||
w->widgets[WIDX_TITLE].text = STR_ARG_20_STRINGID;
|
||||
ride->FormatNameTo(gCommonFormatArgs + 20);
|
||||
|
||||
// Widget setup
|
||||
carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars;
|
||||
|
@ -3154,6 +3154,7 @@ static void window_ride_vehicle_invalidate(rct_window* w)
|
|||
stringId = RideComponentNames[RIDE_COMPONENT_TYPE_CAR].plural;
|
||||
}
|
||||
ft.Add<rct_string_id>(stringId);
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
window_ride_anchor_border_widgets(w);
|
||||
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10);
|
||||
|
@ -3670,7 +3671,8 @@ static void window_ride_operating_invalidate(rct_window* w)
|
|||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
// Widget setup
|
||||
w->pressed_widgets &= ~(
|
||||
|
@ -3688,7 +3690,7 @@ static void window_ride_operating_invalidate(rct_window* w)
|
|||
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED].type = WWT_SPINNER;
|
||||
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WWT_BUTTON;
|
||||
window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WWT_BUTTON;
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(20);
|
||||
ft.Add<uint16_t>(ride->lift_hill_speed);
|
||||
}
|
||||
|
@ -3707,7 +3709,7 @@ static void window_ride_operating_invalidate(rct_window* w)
|
|||
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WWT_SPINNER;
|
||||
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WWT_BUTTON;
|
||||
window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WWT_BUTTON;
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(22);
|
||||
ft.Add<uint16_t>(ride->num_circuits);
|
||||
}
|
||||
|
@ -3773,7 +3775,7 @@ static void window_ride_operating_invalidate(rct_window* w)
|
|||
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WWT_BUTTON;
|
||||
window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WWT_BUTTON;
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(10);
|
||||
ft.Add<rct_string_id>(STR_FORMAT_SECONDS);
|
||||
ft.Add<uint16_t>(ride->min_waiting_time);
|
||||
|
@ -3810,7 +3812,7 @@ static void window_ride_operating_invalidate(rct_window* w)
|
|||
w->pressed_widgets |= (1 << WIDX_MAXIMUM_LENGTH_CHECKBOX);
|
||||
|
||||
// Mode specific functionality
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(18);
|
||||
ft.Add<uint16_t>(ride->operation_option);
|
||||
switch (ride->mode)
|
||||
|
@ -4269,7 +4271,8 @@ static void window_ride_maintenance_invalidate(rct_window* w)
|
|||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
window_ride_maintenance_widgets[WIDX_INSPECTION_INTERVAL].text = RideInspectionIntervalNames[ride->inspection_interval];
|
||||
|
||||
|
@ -4829,7 +4832,9 @@ static void window_ride_colour_invalidate(rct_window* w)
|
|||
return;
|
||||
|
||||
w->widgets[WIDX_TITLE].text = STR_ARG_16_STRINGID;
|
||||
ride->FormatNameTo(gCommonFormatArgs + 16);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(16);
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
// Track colours
|
||||
int32_t colourScheme = w->ride_colour;
|
||||
|
@ -4993,7 +4998,7 @@ static void window_ride_colour_invalidate(rct_window* w)
|
|||
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WWT_EMPTY;
|
||||
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WWT_EMPTY;
|
||||
}
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ft.Add<rct_string_id>(VehicleColourSchemeNames[vehicleColourSchemeType]);
|
||||
ft.Add<rct_string_id>(RideComponentNames[RideTypeDescriptors[ride->type].NameConvention.vehicle].singular);
|
||||
|
@ -5027,7 +5032,7 @@ static void window_ride_colour_invalidate(rct_window* w)
|
|||
window_ride_colour_widgets[WIDX_VEHICLE_ADDITIONAL_COLOUR_2].type = WWT_EMPTY;
|
||||
}
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(14);
|
||||
ft.Add<rct_string_id>(ColourSchemeNames[colourScheme]);
|
||||
|
||||
|
@ -5349,7 +5354,8 @@ static void window_ride_music_invalidate(rct_window* w)
|
|||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
// Set selected music
|
||||
window_ride_music_widgets[WIDX_MUSIC].text = MusicStyleNames[ride->music];
|
||||
|
@ -5715,7 +5721,8 @@ static void window_ride_measurements_invalidate(rct_window* w)
|
|||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN_NOT_POSSIBLE;
|
||||
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].type = WWT_EMPTY;
|
||||
|
@ -6184,7 +6191,8 @@ static void window_ride_graphs_invalidate(rct_window* w)
|
|||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
// Set pressed graph button type
|
||||
w->pressed_widgets &= ~(1 << WIDX_GRAPH_VELOCITY);
|
||||
|
@ -6735,7 +6743,10 @@ static void window_ride_income_invalidate(rct_window* w)
|
|||
return;
|
||||
|
||||
w->widgets[WIDX_TITLE].text = STR_ARG_14_STRINGID;
|
||||
ride->FormatNameTo(gCommonFormatArgs + 14);
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(14);
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
auto rideEntry = ride->GetRideEntry();
|
||||
if (rideEntry == nullptr)
|
||||
|
@ -6762,7 +6773,7 @@ static void window_ride_income_invalidate(rct_window* w)
|
|||
|
||||
window_ride_income_widgets[WIDX_PRIMARY_PRICE].text = STR_ARG_6_CURRENCY2DP;
|
||||
money16 ridePrimaryPrice = ride_get_price(ride);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(6);
|
||||
ft.Add<money32>(ridePrimaryPrice);
|
||||
if (ridePrimaryPrice == 0)
|
||||
|
@ -7015,7 +7026,8 @@ static void window_ride_customer_invalidate(rct_window* w)
|
|||
auto ride = get_ride(w->number);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
window_ride_customer_widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WWT_FLATBTN;
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP))
|
||||
|
|
|
@ -2303,7 +2303,9 @@ static void window_ride_construction_invalidate(rct_window* w)
|
|||
}
|
||||
|
||||
// Set window title arguments
|
||||
ride->FormatNameTo(gCommonFormatArgs + 4);
|
||||
ft = Formatter::Common();
|
||||
ft.Increment(4);
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -605,11 +605,12 @@ static void window_ride_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
continue;
|
||||
|
||||
// Ride name
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 0, y - 1 }, 159);
|
||||
|
||||
// Ride information
|
||||
auto ft = Formatter::Common();
|
||||
ft.Rewind();
|
||||
ft.Increment(2);
|
||||
auto formatSecondaryEnabled = true;
|
||||
rct_string_id formatSecondary = 0;
|
||||
|
|
|
@ -1925,7 +1925,8 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
dpi, STR_TILE_INSPECTOR_TRACK_RIDE_ID, &rideId, COLOUR_WHITE, screenCoords + ScreenCoordsXY{ 0, 11 });
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_TILE_INSPECTOR_TRACK_RIDE_NAME, gCommonFormatArgs, COLOUR_WHITE,
|
||||
screenCoords + ScreenCoordsXY{ 0, 22 });
|
||||
|
|
|
@ -642,7 +642,8 @@ static void window_title_command_editor_tool_down(
|
|||
if (ride != nullptr)
|
||||
{
|
||||
uint8_t formatArgs[32]{};
|
||||
ride->FormatNameTo(formatArgs);
|
||||
Formatter ft(formatArgs);
|
||||
ride->FormatNameTo(ft);
|
||||
format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, formatArgs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,10 @@ public:
|
|||
}
|
||||
|
||||
res->ErrorTitle = _StatusErrorTitles[_status];
|
||||
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
||||
|
||||
Formatter ft(res->ErrorMessageArgs.data());
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
if (_status != ride->status)
|
||||
{
|
||||
if (_status == RIDE_STATUS_SIMULATING && (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
|
||||
|
@ -136,7 +139,10 @@ public:
|
|||
}
|
||||
|
||||
res->ErrorTitle = _StatusErrorTitles[_status];
|
||||
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
||||
|
||||
Formatter ft(res->ErrorMessageArgs.data());
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
if (!ride->overall_view.isNull())
|
||||
{
|
||||
auto location = ride->overall_view.ToTileCentre();
|
||||
|
|
|
@ -1778,7 +1778,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
if (ride != nullptr)
|
||||
{
|
||||
ft.Add<rct_string_id>(ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE) ? STR_IN_RIDE : STR_ON_RIDE);
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1792,7 +1792,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
auto ride = get_ride(CurrentRide);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1808,7 +1808,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
if (ride != nullptr)
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_HEADING_FOR);
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1823,7 +1823,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
if (ride != nullptr)
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_QUEUING_FOR);
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1837,7 +1837,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
if (ride != nullptr)
|
||||
{
|
||||
ft.Add<rct_string_id>((StandingFlags & 0x1) ? STR_WATCHING_CONSTRUCTION_OF : STR_WATCHING_RIDE);
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1880,7 +1880,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
auto ride = get_ride(CurrentRide);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1894,7 +1894,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
auto ride = get_ride(CurrentRide);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1908,7 +1908,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
auto ride = get_ride(CurrentRide);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1922,7 +1922,7 @@ void Peep::FormatActionTo(Formatter& ft) const
|
|||
auto ride = get_ride(CurrentRide);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->FormatNameTo(ft.Buf());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -942,14 +942,18 @@ static int32_t ride_check_if_construction_allowed(Ride* ride)
|
|||
}
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs + 6);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->status != RIDE_STATUS_SIMULATING)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs + 6);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1807,7 +1811,9 @@ bool ride_modify(CoordsXYE* input)
|
|||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs + 6);
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
context_show_error(
|
||||
STR_CANT_START_CONSTRUCTION_ON, STR_LOCAL_AUTHORITY_FORBIDS_DEMOLITION_OR_MODIFICATIONS_TO_THIS_RIDE);
|
||||
return false;
|
||||
|
@ -2516,7 +2522,8 @@ void ride_prepare_breakdown(Ride* ride, int32_t breakdownReason)
|
|||
*/
|
||||
void ride_breakdown_add_news_item(Ride* ride)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_broken_down)
|
||||
{
|
||||
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_BROKEN_DOWN, ride->id);
|
||||
|
@ -2542,7 +2549,8 @@ static void ride_breakdown_status_update(Ride* ride)
|
|||
if (!(ride->not_fixed_timeout & 15) && ride->mechanic_status != RIDE_MECHANIC_STATUS_FIXING
|
||||
&& ride->mechanic_status != RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES)
|
||||
{
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_STILL_NOT_FIXED, ride->id);
|
||||
|
@ -3192,7 +3200,8 @@ static void ride_entrance_exit_connected(Ride* ride)
|
|||
if (!entrance.isNull() && !ride_entrance_exit_is_reachable(entrance))
|
||||
{
|
||||
// name of ride is parameter of the format string
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride->id);
|
||||
|
@ -3203,7 +3212,8 @@ static void ride_entrance_exit_connected(Ride* ride)
|
|||
if (!exit.isNull() && !ride_entrance_exit_is_reachable(exit))
|
||||
{
|
||||
// name of ride is parameter of the format string
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
news_item_add_to_queue(1, STR_EXIT_NOT_CONNECTED, ride->id);
|
||||
|
@ -3278,7 +3288,8 @@ static void ride_shop_connected(Ride* ride)
|
|||
}
|
||||
|
||||
// Name of ride is parameter of the format string
|
||||
ride->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride->id);
|
||||
|
@ -5516,13 +5527,14 @@ static bool ride_with_colour_config_exists(uint8_t ride_type, const TrackColour*
|
|||
bool Ride::NameExists(const std::string_view& name, ride_id_t excludeRideId)
|
||||
{
|
||||
char buffer[256]{};
|
||||
uint32_t formatArgs[32]{};
|
||||
uint8_t formatArgs[32]{};
|
||||
|
||||
for (auto& ride : GetRideManager())
|
||||
{
|
||||
if (ride.id != excludeRideId)
|
||||
{
|
||||
ride.FormatNameTo(formatArgs);
|
||||
Formatter ft(formatArgs);
|
||||
ride.FormatNameTo(ft);
|
||||
format_string(buffer, 256, STR_STRINGID, formatArgs);
|
||||
if (std::string_view(buffer) == name && ride_has_any_track_elements(&ride))
|
||||
{
|
||||
|
@ -5615,7 +5627,8 @@ void Ride::SetNameToDefault()
|
|||
do
|
||||
{
|
||||
default_name_number++;
|
||||
FormatNameTo(rideNameArgs);
|
||||
Formatter ft(rideNameArgs);
|
||||
FormatNameTo(ft);
|
||||
format_string(rideNameBuffer, 256, STR_STRINGID, &rideNameArgs);
|
||||
} while (Ride::NameExists(rideNameBuffer, id));
|
||||
}
|
||||
|
@ -7087,7 +7100,8 @@ void Ride::Crash(uint8_t vehicleIndex)
|
|||
}
|
||||
}
|
||||
|
||||
FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_crashed)
|
||||
{
|
||||
news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_HAS_CRASHED, id);
|
||||
|
@ -7610,24 +7624,19 @@ void ride_clear_leftover_entrances(Ride* ride)
|
|||
std::string Ride::GetName() const
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
FormatNameTo(args);
|
||||
|
||||
Formatter ft(args);
|
||||
FormatNameTo(ft);
|
||||
return format_string(STR_STRINGID, args);
|
||||
}
|
||||
|
||||
void Ride::FormatNameTo(Formatter& ft) const
|
||||
{
|
||||
ft.Increment(FormatNameTo(ft.Buf()));
|
||||
}
|
||||
|
||||
size_t Ride::FormatNameTo(void* argsV) const
|
||||
{
|
||||
Formatter ft(static_cast<uint8_t*>(argsV));
|
||||
if (!custom_name.empty())
|
||||
{
|
||||
auto str = custom_name.c_str();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<void*>(str);
|
||||
return ft.NumBytes();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7653,7 +7662,6 @@ size_t Ride::FormatNameTo(void* argsV) const
|
|||
}
|
||||
}
|
||||
ft.Add<rct_string_id>(1).Add<rct_string_id>(rideTypeName).Add<uint16_t>(default_name_number);
|
||||
return ft.NumBytes();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -422,7 +422,6 @@ public:
|
|||
void SetNameToDefault();
|
||||
std::string GetName() const;
|
||||
void FormatNameTo(Formatter&) const;
|
||||
size_t FormatNameTo(void* args) const;
|
||||
void FormatStatusTo(Formatter&) const;
|
||||
size_t FormatStatusTo(void* args) const;
|
||||
|
||||
|
|
|
@ -1241,7 +1241,9 @@ void map_obstruction_set_error_text(TileElement* tileElement, GameActionResult&
|
|||
if (ride != nullptr)
|
||||
{
|
||||
res.ErrorMessage = STR_X_IN_THE_WAY;
|
||||
ride->FormatNameTo(res.ErrorMessageArgs.data());
|
||||
|
||||
Formatter ft(res.ErrorMessageArgs.data());
|
||||
ride->FormatNameTo(ft);
|
||||
}
|
||||
break;
|
||||
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
|
||||
|
|
Loading…
Reference in New Issue