mirror of https://github.com/OpenRCT2/OpenRCT2.git
parent
32c342e88d
commit
6e47385b90
|
@ -584,7 +584,8 @@ static void window_guest_common_invalidate(rct_window* w)
|
|||
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
|
||||
|
||||
auto peep = GET_PEEP(w->number);
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
|
||||
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
|
@ -1085,7 +1086,9 @@ void window_guest_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
// Draw the centred label
|
||||
Peep* peep = GET_PEEP(w->number);
|
||||
peep->FormatActionTo(gCommonFormatArgs);
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatActionTo(ft);
|
||||
rct_widget* widget = &w->widgets[WIDX_ACTION_LBL];
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top - 1 };
|
||||
int32_t width = widget->right - widget->left;
|
||||
|
|
|
@ -767,7 +767,8 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
|
||||
// Guest name
|
||||
auto peep = GET_PEEP(spriteIndex);
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 0, y }, 113);
|
||||
|
||||
switch (_window_guest_list_selected_view)
|
||||
|
@ -781,7 +782,8 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
gfx_draw_sprite(dpi, STR_ENTER_SELECTION_SIZE, 112, y + 1, 0);
|
||||
|
||||
// Action
|
||||
peep->FormatActionTo(gCommonFormatArgs);
|
||||
ft = Formatter::Common();
|
||||
peep->FormatActionTo(ft);
|
||||
gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 133, y }, 314);
|
||||
break;
|
||||
case VIEW_THOUGHTS:
|
||||
|
@ -900,10 +902,11 @@ static int32_t window_guest_list_is_peep_in_filter(Peep* peep)
|
|||
static FilterArguments get_arguments_from_peep(const Peep* peep)
|
||||
{
|
||||
FilterArguments result;
|
||||
Formatter ft(result.args);
|
||||
switch (_window_guest_list_selected_view)
|
||||
{
|
||||
case VIEW_ACTIONS:
|
||||
peep->FormatActionTo(result.args);
|
||||
peep->FormatActionTo(ft);
|
||||
break;
|
||||
case VIEW_THOUGHTS:
|
||||
{
|
||||
|
@ -1050,7 +1053,9 @@ static bool guest_should_be_visible(Peep* peep)
|
|||
{
|
||||
char name[256]{};
|
||||
uint8_t args[32]{};
|
||||
peep->FormatNameTo(args);
|
||||
|
||||
Formatter ft(args);
|
||||
peep->FormatNameTo(ft);
|
||||
format_string(name, sizeof(name), STR_STRINGID, args);
|
||||
if (strcasestr(name, _window_guest_list_filter_name) == nullptr)
|
||||
{
|
||||
|
|
|
@ -4406,7 +4406,8 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto peep = GetEntity<Peep>(ride->mechanic)->AsStaff();
|
||||
if (peep != nullptr && peep->IsMechanic())
|
||||
{
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
gfx_draw_string_left_wrapped(
|
||||
dpi, gCommonFormatArgs, screenCoords + ScreenCoordsXY{ 4, 0 }, 280, stringId, COLOUR_BLACK);
|
||||
}
|
||||
|
|
|
@ -776,7 +776,8 @@ void window_staff_stats_invalidate(rct_window* w)
|
|||
|
||||
Peep* peep = GET_PEEP(w->number);
|
||||
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
|
||||
window_staff_stats_widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
window_staff_stats_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
|
@ -809,8 +810,8 @@ void window_staff_options_invalidate(rct_window* w)
|
|||
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
|
||||
|
||||
Peep* peep = GET_PEEP(w->number);
|
||||
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
|
||||
switch (peep->StaffType)
|
||||
{
|
||||
|
@ -885,8 +886,8 @@ void window_staff_overview_invalidate(rct_window* w)
|
|||
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
|
||||
|
||||
Peep* peep = GET_PEEP(w->number);
|
||||
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
|
||||
window_staff_overview_widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
window_staff_overview_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
|
@ -948,7 +949,8 @@ void window_staff_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
// Draw the centred label
|
||||
Peep* peep = GET_PEEP(w->number);
|
||||
peep->FormatActionTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatActionTo(ft);
|
||||
rct_widget* widget = &w->widgets[WIDX_BTM_LABEL];
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top };
|
||||
int32_t width = widget->right - widget->left;
|
||||
|
|
|
@ -125,8 +125,8 @@ static void window_staff_fire_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
window_draw_widgets(w, dpi);
|
||||
|
||||
Peep* peep = GetEntity<Peep>(w->number);
|
||||
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
|
||||
ScreenCoordsXY stringCoords(w->windowPos.x + WW / 2,w->windowPos.y + (WH / 2) - 3);
|
||||
gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, stringCoords, WW - 4, STR_FIRE_STAFF_ID, COLOUR_BLACK);
|
||||
|
|
|
@ -697,10 +697,12 @@ void window_staff_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_
|
|||
format = (_quick_fire_mode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID);
|
||||
}
|
||||
|
||||
peep->FormatNameTo(gCommonFormatArgs);
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 0, y }, nameColumnSize);
|
||||
|
||||
peep->FormatActionTo(gCommonFormatArgs);
|
||||
ft = Formatter::Common();
|
||||
peep->FormatActionTo(ft);
|
||||
gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { actionOffset, y }, actionColumnSize);
|
||||
|
||||
// True if a patrol path is set for the worker
|
||||
|
|
|
@ -627,7 +627,8 @@ static void window_title_command_editor_tool_down(
|
|||
if (peep != nullptr)
|
||||
{
|
||||
uint8_t formatArgs[32]{};
|
||||
peep->FormatNameTo(formatArgs);
|
||||
Formatter ft(formatArgs);
|
||||
peep->FormatNameTo(ft);
|
||||
format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, &peep->Id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -538,7 +538,8 @@ int32_t Guest::GetEasterEggNameId() const
|
|||
uint8_t args[32]{};
|
||||
char buffer[256]{};
|
||||
|
||||
FormatNameTo(args);
|
||||
Formatter ft(args);
|
||||
FormatNameTo(ft);
|
||||
format_string(buffer, sizeof(buffer), STR_STRINGID, args);
|
||||
|
||||
for (uint32_t i = 0; i < std::size(gPeepEasterEggNames); i++)
|
||||
|
@ -685,7 +686,8 @@ int32_t Guest::CheckEasterEggName(int32_t index) const
|
|||
uint8_t args[32]{};
|
||||
char buffer[256]{};
|
||||
|
||||
FormatNameTo(args);
|
||||
Formatter ft(args);
|
||||
FormatNameTo(ft);
|
||||
format_string(buffer, sizeof(buffer), STR_STRINGID, args);
|
||||
|
||||
return _stricmp(buffer, gPeepEasterEggNames[index]) == 0;
|
||||
|
@ -3881,8 +3883,9 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride* ride)
|
|||
|
||||
if (PeepFlags & PEEP_FLAGS_TRACKING)
|
||||
{
|
||||
auto nameArgLen = FormatNameTo(gCommonFormatArgs);
|
||||
ride->FormatNameTo(gCommonFormatArgs + nameArgLen);
|
||||
auto ft = Formatter::Common();
|
||||
FormatNameTo(ft);
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
rct_string_id msg_string;
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE))
|
||||
|
@ -4987,8 +4990,9 @@ void Guest::UpdateRideLeaveExit()
|
|||
|
||||
if (ride != nullptr && (PeepFlags & PEEP_FLAGS_TRACKING))
|
||||
{
|
||||
auto nameArgLen = FormatNameTo(gCommonFormatArgs);
|
||||
ride->FormatNameTo(gCommonFormatArgs + nameArgLen);
|
||||
auto ft = Formatter::Common();
|
||||
FormatNameTo(ft);
|
||||
ride->FormatNameTo(ft);
|
||||
|
||||
if (gConfigNotifications.guest_left_ride)
|
||||
{
|
||||
|
|
|
@ -1762,12 +1762,6 @@ Peep* Peep::Generate(const CoordsXYZ& coords)
|
|||
|
||||
void Peep::FormatActionTo(Formatter& ft) const
|
||||
{
|
||||
FormatActionTo(ft.Buf());
|
||||
}
|
||||
|
||||
void Peep::FormatActionTo(void* argsV) const
|
||||
{
|
||||
Formatter ft(static_cast<uint8_t*>(argsV));
|
||||
switch (State)
|
||||
{
|
||||
case PEEP_STATE_FALLING:
|
||||
|
@ -1941,12 +1935,6 @@ void Peep::FormatActionTo(void* argsV) const
|
|||
|
||||
void Peep::FormatNameTo(Formatter& ft) const
|
||||
{
|
||||
ft.Increment(FormatNameTo(ft.Buf()));
|
||||
}
|
||||
|
||||
size_t Peep::FormatNameTo(void* argsV) const
|
||||
{
|
||||
Formatter ft(static_cast<uint8_t*>(argsV));
|
||||
if (Name == nullptr)
|
||||
{
|
||||
if (AssignedPeepType == PeepType::PEEP_TYPE_STAFF)
|
||||
|
@ -1966,28 +1954,29 @@ size_t Peep::FormatNameTo(void* argsV) const
|
|||
|
||||
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).NumBytes();
|
||||
ft.Add<rct_string_id>(realNameStringId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ft.Add<rct_string_id>(STR_GUEST_X).Add<uint32_t>(Id).NumBytes();
|
||||
ft.Add<rct_string_id>(STR_GUEST_X).Add<uint32_t>(Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ft.Add<rct_string_id>(STR_STRING).Add<const char*>(Name).NumBytes();
|
||||
ft.Add<rct_string_id>(STR_STRING).Add<const char*>(Name);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Peep::GetName() const
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
FormatNameTo(args);
|
||||
|
||||
Formatter ft(args);
|
||||
FormatNameTo(ft);
|
||||
return format_string(STR_STRINGID, args);
|
||||
}
|
||||
|
||||
|
@ -3243,11 +3232,13 @@ int32_t peep_compare(const uint16_t sprite_index_a, const uint16_t sprite_index_
|
|||
uint8_t args[32]{};
|
||||
|
||||
char nameA[256]{};
|
||||
peep_a->FormatNameTo(args);
|
||||
Formatter ft(args);
|
||||
peep_a->FormatNameTo(ft);
|
||||
format_string(nameA, sizeof(nameA), STR_STRINGID, args);
|
||||
|
||||
char nameB[256]{};
|
||||
peep_b->FormatNameTo(args);
|
||||
ft = Formatter(args);
|
||||
peep_b->FormatNameTo(ft);
|
||||
format_string(nameB, sizeof(nameB), STR_STRINGID, args);
|
||||
return strlogicalcmp(nameA, nameB);
|
||||
}
|
||||
|
|
|
@ -776,9 +776,7 @@ public: // Peep
|
|||
void RemoveFromRide();
|
||||
void InsertNewThought(PeepThoughtType thought_type, uint8_t thought_arguments);
|
||||
void FormatActionTo(Formatter&) const;
|
||||
void FormatActionTo(void* args) const;
|
||||
void FormatNameTo(Formatter&) const;
|
||||
size_t FormatNameTo(void* args) const;
|
||||
std::string GetName() const;
|
||||
bool SetName(const std::string_view& value);
|
||||
|
||||
|
|
Loading…
Reference in New Issue