Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion code/missionui/missionscreencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,13 @@ int common_scroll_up_pressed(int *start, int size, int max_show)
//
int common_scroll_down_pressed(int *start, int size, int max_show)
{
// check if we even need to scroll at all
// if the whole list fits on screen, the start offset must be 0;
// reset a stale non-zero offset so the up arrow doesn't get stuck
if ( size <= max_show ) {
if ( *start > 0 ) {
*start = 0;
return 1;
}
return 0;
}

Expand Down
12 changes: 10 additions & 2 deletions code/missionui/missionshipchoice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3307,9 +3307,17 @@ void ss_synch_interface()

init_active_list(); // build the list of pool ships

if ( old_list_start < SS_active_list_size ) {
SS_active_list_start = old_list_start;
// clamp the preserved scroll offset against the largest valid offset
// for the new list size, so the up arrow can still reach items at the
// top after a swap shrinks the active list (e.g., to <= MAX_ICONS_ON_SCREEN)
int max_start = SS_active_list_size - MAX_ICONS_ON_SCREEN;
if ( max_start < 0 ) {
max_start = 0;
}
if ( old_list_start > max_start ) {
old_list_start = max_start;
}
SS_active_list_start = old_list_start;

for ( i = 0; i < MAX_WSS_SLOTS; i++ ) {
slot = &Ss_wings[i/MAX_WING_SLOTS].ss_slots[i%MAX_WING_SLOTS];
Expand Down
Loading