summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-26 11:34:12 +0000
committerrubidium <rubidium@openttd.org>2009-11-26 11:34:12 +0000
commit4978d30880a8ff5ca1f139949cf0e57af44e69b3 (patch)
tree5585e5247dafbbb4106747d7fe0d796a6f7dca09
parent1725a737001a5c60ec8581ee818005143d994c56 (diff)
downloadopenttd-4978d30880a8ff5ca1f139949cf0e57af44e69b3.tar.xz
(svn r18296) -Codechange: show the next 4 orders instead of the first 4 orders in the ship/aircraft vehicle lists
-rw-r--r--src/vehicle_gui.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 84703cba0..5089d42e9 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -753,16 +753,16 @@ static const NWidgetPart _nested_vehicle_list[] = {
EndContainer(),
};
-static void DrawSmallOrderList(const Vehicle *v, int left, int right, int y)
+static void DrawSmallOrderList(const Vehicle *v, int left, int right, int y, VehicleOrderID start = 0)
{
- const Order *order;
- int i = 0;
+ const Order *order = v->GetOrder(start);
+ if (order == NULL) return;
- int sel = v->cur_order_index;
+ int i = 0;
+ VehicleOrderID oid = start;
- FOR_VEHICLE_ORDERS(v, order) {
- if (sel == 0) DrawString(left, right, y, STR_TINY_RIGHT_ARROW, TC_BLACK);
- sel--;
+ do {
+ if (oid == v->cur_order_index) DrawString(left, right, y, STR_TINY_RIGHT_ARROW, TC_BLACK);
if (order->IsType(OT_GOTO_STATION)) {
SetDParam(0, order->GetDestination());
@@ -771,7 +771,14 @@ static void DrawSmallOrderList(const Vehicle *v, int left, int right, int y)
y += FONT_HEIGHT_SMALL;
if (++i == 4) break;
}
- }
+
+ oid++;
+ order = order->next;
+ if (order == NULL) {
+ order = v->orders.list->GetFirstOrder();
+ oid = 0;
+ }
+ } while (oid != start);
}
/**
@@ -863,7 +870,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int
DrawString(text_left, text_right, y, STR_TINY_GROUP, TC_BLACK);
}
- if (show_orderlist) DrawSmallOrderList(v, orderlist_left, orderlist_right, y);
+ if (show_orderlist) DrawSmallOrderList(v, orderlist_left, orderlist_right, y, v->cur_order_index);
if (v->IsInDepot()) {
str = STR_BLUE_COMMA;