Adjust Formatter function names according to coding style (#11378)

This commit is contained in:
Breno Rodrigues Guimarães authored and GitHub committed 2020-04-20 18:55:15 -03:00
1 parent e1e58423fc
commit 2479256bc1
10 files changed
+93 -93

No files matched your search

+1 -1
View File
@@ -450,7 +450,7 @@ static void widget_groupbox_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widg
utf8 buffer[512] = { 0 };
uint8_t args[sizeof(uintptr_t)] = { 0 };
format_string(buffer, sizeof(buffer), widget->text, gCommonFormatArgs);
Formatter(args).add<utf8*>(buffer);
Formatter(args).Add<utf8*>(buffer);
gfx_draw_string_left(dpi, STR_STRING, args, colour, l, t);
textRight = l + gfx_get_string_width(buffer) + 1;
}
+8 -8
View File
@@ -291,8 +291,8 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
auto ride = get_ride(index & 0xFF);
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());
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());
_window_guest_list_selected_filter = 0;
_window_guest_list_highlighted_index = 0xFFFF;
@@ -306,8 +306,8 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
auto ride = get_ride(index & 0xFF);
if (ride != nullptr)
{
ft.add<rct_string_id>(STR_QUEUING_FOR);
ride->FormatNameTo(ft.buf());
ft.Add<rct_string_id>(STR_QUEUING_FOR);
ride->FormatNameTo(ft.Buf());
_window_guest_list_selected_filter = 0;
_window_guest_list_highlighted_index = 0xFFFF;
@@ -321,8 +321,8 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
auto ride = get_ride(index & 0xFF);
if (ride != nullptr)
{
ft.add<rct_string_id>(STR_NONE);
ride->FormatNameTo(ft.buf());
ft.Add<rct_string_id>(STR_NONE);
ride->FormatNameTo(ft.Buf());
_window_guest_list_selected_filter = 1;
_window_guest_list_highlighted_index = 0xFFFF;
@@ -333,7 +333,7 @@ rct_window* window_guest_list_open_with_filter(int32_t type, int32_t index)
}
case GLFT_GUESTS_THINKING_X:
{
ft.add<rct_string_id>(PeepThoughts[index & 0xFF]);
ft.Add<rct_string_id>(PeepThoughts[index & 0xFF]);
_window_guest_list_selected_filter = 1;
_window_guest_list_highlighted_index = 0xFFFF;
@@ -878,7 +878,7 @@ static int32_t window_guest_list_is_peep_in_filter(Peep* peep)
if (_window_guest_list_filter_arguments.GetFirstStringId() == STR_NONE && _window_guest_list_selected_filter == 1)
{
Formatter(peepArgs.args).add<rct_string_id>(STR_NONE);
Formatter(peepArgs.args).Add<rct_string_id>(STR_NONE);
}
if (_window_guest_list_filter_arguments == peepArgs)
+2 -2
View File
@@ -265,12 +265,12 @@ 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.Buf());
}
else
{
gDropdownItemsFormat[numItems] = STR_OPTIONS_DROPDOWN_ITEM;
ft.add<const char*>(ride->custom_name.c_str());
ft.Add<const char*>(ride->custom_name.c_str());
}
numItems++;
}
+7 -7
View File
@@ -115,17 +115,17 @@ private:
Formatter ft(args);
if (_downloadStatusInfo.Source.empty())
{
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
ft.add<char*>(_downloadStatusInfo.Name.c_str());
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
ft.Add<char*>(_downloadStatusInfo.Name.c_str());
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, args);
}
else
{
ft.add<char*>(_downloadStatusInfo.Name.c_str());
ft.add<char*>(_downloadStatusInfo.Source.c_str());
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
ft.Add<char*>(_downloadStatusInfo.Name.c_str());
ft.Add<char*>(_downloadStatusInfo.Source.c_str());
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, args);
}
+1 -1
View File
@@ -272,7 +272,7 @@ namespace GameActions
{
result->Error = GA_ERROR::INSUFFICIENT_FUNDS;
result->ErrorMessage = STR_NOT_ENOUGH_CASH_REQUIRES;
Formatter(result->ErrorMessageArgs.data()).add<uint32_t>(result->Cost);
Formatter(result->ErrorMessageArgs.data()).Add<uint32_t>(result->Cost);
}
}
return result;
+3 -3
View File
@@ -117,17 +117,17 @@ public:
{
}
auto buf()
auto Buf()
{
return CurrentBuf;
}
std::size_t bytes() const
std::size_t NumBytes() const
{
return CurrentBuf - StartBuf;
}
template<typename TSpecified, typename TDeduced> Formatter& add(TDeduced value)
template<typename TSpecified, typename TDeduced> Formatter& Add(TDeduced value)
{
uintptr_t convertedValue;
if constexpr (std::is_integral_v<TSpecified>)
+1 -1
View File
@@ -2451,7 +2451,7 @@ void Network::Client_Handle_GAMESTATE(NetworkConnection& connection, NetworkPack
log_info("Wrote desync report to '%s'", outputFile.c_str());
uint8_t args[32]{};
Formatter(args).add<char*>(uniqueFileName);
Formatter(args).Add<char*>(uniqueFileName);
char str_desync[1024];
format_string(str_desync, sizeof(str_desync), STR_DESYNC_REPORT, args);
+43 -43
View File
@@ -1790,10 +1790,10 @@ void Peep::FormatActionTo(void* argsV) const
switch (state)
{
case PEEP_STATE_FALLING:
ft.add<rct_string_id>(action == PEEP_ACTION_DROWNING ? STR_DROWNING : STR_WALKING);
ft.Add<rct_string_id>(action == PEEP_ACTION_DROWNING ? STR_DROWNING : STR_WALKING);
break;
case PEEP_STATE_1:
ft.add<rct_string_id>(STR_WALKING);
ft.Add<rct_string_id>(STR_WALKING);
break;
case PEEP_STATE_ON_RIDE:
case PEEP_STATE_LEAVING_RIDE:
@@ -1802,26 +1802,26 @@ void Peep::FormatActionTo(void* argsV) const
auto ride = get_ride(current_ride);
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());
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());
}
else
{
ft.add<rct_string_id>(STR_ON_RIDE).add<rct_string_id>(STR_NONE);
ft.Add<rct_string_id>(STR_ON_RIDE).Add<rct_string_id>(STR_NONE);
}
break;
}
case PEEP_STATE_BUYING:
{
ft.add<rct_string_id>(STR_AT_RIDE);
ft.Add<rct_string_id>(STR_AT_RIDE);
auto ride = get_ride(current_ride);
if (ride != nullptr)
{
ride->FormatNameTo(ft.buf());
ride->FormatNameTo(ft.Buf());
}
else
{
ft.add<rct_string_id>(STR_NONE);
ft.Add<rct_string_id>(STR_NONE);
}
break;
}
@@ -1832,13 +1832,13 @@ void Peep::FormatActionTo(void* argsV) const
auto ride = get_ride(guest_heading_to_ride_id);
if (ride != nullptr)
{
ft.add<rct_string_id>(STR_HEADING_FOR);
ride->FormatNameTo(ft.buf());
ft.Add<rct_string_id>(STR_HEADING_FOR);
ride->FormatNameTo(ft.Buf());
}
}
else
{
ft.add<rct_string_id>((peep_flags & PEEP_FLAGS_LEAVING_PARK) ? STR_LEAVING_PARK : STR_WALKING);
ft.Add<rct_string_id>((peep_flags & PEEP_FLAGS_LEAVING_PARK) ? STR_LEAVING_PARK : STR_WALKING);
}
break;
case PEEP_STATE_QUEUING_FRONT:
@@ -1847,13 +1847,13 @@ void Peep::FormatActionTo(void* argsV) const
auto ride = get_ride(current_ride);
if (ride != nullptr)
{
ft.add<rct_string_id>(STR_QUEUING_FOR);
ride->FormatNameTo(ft.buf());
ft.Add<rct_string_id>(STR_QUEUING_FOR);
ride->FormatNameTo(ft.Buf());
}
break;
}
case PEEP_STATE_SITTING:
ft.add<rct_string_id>(STR_SITTING);
ft.Add<rct_string_id>(STR_SITTING);
break;
case PEEP_STATE_WATCHING:
if (current_ride != RIDE_ID_NULL)
@@ -1861,97 +1861,97 @@ void Peep::FormatActionTo(void* argsV) const
auto ride = get_ride(current_ride);
if (ride != nullptr)
{
ft.add<rct_string_id>((current_seat & 0x1) ? STR_WATCHING_CONSTRUCTION_OF : STR_WATCHING_RIDE);
ride->FormatNameTo(ft.buf());
ft.Add<rct_string_id>((current_seat & 0x1) ? STR_WATCHING_CONSTRUCTION_OF : STR_WATCHING_RIDE);
ride->FormatNameTo(ft.Buf());
}
}
else
{
ft.add<rct_string_id>((current_seat & 0x1) ? STR_WATCHING_NEW_RIDE_BEING_CONSTRUCTED : STR_LOOKING_AT_SCENERY);
ft.Add<rct_string_id>((current_seat & 0x1) ? STR_WATCHING_NEW_RIDE_BEING_CONSTRUCTED : STR_LOOKING_AT_SCENERY);
}
break;
case PEEP_STATE_PICKED:
ft.add<rct_string_id>(STR_SELECT_LOCATION);
ft.Add<rct_string_id>(STR_SELECT_LOCATION);
break;
case PEEP_STATE_PATROLLING:
case PEEP_STATE_ENTERING_PARK:
case PEEP_STATE_LEAVING_PARK:
ft.add<rct_string_id>(STR_WALKING);
ft.Add<rct_string_id>(STR_WALKING);
break;
case PEEP_STATE_MOWING:
ft.add<rct_string_id>(STR_MOWING_GRASS);
ft.Add<rct_string_id>(STR_MOWING_GRASS);
break;
case PEEP_STATE_SWEEPING:
ft.add<rct_string_id>(STR_SWEEPING_FOOTPATH);
ft.Add<rct_string_id>(STR_SWEEPING_FOOTPATH);
break;
case PEEP_STATE_WATERING:
ft.add<rct_string_id>(STR_WATERING_GARDENS);
ft.Add<rct_string_id>(STR_WATERING_GARDENS);
break;
case PEEP_STATE_EMPTYING_BIN:
ft.add<rct_string_id>(STR_EMPTYING_LITTER_BIN);
ft.Add<rct_string_id>(STR_EMPTYING_LITTER_BIN);
break;
case PEEP_STATE_ANSWERING:
if (sub_state == 0)
{
ft.add<rct_string_id>(STR_WALKING);
ft.Add<rct_string_id>(STR_WALKING);
}
else if (sub_state == 1)
{
ft.add<rct_string_id>(STR_ANSWERING_RADIO_CALL);
ft.Add<rct_string_id>(STR_ANSWERING_RADIO_CALL);
}
else
{
ft.add<rct_string_id>(STR_RESPONDING_TO_RIDE_BREAKDOWN_CALL);
ft.Add<rct_string_id>(STR_RESPONDING_TO_RIDE_BREAKDOWN_CALL);
auto ride = get_ride(current_ride);
if (ride != nullptr)
{
ride->FormatNameTo(ft.buf());
ride->FormatNameTo(ft.Buf());
}
else
{
ft.add<rct_string_id>(STR_NONE);
ft.Add<rct_string_id>(STR_NONE);
}
}
break;
case PEEP_STATE_FIXING:
{
ft.add<rct_string_id>(STR_FIXING_RIDE);
ft.Add<rct_string_id>(STR_FIXING_RIDE);
auto ride = get_ride(current_ride);
if (ride != nullptr)
{
ride->FormatNameTo(ft.buf());
ride->FormatNameTo(ft.Buf());
}
else
{
ft.add<rct_string_id>(STR_NONE);
ft.Add<rct_string_id>(STR_NONE);
}
break;
}
case PEEP_STATE_HEADING_TO_INSPECTION:
{
ft.add<rct_string_id>(STR_HEADING_TO_RIDE_FOR_INSPECTION);
ft.Add<rct_string_id>(STR_HEADING_TO_RIDE_FOR_INSPECTION);
auto ride = get_ride(current_ride);
if (ride != nullptr)
{
ride->FormatNameTo(ft.buf());
ride->FormatNameTo(ft.Buf());
}
else
{
ft.add<rct_string_id>(STR_NONE);
ft.Add<rct_string_id>(STR_NONE);
}
break;
}
case PEEP_STATE_INSPECTING:
{
ft.add<rct_string_id>(STR_INSPECTING_RIDE);
ft.Add<rct_string_id>(STR_INSPECTING_RIDE);
auto ride = get_ride(current_ride);
if (ride != nullptr)
{
ride->FormatNameTo(ft.buf());
ride->FormatNameTo(ft.Buf());
}
else
{
ft.add<rct_string_id>(STR_NONE);
ft.Add<rct_string_id>(STR_NONE);
}
break;
}
@@ -1978,23 +1978,23 @@ size_t Peep::FormatNameTo(void* argsV) const
staffNameIndex = 0;
}
ft.add<rct_string_id>(staffNames[staffNameIndex]);
ft.add<uint32_t>(id);
return ft.bytes();
ft.Add<rct_string_id>(staffNames[staffNameIndex]);
ft.Add<uint32_t>(id);
return ft.NumBytes();
}
else if (gParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
{
auto realNameStringId = get_real_name_string_id_from_id(id);
return ft.add<rct_string_id>(realNameStringId).bytes();
return ft.Add<rct_string_id>(realNameStringId).NumBytes();
}
else
{
return ft.add<rct_string_id>(STR_GUEST_X).add<uint32_t>(id).bytes();
return ft.Add<rct_string_id>(STR_GUEST_X).Add<uint32_t>(id).NumBytes();
}
}
else
{
return ft.add<rct_string_id>(STR_STRING).add<const char*>(name).bytes();
return ft.Add<rct_string_id>(STR_STRING).Add<const char*>(name).NumBytes();
}
}
+20 -20
View File
@@ -757,11 +757,11 @@ void Ride::FormatStatusTo(void* argsV) const
if (lifecycle_flags & RIDE_LIFECYCLE_CRASHED)
{
ft.add<rct_string_id>(STR_CRASHED);
ft.Add<rct_string_id>(STR_CRASHED);
}
else if (lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
{
ft.add<rct_string_id>(STR_BROKEN_DOWN);
ft.Add<rct_string_id>(STR_BROKEN_DOWN);
}
else if (status == RIDE_STATUS_CLOSED)
{
@@ -769,26 +769,26 @@ void Ride::FormatStatusTo(void* argsV) const
{
if (num_riders != 0)
{
ft.add<rct_string_id>(num_riders == 1 ? STR_CLOSED_WITH_PERSON : STR_CLOSED_WITH_PEOPLE);
ft.add<uint16_t>(num_riders);
ft.Add<rct_string_id>(num_riders == 1 ? STR_CLOSED_WITH_PERSON : STR_CLOSED_WITH_PEOPLE);
ft.Add<uint16_t>(num_riders);
}
else
{
ft.add<rct_string_id>(STR_CLOSED);
ft.Add<rct_string_id>(STR_CLOSED);
}
}
else
{
ft.add<rct_string_id>(STR_CLOSED);
ft.Add<rct_string_id>(STR_CLOSED);
}
}
else if (status == RIDE_STATUS_SIMULATING)
{
ft.add<rct_string_id>(STR_SIMULATING);
ft.Add<rct_string_id>(STR_SIMULATING);
}
else if (status == RIDE_STATUS_TESTING)
{
ft.add<rct_string_id>(STR_TEST_RUN);
ft.Add<rct_string_id>(STR_TEST_RUN);
}
else if (
mode == RIDE_MODE_RACE && !(lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING)
@@ -798,23 +798,23 @@ void Ride::FormatStatusTo(void* argsV) const
if (sprite != nullptr && sprite->IsPeep())
{
auto peep = sprite->AsPeep();
ft.add<rct_string_id>(STR_RACE_WON_BY);
peep->FormatNameTo(ft.buf());
ft.Add<rct_string_id>(STR_RACE_WON_BY);
peep->FormatNameTo(ft.Buf());
}
else
{
ft.add<rct_string_id>(STR_RACE_WON_BY);
ft.add<rct_string_id>(STR_NONE);
ft.Add<rct_string_id>(STR_RACE_WON_BY);
ft.Add<rct_string_id>(STR_NONE);
}
}
else if (!ride_type_has_flag(type, RIDE_TYPE_FLAG_IS_SHOP))
{
ft.add<rct_string_id>(num_riders == 1 ? STR_PERSON_ON_RIDE : STR_PEOPLE_ON_RIDE);
ft.add<uint16_t>(num_riders);
ft.Add<rct_string_id>(num_riders == 1 ? STR_PERSON_ON_RIDE : STR_PEOPLE_ON_RIDE);
ft.Add<uint16_t>(num_riders);
}
else
{
ft.add<rct_string_id>(STR_OPEN);
ft.Add<rct_string_id>(STR_OPEN);
}
}
@@ -7788,9 +7788,9 @@ size_t Ride::FormatNameTo(void* argsV) const
if (!custom_name.empty())
{
auto str = custom_name.c_str();
ft.add<rct_string_id>(STR_STRING);
ft.add<void*>(str);
return ft.bytes();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<void*>(str);
return ft.NumBytes();
}
else
{
@@ -7815,7 +7815,7 @@ 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.bytes();
ft.Add<rct_string_id>(1).Add<rct_string_id>(rideTypeName).Add<uint16_t>(default_name_number);
return ft.NumBytes();
}
}
+7 -7
View File
@@ -70,10 +70,10 @@ size_t Banner::FormatTextTo(void* argsV, bool addColour) const
if (addColour)
{
ft.add<rct_string_id>(STR_STRING_STRINGID).add<const char*>(colourToUtf8(text_colour));
ft.Add<rct_string_id>(STR_STRING_STRINGID).Add<const char*>(colourToUtf8(text_colour));
}
return ft.bytes() + FormatTextTo(ft.buf());
return ft.NumBytes() + FormatTextTo(ft.Buf());
}
size_t Banner::FormatTextTo(void* argsV) const
@@ -82,27 +82,27 @@ size_t Banner::FormatTextTo(void* argsV) const
if (flags & BANNER_FLAG_NO_ENTRY)
{
return ft.add<rct_string_id>(STR_NO_ENTRY).bytes();
return ft.Add<rct_string_id>(STR_NO_ENTRY).NumBytes();
}
else if (flags & BANNER_FLAG_LINKED_TO_RIDE)
{
auto ride = get_ride(ride_index);
if (ride != nullptr)
{
return ride->FormatNameTo(ft.buf());
return ride->FormatNameTo(ft.Buf());
}
else
{
return ft.add<rct_string_id>(STR_DEFAULT_SIGN).bytes();
return ft.Add<rct_string_id>(STR_DEFAULT_SIGN).NumBytes();
}
}
else if (text.empty())
{
return ft.add<rct_string_id>(STR_DEFAULT_SIGN).bytes();
return ft.Add<rct_string_id>(STR_DEFAULT_SIGN).NumBytes();
}
else
{
return ft.add<rct_string_id>(STR_STRING).add<const char*>(text.c_str()).bytes();
return ft.Add<rct_string_id>(STR_STRING).Add<const char*>(text.c_str()).NumBytes();
}
}