diff --git a/rust/cli_player/src/ui_widgets/game_map_widget.rs b/rust/cli_player/src/ui_widgets/game_map_widget.rs index 21ee061..e638475 100644 --- a/rust/cli_player/src/ui_widgets/game_map_widget.rs +++ b/rust/cli_player/src/ui_widgets/game_map_widget.rs @@ -24,10 +24,36 @@ impl<'a> Widget for GameMapWidget<'a> { for x in 0..(self.rules.map_width + 1) { let o_x = x as u16 * 2; let o_y = y as u16 * 2; - buf.get_mut(o_x, o_y).set_symbol(symbols.cross); - buf.get_mut(o_x + 1, o_y).set_symbol(symbols.horizontal); - buf.get_mut(o_x, o_y + 1).set_symbol(symbols.vertical); - buf.get_mut(o_x + 1, o_y + 1).set_char('.'); + buf.get_mut(o_x, o_y).set_symbol(match (x, y) { + (0, 0) => symbols.top_left, + + (x, 0) if x == self.rules.map_width => symbols.top_right, + (0, y) if y == self.rules.map_height => symbols.bottom_left, + + (0, _) => symbols.vertical_right, + (_, 0) => symbols.horizontal_down, + + (x, y) if x == self.rules.map_width && y == self.rules.map_height => { + symbols.bottom_right + } + + (x, _) if x == self.rules.map_width => symbols.vertical_left, + (_, y) if y == self.rules.map_height => symbols.horizontal_up, + + _ => symbols.cross, + }); + + if x < self.rules.map_width { + buf.get_mut(o_x + 1, o_y).set_symbol(symbols.horizontal); + } + + if y < self.rules.map_height { + buf.get_mut(o_x, o_y + 1).set_symbol(symbols.vertical); + } + + if x < self.rules.map_width && y < self.rules.map_height { + buf.get_mut(o_x + 1, o_y + 1).set_char('.'); + } } } }