Changeset - r13761:148e336fa28f
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-11-26 11:34:12
rubidium@openttd.org
(svn r18296) -Codechange: show the next 4 orders instead of the first 4 orders in the ship/aircraft vehicle lists
1 file changed with 16 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/vehicle_gui.cpp
Show inline comments
 
@@ -750,31 +750,38 @@ static const NWidgetPart _nested_vehicle
 
			NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), SetResize(1, 0), EndContainer(),
 
		EndContainer(),
 
		NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
	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());
 
			DrawString(left + 6, right - 6, y, STR_TINY_BLACK_STATION);
 

	
 
			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);
 
}
 

	
 
/**
 
 * Draws an image of a vehicle chain
 
 * @param v         Front vehicle
 
 * @param left      The minimum horizontal position
 
@@ -860,13 +867,13 @@ void BaseVehicleListWindow::DrawVehicleL
 
		} else if (v->group_id != DEFAULT_GROUP) {
 
			/* The vehicle has no name, but is member of a group, so print group name */
 
			SetDParam(0, v->group_id);
 
			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;
 
		} else {
 
			str = (v->age > v->max_age - DAYS_IN_LEAP_YEAR) ? STR_RED_COMMA : STR_BLACK_COMMA;
 
		}
0 comments (0 inline, 0 general)