Added window_align_tabs

New cross window compatible version. For window_park and window_peep.
This commit is contained in:
Duncan 2014-08-27 12:34:47 +01:00 committed by Duncan Frost
parent d3455b8f22
commit 5bdff85db1
1 changed files with 15 additions and 1 deletions

View File

@ -1495,4 +1495,18 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rc
" :[address] "+m" (address), [w] "+m" (w), [widget] "+m" (widget), [widgetIndex] "+m" (widgetIndex): : "eax", "esi", "edx", "edi"
);
#endif
}
}
/* Based on rct2: 0x6987ED and another version from window_park */
void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id )
int x = w->widgets[start_tab_id].left;
int tab_width = w->widgets[start_tab_id].right - w->widgets[start_tab_id].left;
for (int i = start_tab_id; i < end_tab_id; ++i){
if ( !(w->disabled_widgets & (1LL << i)) ){
w->widgets[i].left = x;
w->widgets[i].right = x + tab_width;
x += tab_width + 1;
}
}
}