summaryrefslogtreecommitdiff
path: root/src/order_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-01-31 20:44:15 +0000
committerfrosch <frosch@openttd.org>2011-01-31 20:44:15 +0000
commita97d52a29a990132a8a5e4dd60304483617cec50 (patch)
tree0d8d42d633feabb438f812cedf0534a3c665074e /src/order_gui.cpp
parent67a5cd0b185158ca4926c8cb45f1735a1001e00b (diff)
downloadopenttd-a97d52a29a990132a8a5e4dd60304483617cec50.tar.xz
(svn r21933) -Codechange: Split cur_order_index into cur_auto_order_index and cur_real_order_index to keep track of the current real order in an unambiguous way.
-Fix [FS#4440]: Automatic orders behave now stable wrt. service orders and are not added or removed depending on the need of servicing. -Fix: Various other issues with automatic orders, e.g. vehicles getting stuck with "no orders" when there are automatic orders at the end of the order list.
Diffstat (limited to 'src/order_gui.cpp')
-rw-r--r--src/order_gui.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 2ad2893e4..d98140432 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -195,8 +195,11 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
Dimension sprite_size = GetSpriteSize(sprite);
- if (v->cur_order_index == order_index) {
- DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
+ if (v->cur_real_order_index == order_index) {
+ DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
+ DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
+ } else if (v->cur_auto_order_index == order_index) {
+ DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
}
TextColour colour = TC_BLACK;
@@ -207,7 +210,7 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
}
SetDParam(0, order_index + 1);
- DrawString(left, rtl ? right - sprite_size.width - 3 : middle, y, STR_ORDER_INDEX, colour, SA_RIGHT | SA_FORCE);
+ DrawString(left, rtl ? right - 2 * sprite_size.width - 3 : middle, y, STR_ORDER_INDEX, colour, SA_RIGHT | SA_FORCE);
SetDParam(5, STR_EMPTY);
@@ -684,10 +687,10 @@ private:
void OrderClick_Skip(int i)
{
/* Don't skip when there's nothing to skip */
- if (_ctrl_pressed && this->vehicle->cur_order_index == this->OrderGetSel()) return;
+ if (_ctrl_pressed && this->vehicle->cur_auto_order_index == this->OrderGetSel()) return;
if (this->vehicle->GetNumOrders() <= 1) return;
- DoCommandP(this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_order_index + 1) % this->vehicle->GetNumOrders()),
+ DoCommandP(this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_auto_order_index + 1) % this->vehicle->GetNumOrders()),
CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER));
}
@@ -1026,7 +1029,7 @@ public:
bool rtl = _current_text_dir == TD_RTL;
SetDParam(0, 99);
- int index_column_width = GetStringBoundingBox(STR_ORDER_INDEX).width + GetSpriteSize(rtl ? SPR_ARROW_RIGHT : SPR_ARROW_LEFT).width + 3;
+ int index_column_width = GetStringBoundingBox(STR_ORDER_INDEX).width + 2 * GetSpriteSize(rtl ? SPR_ARROW_RIGHT : SPR_ARROW_LEFT).width + 3;
int middle = rtl ? r.right - WD_FRAMETEXT_RIGHT - index_column_width : r.left + WD_FRAMETEXT_LEFT + index_column_width;
int y = r.top + WD_FRAMERECT_TOP;