Lobby Data: minor cleanup, fixup
* Wrap spaced_em_dash in a function since we can't guarantee font::unicode_em_dash will be initialized before this is, and Travis is crashing. * Remove an unnecessary std::string::find_first_of result check. If no character match is found, that returns std::string::npos, which substr takes to mean the entire string.
This commit is contained in:
parent
699407d7f0
commit
2c7a64143a
1 changed files with 9 additions and 6 deletions
|
@ -149,7 +149,11 @@ void user_info::update_relation()
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const std::string spaced_em_dash = " " + font::unicode_em_dash + " ";
|
const std::string& spaced_em_dash()
|
||||||
|
{
|
||||||
|
static const std::string res = " " + font::unicode_em_dash + " ";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns an abbreviated form of the provided string - ie, 'Ageless Era' should become 'AE'
|
// Returns an abbreviated form of the provided string - ie, 'Ageless Era' should become 'AE'
|
||||||
std::string make_short_name(const std::string& long_name)
|
std::string make_short_name(const std::string& long_name)
|
||||||
|
@ -415,11 +419,10 @@ game_info::game_info(const config& game, const config& game_config, const std::v
|
||||||
|
|
||||||
if(!turn.empty()) {
|
if(!turn.empty()) {
|
||||||
started = true;
|
started = true;
|
||||||
int index = turn.find_first_of('/');
|
|
||||||
if(index > -1) {
|
const std::string current_turn_string = turn.substr(0, turn.find_first_of('/'));
|
||||||
const std::string current_turn_string = turn.substr(0, index);
|
|
||||||
current_turn = lexical_cast<unsigned int>(current_turn_string);
|
current_turn = lexical_cast<unsigned int>(current_turn_string);
|
||||||
}
|
|
||||||
status = _("Turn") + " " + turn;
|
status = _("Turn") + " " + turn;
|
||||||
} else {
|
} else {
|
||||||
started = false;
|
started = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue