Mercurial > hg > openttd
changeset 16898:d577acf03bba draft
(svn r21633) -Fix (r21616): newly created skip-to order was created at wrong place
author | smatz <smatz@openttd.org> |
---|---|
date | Sat, 25 Dec 2010 12:48:23 +0000 |
parents | 083a488420e0 |
children | 863fb3f56540 |
files | src/order_gui.cpp |
diffstat | 1 files changed, 14 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1090,7 +1090,20 @@ { 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 @@ 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);