]> granicus.if.org Git - nethack/commitdiff
From <Someone>
authornethack.allison <nethack.allison>
Thu, 14 Feb 2002 05:15:51 +0000 (05:15 +0000)
committernethack.allison <nethack.allison>
Thu, 14 Feb 2002 05:15:51 +0000 (05:15 +0000)
Fixed the map scrolling problem that Yitzhak reported.

win/win32/mhmap.c

index c6f6e53c40dc460d6c33fdf3b02616f68eda6718..83e388a1df6c1b72a9591b33761487c3eef106b9 100644 (file)
@@ -112,7 +112,7 @@ void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw)
                GetNHApp()->bNoHScroll = TRUE;
        } else {
                GetNHApp()->bNoHScroll = FALSE;
-               data->xPos = max(0, min(COLNO, u.ux - data->xPageSize/2));
+               data->xPos = max(0, min(COLNO-data->xPageSize+1, u.ux - data->xPageSize/2));
        }
 
     si.cbSize = sizeof(si); 
@@ -134,7 +134,7 @@ void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw)
                GetNHApp()->bNoVScroll = TRUE;
        } else {
                GetNHApp()->bNoVScroll = FALSE;
-               data->yPos = max(0, min(ROWNO, u.uy - data->yPageSize/2));
+               data->yPos = max(0, min(ROWNO-data->yPageSize+1, u.uy - data->yPageSize/2));
        }
 
     si.cbSize = sizeof(si); 
@@ -670,8 +670,7 @@ void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
              yNewPos = data->yPos; 
     } 
 
-       yNewPos = max(0, yNewPos);
-       yNewPos = min(ROWNO-data->yPageSize+1, yNewPos);
+       yNewPos = max(0, min(ROWNO-data->yPageSize+1, yNewPos));
        if( yNewPos == data->yPos ) return;
        
        yDelta = yNewPos - data->yPos;
@@ -729,8 +728,7 @@ void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
              xNewPos = data->xPos; 
     } 
 
-       xNewPos = max(0, xNewPos);
-       xNewPos = min(COLNO-data->xPageSize+1, xNewPos);
+       xNewPos = max(0, min(COLNO-data->xPageSize+1, xNewPos));
        if( xNewPos == data->xPos ) return;
        
        xDelta = xNewPos - data->xPos;