Update newmenus.cpp (#884)
Fixes: #881 Co-authored-by: shel <2@shelru.ru>
This commit is contained in:
parent
f4fefd0bb4
commit
ff2fc19b08
|
@ -544,6 +544,20 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||
/* Don't bother if there is only one page */
|
||||
if (pages > 1)
|
||||
{
|
||||
|
||||
auto tempItemName = m_OptNames[abs(MENU_BACK)].chars();
|
||||
|
||||
if (this->useMultilingual)
|
||||
{
|
||||
const auto language = playerlang(player);
|
||||
const auto definition = translate(this->amx, language, tempItemName);
|
||||
|
||||
if (definition)
|
||||
{
|
||||
tempItemName = definition;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & Display_Back)
|
||||
{
|
||||
keys |= (1<<option++);
|
||||
|
@ -554,13 +568,13 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||
"%s%d. \\w%s\n",
|
||||
m_ItemColor.chars(),
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_BACK)].chars());
|
||||
tempItemName);
|
||||
} else {
|
||||
ke::SafeSprintf(buffer,
|
||||
sizeof(buffer),
|
||||
"%d. %s\n",
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_BACK)].chars());
|
||||
tempItemName);
|
||||
}
|
||||
} else {
|
||||
option++;
|
||||
|
@ -570,13 +584,26 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||
sizeof(buffer),
|
||||
"\\d%d. %s\n\\w",
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_BACK)].chars());
|
||||
tempItemName);
|
||||
} else {
|
||||
ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", m_OptNames[abs(MENU_BACK)].chars());
|
||||
ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", tempItemName);
|
||||
}
|
||||
}
|
||||
m_Text = m_Text + buffer;
|
||||
|
||||
tempItemName = m_OptNames[abs(MENU_MORE)].chars();
|
||||
|
||||
if (this->useMultilingual)
|
||||
{
|
||||
const auto language = playerlang(player);
|
||||
const auto definition = translate(this->amx, language, tempItemName);
|
||||
|
||||
if (definition)
|
||||
{
|
||||
tempItemName = definition;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & Display_Next)
|
||||
{
|
||||
keys |= (1<<option++);
|
||||
|
@ -587,13 +614,13 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||
"%s%d. \\w%s\n",
|
||||
m_ItemColor.chars(),
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_MORE)].chars());
|
||||
tempItemName);
|
||||
} else {
|
||||
ke::SafeSprintf(buffer,
|
||||
sizeof(buffer),
|
||||
"%d. %s\n",
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_MORE)].chars());
|
||||
tempItemName);
|
||||
}
|
||||
} else {
|
||||
option++;
|
||||
|
@ -603,9 +630,9 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||
sizeof(buffer),
|
||||
"\\d%d. %s\n\\w",
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_MORE)].chars());
|
||||
tempItemName);
|
||||
} else {
|
||||
ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", m_OptNames[abs(MENU_MORE)].chars());
|
||||
ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", tempItemName);
|
||||
}
|
||||
}
|
||||
m_Text = m_Text + buffer;
|
||||
|
@ -617,6 +644,19 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||
|
||||
if ((items_per_page && !m_NeverExit) || (m_ForceExit && numItems < 10))
|
||||
{
|
||||
auto exitName = m_OptNames[abs(MENU_EXIT)].chars();
|
||||
|
||||
if (this->useMultilingual)
|
||||
{
|
||||
const auto language = playerlang(player);
|
||||
const auto definition = translate(this->amx, language, exitName);
|
||||
|
||||
if (definition)
|
||||
{
|
||||
exitName = definition;
|
||||
}
|
||||
}
|
||||
|
||||
/* Visual pad has not been added yet */
|
||||
if (!items_per_page)
|
||||
m_Text = m_Text + "\n";
|
||||
|
@ -629,13 +669,13 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||
"%s%d. \\w%s\n",
|
||||
m_ItemColor.chars(),
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_EXIT)].chars());
|
||||
exitName);
|
||||
} else {
|
||||
ke::SafeSprintf(buffer,
|
||||
sizeof(buffer),
|
||||
"%d. %s\n",
|
||||
option == 10 ? 0 : option,
|
||||
m_OptNames[abs(MENU_EXIT)].chars());
|
||||
exitName);
|
||||
}
|
||||
m_Text = m_Text + buffer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user