Skip to content

Commit

Permalink
Merge pull request #7056 from Robyt3/Base-Number-Format-Optimization
Browse files Browse the repository at this point in the history
Add `str_from_int` function
  • Loading branch information
heinrich5991 committed Aug 25, 2023
2 parents 1f13a69 + d2c9750 commit b739c18
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 62 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ if(CMAKE_VERSION VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_VERSION})
endif()

set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE INTERNAL "Minimum macOS deployment version")
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.13)
message(WARNING "Building for macOS < 10.13 is not supported")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15 CACHE INTERNAL "Minimum macOS deployment version")
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.15)
message(WARNING "Building for macOS < 10.15 is not supported")
endif()

file(STRINGS src/game/version.h VERSION_LINE
Expand Down
8 changes: 8 additions & 0 deletions src/base/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#include <atomic>
#include <cctype>
#include <charconv>
#include <cmath>
#include <cstdarg>
#include <cstdio>
Expand Down Expand Up @@ -3640,6 +3641,13 @@ float str_tofloat(const char *str)
return strtod(str, nullptr);
}

void str_from_int(int value, char *buffer, size_t buffer_size)
{
buffer[0] = '\0'; // Fix false positive clang-analyzer-core.UndefinedBinaryOperatorResult when using result
auto result = std::to_chars(buffer, buffer + buffer_size - 1, value);
result.ptr[0] = '\0';
}

