mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Remove gCommonStringFormatBuffer, CommonTextBufferSize
This commit is contained in:
@@ -715,8 +715,9 @@ void CustomListView::PaintSeperator(
|
||||
DrawTextBasic(dpi, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::CENTRE });
|
||||
|
||||
// Get string dimensions
|
||||
FormatStringLegacy(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_STRING, ft.Data());
|
||||
int32_t categoryStringHalfWidth = (GfxGetStringWidth(gCommonStringFormatBuffer, FontStyle::Medium) / 2) + 4;
|
||||
utf8 stringBuffer[512]{};
|
||||
FormatStringLegacy(stringBuffer, sizeof(stringBuffer), STR_STRING, ft.Data());
|
||||
int32_t categoryStringHalfWidth = (GfxGetStringWidth(stringBuffer, FontStyle::Medium) / 2) + 4;
|
||||
int32_t strLeft = centreX - categoryStringHalfWidth;
|
||||
int32_t strRight = centreX + categoryStringHalfWidth;
|
||||
|
||||
|
||||
@@ -760,7 +760,8 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
||||
|
||||
screenCoords.x = gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15;
|
||||
|
||||
auto bufferWithColour = strcpy(gCommonStringFormatBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}");
|
||||
utf8 itemBuffer[512]{};
|
||||
auto bufferWithColour = strcpy(itemBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}");
|
||||
auto buffer = strchr(bufferWithColour, '\0');
|
||||
|
||||
colour_t colour = COLOUR_BLACK;
|
||||
@@ -780,7 +781,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
||||
StringId rideTypeStringId = GetRideTypeStringId(listItem.repositoryItem);
|
||||
SafeStrCpy(buffer, LanguageGetString(rideTypeStringId), 256 - (buffer - bufferWithColour));
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
ft.Add<const char*>(itemBuffer);
|
||||
DrawTextEllipsised(
|
||||
dpi, screenCoords, width_limit - 15, STR_STRING, ft, { colour, FontStyle::Medium, darkness });
|
||||
screenCoords.x = widgets[WIDX_LIST_SORT_RIDE].left - widgets[WIDX_LIST].left;
|
||||
@@ -796,7 +797,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
||||
*buffer = 0;
|
||||
}
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
ft.Add<const char*>(itemBuffer);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness });
|
||||
}
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
|
||||
@@ -500,7 +500,7 @@ static Widget _scenarioSelectWidgets[] = {
|
||||
DrawTextBasic(dpi, { centreX, y }, stringId, {}, { baseColour, TextAlignment::CENTRE });
|
||||
|
||||
// Get string dimensions
|
||||
utf8 buffer[CommonTextBufferSize];
|
||||
utf8 buffer[512];
|
||||
auto bufferPtr = buffer;
|
||||
OpenRCT2::FormatStringLegacy(bufferPtr, sizeof(buffer), stringId, nullptr);
|
||||
int32_t categoryStringHalfWidth = (GfxGetStringWidth(bufferPtr, FontStyle::Medium) / 2) + 4;
|
||||
|
||||
@@ -261,7 +261,7 @@ int32_t GfxWrapString(u8string_view text, int32_t width, FontStyle fontStyle, u8
|
||||
void GfxDrawStringLeftCentred(
|
||||
DrawPixelInfo& dpi, StringId format, void* args, ColourWithFlags colour, const ScreenCoordsXY& coords)
|
||||
{
|
||||
char buffer[CommonTextBufferSize];
|
||||
char buffer[512];
|
||||
auto bufferPtr = buffer;
|
||||
FormatStringLegacy(bufferPtr, sizeof(buffer), format, args);
|
||||
int32_t height = StringGetHeightRaw(bufferPtr, FontStyle::Medium);
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
thread_local char gCommonStringFormatBuffer[CommonTextBufferSize];
|
||||
|
||||
std::string FormatStringIDLegacy(StringId format, const void* args)
|
||||
{
|
||||
std::string buffer(256, 0);
|
||||
|
||||
@@ -17,7 +17,3 @@ std::string FormatStringIDLegacy(StringId format, const void* args);
|
||||
void FormatStringToUpper(char* dest, size_t size, StringId format, const void* args);
|
||||
|
||||
constexpr size_t kUserStringMaxLength = 32;
|
||||
|
||||
constexpr size_t CommonTextBufferSize = 512;
|
||||
|
||||
extern thread_local char gCommonStringFormatBuffer[CommonTextBufferSize];
|
||||
|
||||
@@ -162,17 +162,18 @@ static void PathPaintQueueBanner(
|
||||
{
|
||||
ft.Add<StringId>(STR_RIDE_ENTRANCE_CLOSED);
|
||||
}
|
||||
|
||||
utf8 bannerBuffer[512]{};
|
||||
if (Config::Get().general.UpperCaseBanners)
|
||||
{
|
||||
FormatStringToUpper(
|
||||
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
FormatStringToUpper(bannerBuffer, sizeof(bannerBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
}
|
||||
else
|
||||
{
|
||||
FormatStringLegacy(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
FormatStringLegacy(bannerBuffer, sizeof(bannerBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
}
|
||||
|
||||
uint16_t stringWidth = GfxGetStringWidth(gCommonStringFormatBuffer, FontStyle::Tiny);
|
||||
uint16_t stringWidth = GfxGetStringWidth(bannerBuffer, FontStyle::Tiny);
|
||||
uint16_t scroll = stringWidth > 0 ? (GetGameState().CurrentTicks / 2) % stringWidth : 0;
|
||||
|
||||
PaintAddImageAsChild(
|
||||
|
||||
Reference in New Issue
Block a user