mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-31 02:14:09 +03:00
Remove usage of std::string from MenuOption
Instead, the string in MenuOption is just a buffer of 161 chars, which is 40 chars (160 bytes if each were the largest possible UTF-8 character size) plus a null terminator. This is because the maximum length of a menu option that can be fit on the screen without going past is 40 chars.
This commit is contained in:
@@ -6766,27 +6766,39 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::string text;
|
||||
const char* prefix;
|
||||
if(tvar>=0)
|
||||
{
|
||||
if(customlevelstats[tvar].score==0)
|
||||
switch (customlevelstats[tvar].score)
|
||||
{
|
||||
text = " " + ed.ListOfMetaData[i].title;
|
||||
case 0:
|
||||
{
|
||||
static const char tmp[] = " ";
|
||||
prefix = tmp;
|
||||
break;
|
||||
}
|
||||
else if(customlevelstats[tvar].score==1)
|
||||
case 1:
|
||||
{
|
||||
text = " * " + ed.ListOfMetaData[i].title;
|
||||
static const char tmp[] = " * ";
|
||||
prefix = tmp;
|
||||
break;
|
||||
}
|
||||
else if(customlevelstats[tvar].score==3)
|
||||
case 3:
|
||||
{
|
||||
text = "** " + ed.ListOfMetaData[i].title;
|
||||
static const char tmp[] = "** ";
|
||||
prefix = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text = " " + ed.ListOfMetaData[i].title;
|
||||
static const char tmp[] = " ";
|
||||
prefix = tmp;
|
||||
}
|
||||
for (size_t ii = 0; ii < text.length(); ii++)
|
||||
char text[menutextbytes];
|
||||
SDL_snprintf(text, sizeof(text), "%s%s", prefix, ed.ListOfMetaData[i].title.c_str());
|
||||
for (size_t ii = 0; ii < SDL_arraysize(text); ii++)
|
||||
{
|
||||
text[ii] = SDL_tolower(text[ii]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user