1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Remove use of std::transform(), use SDL_toupper/lower

There's no need to use a template here. Just manually call SDL_tolower()
or SDL_toupper() as needed.

Oh yeah, and use SDL_tolower() and SDL_toupper() instead of libc
tolower() and toupper().
This commit is contained in:
Misa 2020-07-03 14:54:23 -07:00 committed by Ethan Lee
parent 36e38027d8
commit 5fb0b4396a
4 changed files with 32 additions and 8 deletions

View file

@ -6786,7 +6786,10 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
{
text = " " + ed.ListOfMetaData[i].title;
}
std::transform(text.begin(), text.end(), text.begin(), ::tolower);
for (size_t ii = 0; ii < text.length(); ii++)
{
text[ii] = SDL_tolower(text[ii]);
}
option(text);
}
}

View file

@ -335,7 +335,10 @@ void Graphics::map_option(int opt, int num_opts, const std::string& text, bool s
if (selected)
{
std::string text_upper(text);
std::transform(text_upper.begin(), text_upper.end(), text_upper.begin(), ::toupper);
for (size_t i = 0; i < text_upper.length(); i++)
{
text_upper[i] = SDL_toupper(text_upper[i]);
}
Print(x - 16, y, "[ " + text_upper + " ]", 196, 196, 255 - help.glow);
}
else
@ -1300,7 +1303,10 @@ void Graphics::drawmenu( int cr, int cg, int cb )
if (game.menuoptions[i].active)
{
std::string tempstring = game.menuoptions[i].text;
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
for (size_t ii = 0; ii < tempstring.length(); ii++)
{
tempstring[ii] = SDL_toupper(tempstring[ii]);
}
tempstring = std::string("[ ") + tempstring + std::string(" ]");
Print((i * game.menuspacing) - 16 +game.menuxoff, 140 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
}
@ -1339,7 +1345,10 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb )
if (game.menuoptions[i].active)
{
std::string tempstring = game.menuoptions[i].text;
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
for (size_t ii = 0; ii < tempstring.length(); ii++)
{
tempstring[ii] = SDL_toupper(tempstring[ii]);
}
tempstring = std::string("[ ") + tempstring + std::string(" ]");
Print((i * game.menuspacing) - 16 +game.menuxoff, 140+8 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
}
@ -1355,7 +1364,10 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb )
if (game.menuoptions[i].active)
{
std::string tempstring = game.menuoptions[i].text;
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
for (size_t ii = 0; ii < tempstring.length(); ii++)
{
tempstring[ii] = SDL_toupper(tempstring[ii]);
}
tempstring = std::string("[ ") + tempstring + std::string(" ]");
Print((i * game.menuspacing) - 16 +game.menuxoff, 144 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
}

View file

@ -44,7 +44,10 @@ void scriptclass::tokenize( std::string t )
if (currentletter == '(' || currentletter == ')' || currentletter == ',')
{
words[j] = tempword;
std::transform(words[j].begin(), words[j].end(), words[j].begin(), ::tolower);
for (size_t ii = 0; ii < words[j].length(); ii++)
{
words[j][ii] = SDL_tolower(words[j][ii]);
}
j++;
tempword = "";
}
@ -3779,7 +3782,10 @@ void scriptclass::loadcustom(std::string t)
words[0]="nothing"; //Default!
words[1]="1"; //Default!
tokenize(lines[i]);
std::transform(words[0].begin(), words[0].end(), words[0].begin(), ::tolower);
for (size_t ii = 0; ii < words[0].length(); ii++)
{
words[0][ii] = SDL_tolower(words[0][ii]);
}
if(words[0] == "music"){
if(customtextmode==1){ add("endtext"); customtextmode=0;}
if(words[1]=="0"){

View file

@ -3236,7 +3236,10 @@ void editorrender()
if(ed.hookmenupage+i==ed.hookmenu)
{
std::string tstring="> " + ed.hooklist[(ed.hooklist.size()-1)-(ed.hookmenupage+i)] + " <";
std::transform(tstring.begin(), tstring.end(),tstring.begin(), ::toupper);
for (size_t ii = 0; ii < tstring.length(); ii++)
{
tstring[ii] = SDL_toupper(tstring[ii]);
}
graphics.Print(16,68+(i*16),tstring,123, 111, 218, true);
}
else