- writeln!(f, "\nPlayers:")?;
- writeln!(f, "\t{:>3} players online.", players.len())?;
- for player in players {
- writeln!(f, "{}: {:<30} {:>4} {:>10} {}",
- player.index,
- player.name,
- player.score,
- player.duration,
- TheShipPlayer(&player.the_ship))?;
+ writeln!(f, "\n\n* Players: *")?;
+ writeln!(f, "\t{:>3} players online\n", players.len())?;
+ if players.len() > 0 {
+ writeln!(f, "{:^5} {:^30} {:^4} {:^10} {}", "Index", "Player name", "Score", "Duration", "The Ship")?;
+ for player in players {
+ writeln!(f, "{:>5} {:<30} {:>4} {:>10} {}",
+ player.index,
+ player.name,
+ player.score,
+ player.duration,
+ TheShipPlayer(&player.the_ship))?;
+ }