diff options
author | smatz <smatz@openttd.org> | 2010-12-25 12:48:23 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2010-12-25 12:48:23 +0000 |
commit | d8b823142ed25f1d9417033a89632981d54e0c94 (patch) | |
tree | 30d9b03fd9ce7d41928b279ea5c1871e4a1e4686 /src | |
parent | b5268dccbd4da760b13114cebd44d371c3d84f56 (diff) | |
download | openttd-d8b823142ed25f1d9417033a89632981d54e0c94.tar.xz |
(svn r21633) -Fix (r21616): newly created skip-to order was created at wrong place
Diffstat (limited to 'src')
-rw-r--r-- | src/order_gui.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp index ef5a2ebd7..cc0701f4a 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1090,7 +1090,20 @@ public: { switch (widget) { case ORDER_WIDGET_ORDER_LIST: { - ResetObjectToPlace(); + if (this->goto_type == OPOS_CONDITIONAL) { + this->goto_type = OPOS_GOTO; + int order_id = this->GetOrderFromPt(_cursor.pos.y - this->top); + if (order_id != INVALID_ORDER) { + Order order; + order.next = NULL; + order.index = 0; + order.MakeConditional(order_id); + + DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER)); + } + ResetObjectToPlace(); + break; + } int sel = this->GetOrderFromPt(pt.y); @@ -1348,21 +1361,6 @@ public: virtual void OnPlaceObjectAbort() { - if (this->goto_type == OPOS_CONDITIONAL) { - this->goto_type = OPOS_GOTO; - NWidgetBase *nwid = this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST); - if (IsInsideBS(_cursor.pos.x, this->left + nwid->pos_x, nwid->current_x) && IsInsideBS(_cursor.pos.y, this->top + nwid->pos_y, nwid->current_y)) { - int order_id = this->GetOrderFromPt(_cursor.pos.y - this->top); - if (order_id != INVALID_ORDER) { - Order order; - order.next = NULL; - order.index = 0; - order.MakeConditional(order_id); - - DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER)); - } - } - } this->RaiseWidget(ORDER_WIDGET_GOTO); this->SetWidgetDirty(ORDER_WIDGET_GOTO); |