mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Use str_copy
instead of str_format
where possible
This commit is contained in:
parent
1cbdb9d2f0
commit
8b5da71e89
|
@ -3317,7 +3317,7 @@ bool CClient::InitNetworkClient(char *pError, size_t ErrorSize)
|
||||||
if(g_Config.m_Bindaddr[0])
|
if(g_Config.m_Bindaddr[0])
|
||||||
str_format(pError, ErrorSize, "Could not open the network client, try changing or unsetting the bindaddr '%s'.", g_Config.m_Bindaddr);
|
str_format(pError, ErrorSize, "Could not open the network client, try changing or unsetting the bindaddr '%s'.", g_Config.m_Bindaddr);
|
||||||
else
|
else
|
||||||
str_format(pError, ErrorSize, "Could not open the network client.");
|
str_copy(pError, "Could not open the network client.", ErrorSize);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,8 +490,7 @@ void CNetBan::ConBans(IConsole::IResult *pResult, void *pUser)
|
||||||
|
|
||||||
if(NumBans == 0)
|
if(NumBans == 0)
|
||||||
{
|
{
|
||||||
str_format(aMsg, sizeof(aMsg), "The ban list is empty.");
|
pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "net_ban", "The ban list is empty.");
|
||||||
pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "net_ban", aMsg);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1693,8 +1693,7 @@ void CHud::RenderRecord()
|
||||||
if(m_ServerRecord > 0.0f)
|
if(m_ServerRecord > 0.0f)
|
||||||
{
|
{
|
||||||
char aBuf[64];
|
char aBuf[64];
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("Server best:"));
|
TextRender()->Text(5, 75, 6, Localize("Server best:"), -1.0f);
|
||||||
TextRender()->Text(5, 75, 6, aBuf, -1.0f);
|
|
||||||
char aTime[32];
|
char aTime[32];
|
||||||
str_time_float(m_ServerRecord, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
|
str_time_float(m_ServerRecord, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
|
||||||
str_format(aBuf, sizeof(aBuf), "%s%s", m_ServerRecord > 3600 ? "" : " ", aTime);
|
str_format(aBuf, sizeof(aBuf), "%s%s", m_ServerRecord > 3600 ? "" : " ", aTime);
|
||||||
|
@ -1705,8 +1704,7 @@ void CHud::RenderRecord()
|
||||||
if(PlayerRecord > 0.0f)
|
if(PlayerRecord > 0.0f)
|
||||||
{
|
{
|
||||||
char aBuf[64];
|
char aBuf[64];
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("Personal best:"));
|
TextRender()->Text(5, 82, 6, Localize("Personal best:"), -1.0f);
|
||||||
TextRender()->Text(5, 82, 6, aBuf, -1.0f);
|
|
||||||
char aTime[32];
|
char aTime[32];
|
||||||
str_time_float(PlayerRecord, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
|
str_time_float(PlayerRecord, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
|
||||||
str_format(aBuf, sizeof(aBuf), "%s%s", PlayerRecord > 3600 ? "" : " ", aTime);
|
str_format(aBuf, sizeof(aBuf), "%s%s", PlayerRecord > 3600 ? "" : " ", aTime);
|
||||||
|
|
|
@ -3310,21 +3310,21 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(State >= IUpdater::GETTING_MANIFEST && State < IUpdater::NEED_RESTART)
|
else if(State >= IUpdater::GETTING_MANIFEST && State < IUpdater::NEED_RESTART)
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("Updating…"));
|
str_copy(aBuf, Localize("Updating…");
|
||||||
else if(State == IUpdater::NEED_RESTART)
|
else if(State == IUpdater::NEED_RESTART)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("DDNet Client updated!"));
|
str_copy(aBuf, Localize("DDNet Client updated!"));
|
||||||
m_NeedRestartUpdate = true;
|
m_NeedRestartUpdate = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("No updates available"));
|
str_copy(aBuf, Localize("No updates available");
|
||||||
UpdaterRect.VSplitLeft(TextRender()->TextWidth(14.0f, aBuf, -1, -1.0f) + 10.0f, &UpdaterRect, &Button);
|
UpdaterRect.VSplitLeft(TextRender()->TextWidth(14.0f, aBuf, -1, -1.0f) + 10.0f, &UpdaterRect, &Button);
|
||||||
Button.VSplitLeft(100.0f, &Button, nullptr);
|
Button.VSplitLeft(100.0f, &Button, nullptr);
|
||||||
static CButtonContainer s_ButtonUpdate;
|
static CButtonContainer s_ButtonUpdate;
|
||||||
if(DoButton_Menu(&s_ButtonUpdate, Localize("Check now"), 0, &Button))
|
if(DoButton_Menu(&s_ButtonUpdate, Localize("Check now"), 0, &Button))
|
||||||
{
|
{
|
||||||
Client()->RequestDDNetInfo();
|
Client()->RequestDDNetInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ui()->DoLabel(&UpdaterRect, aBuf, 14.0f, TEXTALIGN_ML);
|
Ui()->DoLabel(&UpdaterRect, aBuf, 14.0f, TEXTALIGN_ML);
|
||||||
|
|
|
@ -240,12 +240,12 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
||||||
}
|
}
|
||||||
else if(State == IUpdater::FAIL)
|
else if(State == IUpdater::FAIL)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("Update failed! Check log…"));
|
str_copy(aBuf, Localize("Update failed! Check log…"));
|
||||||
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
||||||
}
|
}
|
||||||
else if(State == IUpdater::NEED_RESTART)
|
else if(State == IUpdater::NEED_RESTART)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("DDNet Client updated!"));
|
str_copy(aBuf, Localize("DDNet Client updated!"));
|
||||||
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
||||||
}
|
}
|
||||||
Ui()->DoLabel(&VersionUpdate, aBuf, 14.0f, TEXTALIGN_ML);
|
Ui()->DoLabel(&VersionUpdate, aBuf, 14.0f, TEXTALIGN_ML);
|
||||||
|
|
|
@ -320,7 +320,7 @@ void CEditorActionDeleteQuad::Redo()
|
||||||
CEditorActionEditQuadPoint::CEditorActionEditQuadPoint(CEditor *pEditor, int GroupIndex, int LayerIndex, int QuadIndex, std::vector<CPoint> const &vPreviousPoints, std::vector<CPoint> const &vCurrentPoints) :
|
CEditorActionEditQuadPoint::CEditorActionEditQuadPoint(CEditor *pEditor, int GroupIndex, int LayerIndex, int QuadIndex, std::vector<CPoint> const &vPreviousPoints, std::vector<CPoint> const &vCurrentPoints) :
|
||||||
CEditorActionLayerBase(pEditor, GroupIndex, LayerIndex), m_QuadIndex(QuadIndex), m_vPreviousPoints(vPreviousPoints), m_vCurrentPoints(vCurrentPoints)
|
CEditorActionLayerBase(pEditor, GroupIndex, LayerIndex), m_QuadIndex(QuadIndex), m_vPreviousPoints(vPreviousPoints), m_vCurrentPoints(vCurrentPoints)
|
||||||
{
|
{
|
||||||
str_format(m_aDisplayText, sizeof(m_aDisplayText), "Edit quad points");
|
str_copy(m_aDisplayText, "Edit quad points");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditorActionEditQuadPoint::Undo()
|
void CEditorActionEditQuadPoint::Undo()
|
||||||
|
@ -628,7 +628,7 @@ CEditorActionGroup::CEditorActionGroup(CEditor *pEditor, int GroupIndex, bool De
|
||||||
if(m_Delete)
|
if(m_Delete)
|
||||||
str_format(m_aDisplayText, sizeof(m_aDisplayText), "Delete group %d", m_GroupIndex);
|
str_format(m_aDisplayText, sizeof(m_aDisplayText), "Delete group %d", m_GroupIndex);
|
||||||
else
|
else
|
||||||
str_format(m_aDisplayText, sizeof(m_aDisplayText), "New group");
|
str_copy(m_aDisplayText, "New group", sizeof(m_aDisplayText));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditorActionGroup::Undo()
|
void CEditorActionGroup::Undo()
|
||||||
|
@ -1198,7 +1198,7 @@ CEditorActionTileArt::CEditorActionTileArt(CEditor *pEditor, int PreviousImageCo
|
||||||
IEditorAction(pEditor), m_PreviousImageCount(PreviousImageCount), m_vImageIndexMap(vImageIndexMap)
|
IEditorAction(pEditor), m_PreviousImageCount(PreviousImageCount), m_vImageIndexMap(vImageIndexMap)
|
||||||
{
|
{
|
||||||
str_copy(m_aTileArtFile, pTileArtFile);
|
str_copy(m_aTileArtFile, pTileArtFile);
|
||||||
str_format(m_aDisplayText, sizeof(m_aDisplayText), "Tile art");
|
str_copy(m_aDisplayText, "Tile art");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditorActionTileArt::Undo()
|
void CEditorActionTileArt::Undo()
|
||||||
|
@ -1266,7 +1266,7 @@ CEditorCommandAction::CEditorCommandAction(CEditor *pEditor, EType Type, int *pS
|
||||||
switch(m_Type)
|
switch(m_Type)
|
||||||
{
|
{
|
||||||
case EType::ADD:
|
case EType::ADD:
|
||||||
str_format(m_aDisplayText, sizeof(m_aDisplayText), "Add command");
|
str_copy(m_aDisplayText, "Add command");
|
||||||
break;
|
break;
|
||||||
case EType::EDIT:
|
case EType::EDIT:
|
||||||
str_format(m_aDisplayText, sizeof(m_aDisplayText), "Edit command %d", m_CommandIndex);
|
str_format(m_aDisplayText, sizeof(m_aDisplayText), "Edit command %d", m_CommandIndex);
|
||||||
|
|
Loading…
Reference in a new issue