make tournament entry details cleaner

This commit is contained in:
Martin Michelsen
2022-12-13 23:39:23 -08:00
parent 846401469e
commit 79374d3dd1
+17 -9
View File
@@ -1494,15 +1494,23 @@ static void on_menu_item_info_request(shared_ptr<ServerState> s, shared_ptr<Clie
if (tourn) { if (tourn) {
auto team = tourn->get_team(team_index); auto team = tourn->get_team(team_index);
if (team) { if (team) {
string team_name = team->name.empty() ? "(Unnamed team)" : team->name; string message;
string message = string_printf("$C7%s\n%zuH/%zuC/%zu players\n%zu %s\n%s", if (team->name.empty()) {
team_name.c_str(), message = "(No registrant)";
team->num_human_players(), } else if (team->max_players == 1) {
team->num_com_players(), message = string_printf("$C6%s$C7\n%zu %s",
team->max_players, team->name.c_str(),
team->num_rounds_cleared, team->num_rounds_cleared,
team->num_rounds_cleared == 1 ? "win" : "wins", team->num_rounds_cleared == 1 ? "win" : "wins");
team->password.empty() ? "" : "Locked"); } else {
message = string_printf("$C6%s$C7\n%zuH/%zuC\n%zu %s\n%s",
team->name.c_str(),
team->num_human_players(),
team->num_com_players(),
team->num_rounds_cleared,
team->num_rounds_cleared == 1 ? "win" : "wins",
team->password.empty() ? "" : "Locked");
}
send_ship_info(c, decode_sjis(message)); send_ship_info(c, decode_sjis(message));
} else { } else {
send_ship_info(c, u"$C7No such team"); send_ship_info(c, u"$C7No such team");