mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-06 22:37:22 +00:00
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
instead assert if the widget array place them at different locations
This commit is contained in:
parent
2d93411e39
commit
fb5a0ba6df
@ -431,12 +431,17 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch (e->event) {
|
||||
case WE_CREATE:
|
||||
/* Move Refit to the same location as Unload
|
||||
* This will ensure that they always stay at the same location even if Unload is moved in a later commit */
|
||||
w->widget[ORDER_WIDGET_REFIT].left = w->widget[ORDER_WIDGET_UNLOAD].left;
|
||||
w->widget[ORDER_WIDGET_REFIT].right = w->widget[ORDER_WIDGET_UNLOAD].right;
|
||||
w->widget[ORDER_WIDGET_REFIT].top = w->widget[ORDER_WIDGET_UNLOAD].top;
|
||||
w->widget[ORDER_WIDGET_REFIT].bottom = w->widget[ORDER_WIDGET_UNLOAD].bottom;
|
||||
/* Ensure that the refit and unload buttons always remain at the same location.
|
||||
* Only one of them can be active at any one time and takes turns on being disabled.
|
||||
* To ensure that they stay at the same location, we also verify that they behave the same
|
||||
* when resizing. */
|
||||
if (GetVehicle(w->window_number)->owner == _local_player) { // only the vehicle owner got these buttons
|
||||
assert(w->widget[ORDER_WIDGET_REFIT].left == w->widget[ORDER_WIDGET_UNLOAD].left);
|
||||
assert(w->widget[ORDER_WIDGET_REFIT].right == w->widget[ORDER_WIDGET_UNLOAD].right);
|
||||
assert(w->widget[ORDER_WIDGET_REFIT].top == w->widget[ORDER_WIDGET_UNLOAD].top);
|
||||
assert(w->widget[ORDER_WIDGET_REFIT].bottom == w->widget[ORDER_WIDGET_UNLOAD].bottom);
|
||||
assert(w->widget[ORDER_WIDGET_REFIT].display_flags == w->widget[ORDER_WIDGET_UNLOAD].display_flags);
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_PAINT:
|
||||
@ -593,7 +598,7 @@ static const Widget _orders_train_widgets[] = {
|
||||
{ WWT_TEXTBTN, RESIZE_TB, 14, 159, 211, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 212, 264, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 265, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 372, 76, 87, STR_REFIT, STR_REFIT_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 265, 319, 76, 87, STR_REFIT, STR_REFIT_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 372, 76, 87, STR_886F_TRANSFER, STR_886D_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 373, 386, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP},
|
||||
{ WWT_PANEL, RESIZE_RTB, 14, 387, 386, 76, 87, 0x0, STR_NULL},
|
||||
@ -620,7 +625,7 @@ static const Widget _orders_widgets[] = {
|
||||
{ WWT_TEXTBTN, RESIZE_TB, 14, 129, 192, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 193, 256, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 257, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 383, 76, 87, STR_REFIT, STR_REFIT_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 257, 319, 76, 87, STR_REFIT, STR_REFIT_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 383, 76, 87, STR_886F_TRANSFER, STR_886D_MAKE_THE_HIGHLIGHTED_ORDER},
|
||||
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 384, 397, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP},
|
||||
{ WWT_PANEL, RESIZE_RTB, 14, 397, 396, 76, 87, 0x0, STR_NULL},
|
||||
|
Loading…
Reference in New Issue
Block a user