diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-20 11:20:10 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-20 11:20:10 +0000 |
commit | 66cd85ea1d4dea648a94821e4fc3c7030c991be7 (patch) | |
tree | 9361d109b7ce4589cccb171e85538d9818a94f5b | |
parent | d31d7584ae39422c3ba70297d6abd1da69d2e714 (diff) | |
download | crawl-ref-66cd85ea1d4dea648a94821e4fc3c7030c991be7.tar.gz crawl-ref-66cd85ea1d4dea648a94821e4fc3c7030c991be7.zip |
Fix 2118669: scrolling could cause double-scrolling. I left the Tiles
code alone so I might have broken that.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6956 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/view.cc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 04106680f1..67a1b11393 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -3133,7 +3133,7 @@ void show_map( coord_def &spec_place, bool travel_mode ) arrange_features(features); } - char min_x = 80, max_x = 0, min_y = 0, max_y = 0; + int min_x = GXM, max_x = 0, min_y = 0, max_y = 0; bool found_y = false; const int num_lines = _get_number_of_lines_levelmap(); @@ -3527,13 +3527,17 @@ void show_map( coord_def &spec_place, bool travel_mode ) { // Scrolling only happens when we don't have a large enough // display to show the known map. - if (scroll_y < 0 && ((screen_y += scroll_y) <= min_y + half_screen)) - screen_y = min_y + half_screen; - - if (scroll_y > 0 && ((screen_y += scroll_y) >= max_y - half_screen)) - screen_y = max_y - half_screen; - - scroll_y = 0; + if (scroll_y != 0) + { + const int old_screen_y = screen_y; + screen_y += scroll_y; + if (scroll_y < 0) + screen_y = std::max(screen_y, min_y + half_screen); + else + screen_y = std::min(screen_y, max_y - half_screen); + curs_y -= (screen_y - old_screen_y); + scroll_y = 0; + } if (curs_y + move_y < 1) { |