Change font::print_wrap text argument from std::string to const char*

We no longer need to pass a std::string object to the print and len
functions - in fact, we often only have a C string that we want to
print or get the visual width of (that C string most often comes from
loc::gettext), and it's a bit wasteful to wrap it in a new std::string
object on every print/len call.

This does mean adding a few more .c_str()s, but there's not many places
where a std::string is being passed to these functions, and we already
use .c_str() sometimes.

-> Commit 1/3: font::print_wrap
   Commit 2/3: font::print
   Commit 3/3: font::len
This commit is contained in:
Dav999-v
2023-03-04 23:29:12 +01:00
committed by Misa Elizabeth Kai
parent 58d21e956b
commit 264b6474be
4 changed files with 8 additions and 9 deletions

View File

@@ -614,7 +614,7 @@ static void menurender(void)
}
else if ((unsigned)game.currentmenuoption < loc::languagelist.size())
{
font::print_wrap(PR_CEN, -1, 8, loc::languagelist[game.currentmenuoption].credit, tr/2, tg/2, tb/2);
font::print_wrap(PR_CEN, -1, 8, loc::languagelist[game.currentmenuoption].credit.c_str(), tr/2, tg/2, tb/2);
font::print(PR_CEN, -1, 230, loc::languagelist[game.currentmenuoption].action_hint, tr/2, tg/2, tb/2);
}
break;