Improve grid appearance
This commit is contained in:
@@ -220,7 +220,7 @@ impl GameScreen {
|
||||
}
|
||||
|
||||
fn player_map(&self, map: &CurrentGameMapStatus, opponent_map: bool) -> GameMapWidget {
|
||||
let mut map_widget = GameMapWidget::new(&self.game.rules);
|
||||
let mut map_widget = GameMapWidget::new(&self.game.rules).set_default_empty_char(' ');
|
||||
|
||||
// Current shoot position
|
||||
if opponent_map {
|
||||
@@ -241,8 +241,14 @@ impl GameScreen {
|
||||
}
|
||||
|
||||
// Sunk boats
|
||||
for b in &map.sunk_boats {
|
||||
for c in b.all_coordinates() {
|
||||
map_widget =
|
||||
map_widget.set_char(c, b.len.to_string().chars().next().unwrap_or('9'));
|
||||
}
|
||||
}
|
||||
let sunk_boats = ColoredCells {
|
||||
color: Color::Gray,
|
||||
color: Color::LightRed,
|
||||
cells: map
|
||||
.sunk_boats
|
||||
.iter()
|
||||
@@ -251,18 +257,29 @@ impl GameScreen {
|
||||
};
|
||||
|
||||
// Touched boats
|
||||
for b in &map.successful_strikes {
|
||||
map_widget = map_widget.set_char_no_overwrite(*b, 'T');
|
||||
}
|
||||
let touched_areas = ColoredCells {
|
||||
color: Color::Red,
|
||||
cells: map.successful_strikes.clone(),
|
||||
};
|
||||
|
||||
// Failed strikes
|
||||
for b in &map.failed_strikes {
|
||||
map_widget = map_widget.set_char_no_overwrite(*b, '.');
|
||||
}
|
||||
let failed_strikes = ColoredCells {
|
||||
color: Color::DarkGray,
|
||||
color: Color::Black,
|
||||
cells: map.failed_strikes.clone(),
|
||||
};
|
||||
|
||||
// Boats
|
||||
for b in &map.boats.0 {
|
||||
for c in b.all_coordinates() {
|
||||
map_widget = map_widget.set_char_no_overwrite(c, 'B');
|
||||
}
|
||||
}
|
||||
let boats = ColoredCells {
|
||||
color: Color::Blue,
|
||||
cells: map
|
||||
|
Reference in New Issue
Block a user