Remove UTIL_Format() and UTIL_VarArgs()

This commit is contained in:
Arkshine
2015-10-01 11:06:04 +02:00
parent f22dc769f4
commit 138b9e1510
39 changed files with 112 additions and 173 deletions

View File

@@ -289,7 +289,7 @@ bool Menu::Display(int player, page_t page)
return false;
static char buffer[2048];
int len = UTIL_Format(buffer, sizeof(buffer)-1, "%s", str);
int len = ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s", str);
CPlayer *pPlayer = GET_PLAYER_POINTER_I(player);
@@ -342,14 +342,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (items_per_page && (pages != 1))
{
if (m_AutoColors)
UTIL_Format(buffer, sizeof(buffer)-1, "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages);
ke::SafeSprintf(buffer, sizeof(buffer)-1, "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages);
else
UTIL_Format(buffer, sizeof(buffer)-1, "%s %d/%d\n\n", m_Title.chars(), page + 1, pages);
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s %d/%d\n\n", m_Title.chars(), page + 1, pages);
} else {
if (m_AutoColors)
UTIL_Format(buffer, sizeof(buffer)-1, "\\y%s\n\\w\n", m_Title.chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "\\y%s\n\\w\n", m_Title.chars());
else
UTIL_Format(buffer, sizeof(buffer)-1, "%s\n\n", m_Title.chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s\n\n", m_Title.chars());
}
m_Text = m_Text + buffer;
@@ -446,22 +446,22 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
if (pItem->isBlank)
{
UTIL_Format(buffer, sizeof(buffer)-1, "%s\n", pItem->name.chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s\n", pItem->name.chars());
}
else if (enabled)
{
if (m_AutoColors)
{
UTIL_Format(buffer, sizeof(buffer)-1, "%s%d.\\w %s\n", m_ItemColor.chars(),option_display, pItem->name.chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%s%d.\\w %s\n", m_ItemColor.chars(),option_display, pItem->name.chars());
} else {
UTIL_Format(buffer, sizeof(buffer)-1, "%d. %s\n", option_display, pItem->name.chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "%d. %s\n", option_display, pItem->name.chars());
}
} else {
if (m_AutoColors)
{
UTIL_Format(buffer, sizeof(buffer)-1, "\\d%d. %s\n\\w", option_display, pItem->name.chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "\\d%d. %s\n\\w", option_display, pItem->name.chars());
} else {
UTIL_Format(buffer, sizeof(buffer)-1, "#. %s\n", pItem->name.chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "#. %s\n", pItem->name.chars());
}
}
slots++;
@@ -503,14 +503,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
keys |= (1<<option++);
if (m_AutoColors)
{
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"%s%d. \\w%s\n",
m_ItemColor.chars(),
option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars());
} else {
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"%d. %s\n",
option == 10 ? 0 : option,
@@ -520,13 +520,13 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
option++;
if (m_AutoColors)
{
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"\\d%d. %s\n\\w",
option == 10 ? 0 : option,
m_OptNames[abs(MENU_BACK)].chars());
} else {
UTIL_Format(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_BACK)].chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_BACK)].chars());
}
}
m_Text = m_Text + buffer;
@@ -536,14 +536,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
keys |= (1<<option++);
if (m_AutoColors)
{
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"%s%d. \\w%s\n",
m_ItemColor.chars(),
option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars());
} else {
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"%d. %s\n",
option == 10 ? 0 : option,
@@ -553,13 +553,13 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
option++;
if (m_AutoColors)
{
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"\\d%d. %s\n\\w",
option == 10 ? 0 : option,
m_OptNames[abs(MENU_MORE)].chars());
} else {
UTIL_Format(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_MORE)].chars());
ke::SafeSprintf(buffer, sizeof(buffer)-1, "#. %s\n", m_OptNames[abs(MENU_MORE)].chars());
}
}
m_Text = m_Text + buffer;
@@ -578,14 +578,14 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
keys |= (1<<option++);
if (m_AutoColors)
{
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"%s%d. \\w%s\n",
m_ItemColor.chars(),
option == 10 ? 0 : option,
m_OptNames[abs(MENU_EXIT)].chars());
} else {
UTIL_Format(buffer,
ke::SafeSprintf(buffer,
sizeof(buffer)-1,
"%d. %s\n",
option == 10 ? 0 : option,