mirror of https://github.com/OpenTTD/OpenTTD
(svn r10724) -Fix (r10723): Toolbar spacing was off-by-one
parent
26c62dc5c0
commit
279ed3a9c1
|
@ -1155,7 +1155,7 @@ bool ChangeResInGame(int width, int height)
|
||||||
int new_width = min(_screen.width, 640);
|
int new_width = min(_screen.width, 640);
|
||||||
Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
||||||
if (w != NULL && new_width != w->width) {
|
if (w != NULL && new_width != w->width) {
|
||||||
ResizeWindow(w, new_width - w->width, 0);
|
ResizeWindow(w, new_width - w->width, 0);
|
||||||
|
|
||||||
Window *w2 = FindWindowById(WC_STATUS_BAR, 0);
|
Window *w2 = FindWindowById(WC_STATUS_BAR, 0);
|
||||||
if (w2 != NULL) ResizeWindow(w2, max(new_width, 320) - w2->width, 0);
|
if (w2 != NULL) ResizeWindow(w2, max(new_width, 320) - w2->width, 0);
|
||||||
|
|
|
@ -1710,16 +1710,16 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
|
||||||
uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 };
|
uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 };
|
||||||
|
|
||||||
for (uint i = 0, x = 0, j = 0; i < 27; i++) {
|
for (uint i = 0, x = 0, j = 0; i < 27; i++) {
|
||||||
w->widget[i].left = x;
|
|
||||||
x += (spacing != 0) ? button_width : (w->width - x) / (27 - i);
|
|
||||||
w->widget[i].right = x - 1;
|
|
||||||
|
|
||||||
if (extra_spacing_at[j] == i) {
|
if (extra_spacing_at[j] == i) {
|
||||||
j++;
|
j++;
|
||||||
uint add = spacing / (lengthof(extra_spacing_at) - j);
|
uint add = spacing / (lengthof(extra_spacing_at) - j);
|
||||||
spacing -= add;
|
spacing -= add;
|
||||||
x += add;
|
x += add;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w->widget[i].left = x;
|
||||||
|
x += (spacing != 0) ? button_width : (w->width - x) / (27 - i);
|
||||||
|
w->widget[i].right = x - 1;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue