From <Someone>

Fixed the map scrolling problem that Yitzhak reported.
This commit is contained in:
nethack.allison
2002-02-14 05:15:51 +00:00
parent 5ba1968c14
commit 6d18eb3f0d

View File

@@ -112,7 +112,7 @@ void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw)
GetNHApp()->bNoHScroll = TRUE; GetNHApp()->bNoHScroll = TRUE;
} else { } else {
GetNHApp()->bNoHScroll = FALSE; 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); si.cbSize = sizeof(si);
@@ -134,7 +134,7 @@ void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw)
GetNHApp()->bNoVScroll = TRUE; GetNHApp()->bNoVScroll = TRUE;
} else { } else {
GetNHApp()->bNoVScroll = FALSE; 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); si.cbSize = sizeof(si);
@@ -670,8 +670,7 @@ void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
yNewPos = data->yPos; yNewPos = data->yPos;
} }
yNewPos = max(0, yNewPos); yNewPos = max(0, min(ROWNO-data->yPageSize+1, yNewPos));
yNewPos = min(ROWNO-data->yPageSize+1, yNewPos);
if( yNewPos == data->yPos ) return; if( yNewPos == data->yPos ) return;
yDelta = yNewPos - data->yPos; yDelta = yNewPos - data->yPos;
@@ -729,8 +728,7 @@ void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
xNewPos = data->xPos; xNewPos = data->xPos;
} }
xNewPos = max(0, xNewPos); xNewPos = max(0, min(COLNO-data->xPageSize+1, xNewPos));
xNewPos = min(COLNO-data->xPageSize+1, xNewPos);
if( xNewPos == data->xPos ) return; if( xNewPos == data->xPos ) return;
xDelta = xNewPos - data->xPos; xDelta = xNewPos - data->xPos;