Skip to content

Commit

Permalink
fix: UI: borders
Browse files Browse the repository at this point in the history
Fixed border overlapping map

Only partial fix, one bug remains: border not drawn for top-most and
left-most cell, if the corner isn't visible.
  • Loading branch information
kiedtl committed Oct 31, 2023
1 parent 3baabab commit 33f0825
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ui.zig
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ pub var map_win: struct {
while (x < a.end().x) : (x += 1) {
const co = Coord.new(x, y).asRect();
if (co.intersects(&a, 0) and !co.intersects(&b, 0)) {
const zy = @intCast(isize, y) - (@intCast(isize, refpoint.y) -| MAP_HEIGHT_R);
const zx = @intCast(isize, x) - (@intCast(isize, refpoint.x) -| MAP_WIDTH_R);
const zy = @intCast(isize, y) - (@intCast(isize, refpoint.y) - MAP_HEIGHT_R) - 1;
const zx = @intCast(isize, x) - (@intCast(isize, refpoint.x) - MAP_WIDTH_R) - 1;
if (zy > 0 and zx > 0 and zx < self.map.width and zy < self.map.height - 1) {
self.grid_annotations.setCell(@intCast(usize, zx * 2), @intCast(usize, zy), .{ .bg = c, .fl = .{ .wide = true } });
}
Expand Down Expand Up @@ -2926,6 +2926,7 @@ pub fn drawExamineScreen(starting_focus: ?ExamineTileFocus, start_coord: ?Coord)
const moblist = state.createMobList(false, true, state.player.coord.z, state.gpa.allocator());
defer moblist.deinit();

map_win.grid_annotations.clear();
defer map_win.annotations.clear();
defer map_win.map.renderFullyW(.Main);

Expand Down

0 comments on commit 33f0825

Please sign in to comment.