int str_utf8_comp_nocase(const char *a, const char *b)
{
int code_a;
Expand Down
8 changes: 8 additions & 0 deletions src/base/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,14 @@ unsigned long str_toulong_base(const char *str, int base);
int64_t str_toint64_base(const char *str, int base = 10);
float str_tofloat(const char *str);

void str_from_int(int value, char *buffer, size_t buffer_size);

template<size_t N>
void str_from_int(int value, char (&dst)[N])
{
str_from_int(value, dst, N);
}

/**
* Determines whether a character is whitespace.
*
Expand Down
4 changes: 2 additions & 2 deletions src/engine/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1949,7 +1949,7 @@ void CServer::CacheServerInfo(CCache *pCache, int Type, bool SendClients)
#define ADD_INT(p, x) \
do \
{ \
str_format(aBuf, sizeof(aBuf), "%d", x); \
str_from_int(x, aBuf); \
(p).AddString(aBuf, 0); \
} while(0)

Expand Down Expand Up @@ -2210,7 +2210,7 @@ void CServer::SendServerInfo(const NETADDR *pAddr, int Token, int Type, bool Sen
#define ADD_INT(p, x) \
do \
{ \
str_format(aBuf, sizeof(aBuf), "%d", x); \
str_from_int(x, aBuf); \
(p).AddString(aBuf, 0); \
} while(0)

Expand Down
4 changes: 2 additions & 2 deletions src/engine/server/upnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void CUPnP::Open(NETADDR Address)
{
m_Enabled = true;
dbg_msg("upnp", "found valid IGD: %s", m_pUPnPUrls->controlURL);
str_format(aPort, sizeof(aPort), "%d", m_Addr.port);
str_from_int(m_Addr.port, aPort);
Error = UPNP_AddPortMapping(m_pUPnPUrls->controlURL, m_pUPnPData->first.servicetype,
aPort, aPort, aLanAddr,
"DDNet Server " GAME_RELEASE_VERSION,
Expand All @@ -55,7 +55,7 @@ void CUPnP::Shutdown()
if(m_Enabled)
{
char aPort[6];
str_format(aPort, sizeof(aPort), "%d", m_Addr.port);
str_from_int(m_Addr.port, aPort);
int Error = UPNP_DeletePortMapping(m_pUPnPUrls->controlURL, m_pUPnPData->first.servicetype, aPort, "UDP", NULL);

if(Error != 0)
Expand Down
2 changes: 1 addition & 1 deletion src/engine/shared/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ void CConsole::ConUserCommandStatus(IResult *pResult, void *pUser)
CResult Result;
Result.m_pCommand = "access_status";
char aBuf[4];
str_format(aBuf, sizeof(aBuf), "%d", IConsole::ACCESS_LEVEL_USER);
str_from_int((int)IConsole::ACCESS_LEVEL_USER, aBuf);
Result.AddArgument(aBuf);

pConsole->ConCommandStatus(&Result, pConsole);
Expand Down
2 changes: 1 addition & 1 deletion src/engine/shared/jsonwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void CJsonWriter::WriteIntValue(int Value)
dbg_assert(CanWriteDatatype(), "Cannot write value here");
WriteIndent(false);
char aBuf[32];
str_format(aBuf, sizeof(aBuf), "%d", Value);
str_from_int(Value, aBuf);
WriteInternal(aBuf);
CompleteDataType();
}
Expand Down
8 changes: 4 additions & 4 deletions src/game/client/components/debughud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ void CDebugHud::RenderNetCorrections()
str_format(aBuf, sizeof(aBuf), "%.2f", Ramp);
RenderRow("Ramp:", aBuf);

str_format(aBuf, sizeof(aBuf), "%d", pCharacter == nullptr ? -1 : pCharacter->m_TeleCheckpoint);
str_from_int(pCharacter == nullptr ? -1 : pCharacter->m_TeleCheckpoint, aBuf);
RenderRow("Checkpoint:", aBuf);

str_format(aBuf, sizeof(aBuf), "%d", pCharacter == nullptr ? -1 : pCharacter->m_TuneZone);
str_from_int(pCharacter == nullptr ? -1 : pCharacter->m_TuneZone, aBuf);
RenderRow("Tune zone:", aBuf);

str_format(aBuf, sizeof(aBuf), "%.2f", m_pClient->m_Snap.m_pLocalCharacter->m_X / 32.0f);
Expand All @@ -64,10 +64,10 @@ void CDebugHud::RenderNetCorrections()
str_format(aBuf, sizeof(aBuf), "%.2f", m_pClient->m_Snap.m_pLocalCharacter->m_Y / 32.0f);
RenderRow("Pos.y:", aBuf);

str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_Snap.m_pLocalCharacter->m_Angle);
str_from_int(m_pClient->m_Snap.m_pLocalCharacter->m_Angle, aBuf);
RenderRow("Angle:", aBuf);

str_format(aBuf, sizeof(aBuf), "%d", m_pClient->NetobjNumCorrections());
str_from_int(m_pClient->NetobjNumCorrections(), aBuf);
RenderRow("Netobj corrections", aBuf);
RenderRow(" on:", m_pClient->NetobjCorrectedOn());
}
Expand Down
12 changes: 6 additions & 6 deletions src/game/client/components/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ void CHud::RenderScoreHud()
if(GameFlags & GAMEFLAG_TEAMS && m_pClient->m_Snap.m_pGameDataObj)
{
char aScoreTeam[2][16];
str_format(aScoreTeam[TEAM_RED], sizeof(aScoreTeam), "%d", m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreRed);
str_format(aScoreTeam[TEAM_BLUE], sizeof(aScoreTeam), "%d", m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreBlue);
str_from_int(m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreRed, aScoreTeam[TEAM_RED]);
str_from_int(m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreBlue, aScoreTeam[TEAM_BLUE]);

bool aRecreateTeamScore[2] = {str_comp(aScoreTeam[0], m_aScoreInfo[0].m_aScoreText) != 0, str_comp(aScoreTeam[1], m_aScoreInfo[1].m_aScoreText) != 0};

Expand Down Expand Up @@ -324,7 +324,7 @@ void CHud::RenderScoreHud()
aScore[t][0] = 0;
}
else
str_format(aScore[t], sizeof(aScore) / 2, "%d", apPlayerInfo[t]->m_Score);
str_from_int(apPlayerInfo[t]->m_Score, aScore[t]);
}
else
aScore[t][0] = 0;
Expand Down Expand Up @@ -484,7 +484,7 @@ void CHud::RenderWarmupTimer()
if(Seconds < 5)
str_format(aBuf, sizeof(aBuf), "%d.%d", Seconds, (m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer * 10 / SERVER_TICK_SPEED) % 10);
else
str_format(aBuf, sizeof(aBuf), "%d", Seconds);
str_from_int(Seconds, aBuf);
w = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(150 * Graphics()->ScreenAspect() + -w / 2, 75, FontSize, aBuf, -1.0f);
}
Expand All @@ -498,7 +498,7 @@ void CHud::RenderTextInfo()
m_FrameTimeAvg = m_FrameTimeAvg * 0.9f + Client()->RenderFrameTime() * 0.1f;
char aBuf[64];
int FrameTime = (int)(1.0f / m_FrameTimeAvg + 0.5f);
str_format(aBuf, sizeof(aBuf), "%d", FrameTime);
str_from_int(FrameTime, aBuf);

static float s_TextWidth0 = TextRender()->TextWidth(12.f, "0", -1, -1.0f);
static float s_TextWidth00 = TextRender()->TextWidth(12.f, "00", -1, -1.0f);
Expand Down Expand Up @@ -527,7 +527,7 @@ void CHud::RenderTextInfo()
if(g_Config.m_ClShowpred)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%d", Client()->GetPredictionTime());
str_from_int(Client()->GetPredictionTime(), aBuf);
TextRender()->Text(m_Width - 10 - TextRender()->TextWidth(12, aBuf, -1, -1.0f), g_Config.m_ClShowfps ? 20 : 5, 12, aBuf, -1.0f);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/client/components/mapimages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ void CMapImages::UpdateEntityLayerText(void *pTexBuffer, int ImageColorChannelCo
if(MaxNumber == -1)
MaxNumber = CurrentNumber * 10 - 1;

str_format(aBuf, sizeof(aBuf), "%d", CurrentNumber);
str_from_int(CurrentNumber, aBuf);

int CurrentNumberSuitableFontSize = TextRender()->AdjustFontSize(aBuf, DigitsCount, TextureSize, MaxWidth);
int UniversalSuitableFontSize = CurrentNumberSuitableFontSize * 0.92f; // should be smoothed enough to fit any digits combination
Expand All @@ -460,7 +460,7 @@ void CMapImages::UpdateEntityLayerText(void *pTexBuffer, int ImageColorChannelCo

for(; CurrentNumber <= MaxNumber; ++CurrentNumber)
{
str_format(aBuf, sizeof(aBuf), "%d", CurrentNumber);
str_from_int(CurrentNumber, aBuf);

float x = (CurrentNumber % 16) * 64;
float y = (CurrentNumber / 16) * 64;
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ int CMenus::DoButton_CheckBox(const void *pID, const char *pText, int Checked, c
int CMenus::DoButton_CheckBox_Number(const void *pID, const char *pText, int Checked, const CUIRect *pRect)
{
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Checked);
str_from_int(Checked, aBuf);
return DoButton_CheckBox_Common(pID, pText, aBuf, pRect);
}

Expand Down
6 changes: 3 additions & 3 deletions src/game/client/components/menus_browser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void FormatServerbrowserPing(char *pBuffer, int BufferLength, const CServerInfo
{
if(!pInfo->m_LatencyIsEstimated)
{
str_format(pBuffer, BufferLength, "%d", pInfo->m_Latency);
str_from_int(pInfo->m_Latency, pBuffer, BufferLength);
return;
}
static const char *LOCATION_NAMES[CServerInfo::NUM_LOCS] = {
Expand Down Expand Up @@ -345,7 +345,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
if(FriendsOnServer > 1)
{
char aBufFriendsOnServer[64];
str_format(aBufFriendsOnServer, sizeof(aBufFriendsOnServer), "%i", FriendsOnServer);
str_from_int(FriendsOnServer, aBufFriendsOnServer);
TextRender()->TextColor(0.94f, 0.8f, 0.8f, 1);
UI()->DoLabel(&IconText, aBufFriendsOnServer, 10.0f, TEXTALIGN_MC);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1);
Expand Down Expand Up @@ -1192,7 +1192,7 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
}
else if(ClientScoreKind == CServerInfo::CLIENT_SCORE_KIND_POINTS)
{
str_format(aTemp, sizeof(aTemp), "%d", CurrentClient.m_Score);
str_from_int(CurrentClient.m_Score, aTemp);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions src/game/client/components/menus_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,13 +984,13 @@ void CMenus::RenderDemoList(CUIRect MainView)
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabel(&Left, Localize("Version:"), 14.0f, TEXTALIGN_ML);
str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].m_Info.m_Version);
str_from_int(m_vDemos[m_DemolistSelectedIndex].m_Info.m_Version, aBuf);
UI()->DoLabel(&Right, aBuf, 14.0f, TEXTALIGN_ML);
Labels.HSplitTop(5.0f, 0, &Labels);
Labels.HSplitTop(20.0f, &Left, &Labels);
Left.VSplitLeft(150.0f, &Left, &Right);
UI()->DoLabel(&Left, Localize("Markers:"), 14.0f, TEXTALIGN_ML);
str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].NumMarkers());
str_from_int(m_vDemos[m_DemolistSelectedIndex].NumMarkers(), aBuf);
UI()->DoLabel(&Right, aBuf, 14.0f, TEXTALIGN_ML);

// right side
Expand Down Expand Up @@ -1181,7 +1181,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
else if(ID == COL_MARKERS && !Item.m_IsDir && Item.m_InfosLoaded && Item.m_Valid)
{
char aBuf[3];
str_format(aBuf, sizeof(aBuf), "%d", Item.NumMarkers());
str_from_int(Item.NumMarkers(), aBuf);
Button.VMargin(4.0f, &Button);
UI()->DoLabel(&Button, aBuf, 12.0f, TEXTALIGN_MR);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ void CMenus::DoJoystickAxisPicker(CUIRect View)

// Axis label
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", i + 1);
str_from_int(i + 1, aBuf);
if(Active)
TextRender()->TextColor(TextRender()->DefaultTextColor());
else
Expand Down
4 changes: 2 additions & 2 deletions src/game/client/components/nameplates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
{
YOffset -= FontSize;
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%d", pPlayerInfo->m_ClientID);
str_from_int(pPlayerInfo->m_ClientID, aBuf);
float XOffset = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f) / 2.0f;
TextRender()->TextColor(rgb);
TextRender()->Text(Position.x - XOffset, YOffset, FontSize, aBuf, -1.0f);
Expand Down Expand Up @@ -266,7 +266,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
{
YOffset -= FontSize;
char aBuf[12];
str_format(aBuf, sizeof(aBuf), "%d", pCharacter->GetStrongWeakID());
str_from_int(pCharacter->GetStrongWeakID(), aBuf);
float XOffset = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f) / 2.0f;
TextRender()->Text(Position.x - XOffset, YOffset, FontSize, aBuf, -1.0f);
}
Expand Down
12 changes: 6 additions & 6 deletions src/game/client/components/scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
if(m_pClient->m_Snap.m_pGameDataObj)
{
int Score = Team == TEAM_RED ? m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreRed : m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreBlue;
str_format(aBuf, sizeof(aBuf), "%d", Score);
str_from_int(Score, aBuf);
}
}
else
Expand All @@ -211,12 +211,12 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
m_pClient->m_Snap.m_apPlayerInfos[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID])
{
int Score = m_pClient->m_Snap.m_apPlayerInfos[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID]->m_Score;
str_format(aBuf, sizeof(aBuf), "%d", Score);
str_from_int(Score, aBuf);
}
else if(m_pClient->m_Snap.m_pLocalInfo)
{
int Score = m_pClient->m_Snap.m_pLocalInfo->m_Score;
str_format(aBuf, sizeof(aBuf), "%d", Score);
str_from_int(Score, aBuf);
}
}

Expand Down Expand Up @@ -370,7 +370,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
if(DDTeam == TEAM_SUPER)
str_copy(aBuf, Localize("Super"));
else
str_format(aBuf, sizeof(aBuf), "%d", DDTeam);
str_from_int(DDTeam, aBuf);
TextRender()->SetCursor(&Cursor, x - 10.0f, y + Spacing + FontSize - (FontSize / 1.5f), FontSize / 1.5f, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = NameLength + 3;
}
Expand Down Expand Up @@ -405,7 +405,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
str_time((int64_t)absolute(pInfo->m_Score) * 100, TIME_HOURS, aBuf, sizeof(aBuf));
}
else
str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Score, -999, 99999));
str_from_int(clamp(pInfo->m_Score, -999, 99999), aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->SetCursor(&Cursor, ScoreOffset + ScoreLength - tw, y + (LineHeight - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER);
TextRender()->TextEx(&Cursor, aBuf, -1);
Expand Down Expand Up @@ -494,7 +494,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
ColorRGBA rgb = color_cast<ColorRGBA>(ColorHSLA((300.0f - clamp(pInfo->m_Latency, 0, 300)) / 1000.0f, 1.0f, 0.5f));
TextRender()->TextColor(rgb);
}
str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Latency, 0, 999));
str_from_int(clamp(pInfo->m_Latency, 0, 999), aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->SetCursor(&Cursor, PingOffset + PingLength - tw, y + (LineHeight - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER | TEXTFLAG_STOP_AT_END);
Cursor.m_LineWidth = PingLength;
Expand Down
14 changes: 7 additions & 7 deletions src/game/client/components/statboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,22 +293,22 @@ void CStatboard::RenderGlobalStats()

// FRAGS
{
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Frags);
str_from_int(pStats->m_Frags, aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(x - tw + px, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85;
}
// DEATHS
{
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Deaths);
str_from_int(pStats->m_Deaths, aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(x - tw + px, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85;
}
// SUICIDES
{
px += 10;
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Suicides);
str_from_int(pStats->m_Suicides, aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(x - tw + px, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85;
Expand Down Expand Up @@ -340,22 +340,22 @@ void CStatboard::RenderGlobalStats()
}
// SPREE
{
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_CurrentSpree);
str_from_int(pStats->m_CurrentSpree, aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(x - tw + px, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85;
}
// BEST SPREE
{
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_BestSpree);
str_from_int(pStats->m_BestSpree, aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(x - tw + px, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85;
}
// GRABS
if(GameWithFlags)
{
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagGrabs);
str_from_int(pStats->m_FlagGrabs, aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(x - tw + px, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85;
Expand All @@ -375,7 +375,7 @@ void CStatboard::RenderGlobalStats()
// FLAGS
if(GameWithFlags)
{
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagCaptures);
str_from_int(pStats->m_FlagCaptures, aBuf);
tw = TextRender()->TextWidth(FontSize, aBuf, -1, -1.0f);
TextRender()->Text(x - tw + px, y + (LineHeight * 0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
}
Expand Down

0 comments on commit b739c18

Please sign in to comment.