fix box select bounds logic

develop
Myk Taylor 2023-07-20 19:28:49 -07:00
parent 040d2caa95
commit a6b304d9b4
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 12 additions and 2 deletions

@ -126,8 +126,13 @@ static bool init_mouse_selection_rect(rect2d &rect) {
}
static bool in_mouse_selection_rect(const rect2d &rect, const df::coord &pos) {
return ((pos.y == rect.first.y || pos.y == rect.second.y) && (pos.x >= rect.first.x || pos.x <= rect.second.x)) ||
((pos.x == rect.first.x || pos.x == rect.second.x) && (pos.y >= rect.first.y || pos.y <= rect.second.y));
return ((pos.y == rect.first.y || pos.y == rect.second.y) && (pos.x >= rect.first.x && pos.x <= rect.second.x)) ||
((pos.x == rect.first.x || pos.x == rect.second.x) && (pos.y >= rect.first.y && pos.y <= rect.second.y));
}
static bool in_kbd_selection_rect(const rect2d &rect, const df::coord &pos) {
return pos.y >= rect.first.y && pos.y <= rect.second.y &&
pos.x >= rect.first.x && pos.x <= rect.second.x;
}
static bool is_warm(const df::coord &pos) {
@ -182,6 +187,7 @@ static void paintScreenWarmDamp(bool show_hidden = false) {
}
bool has_kbd_selection_rect = false; // TODO where is this info stored?
rect2d kbd_sel_rect;
auto dims = Gui::getDwarfmodeViewDims().map();
for (int y = dims.first.y; y <= dims.second.y; ++y) {
@ -196,6 +202,10 @@ static void paintScreenWarmDamp(bool show_hidden = false) {
TRACE(log).print("skipping mouse selection box tile\n");
continue;
}
if (has_kbd_selection_rect && in_kbd_selection_rect(kbd_sel_rect, map_pos)){
TRACE(log).print("skipping keyboard selection box tile\n");
continue;
}
if (!show_hidden && !Maps::isTileVisible(map_pos)) {
TRACE(log).print("skipping hidden tile\n");