summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-01-24 19:19:12 +0000
committerbjarni <bjarni@openttd.org>2007-01-24 19:19:12 +0000
commit4bd4583df1f05c84fbe31de74489e7272d0bc20c (patch)
tree234a7df6a2128847e4d43f5dfa49a65f2c27bf4f
parent0543c355e96fccd8e48c2cba494b399197dd9924 (diff)
downloadopenttd-4bd4583df1f05c84fbe31de74489e7272d0bc20c.tar.xz
(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
-rw-r--r--src/order_gui.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index bfd122ff9..9ef6f7f30 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -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},