Changeset - r13049:d72478af1c7d
[Not reviewed]
master
0 3 0
alberth - 15 years ago 2009-09-16 19:00:53
alberth@openttd.org
(svn r17557) -Codechange: Pass left and right edge to DrawOrderString().
3 files changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/order_func.h
Show inline comments
 
@@ -38,25 +38,25 @@ void BackupVehicleOrders(const Vehicle *
 
void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *order = &_backup_orders_data);
 

	
 
/* Functions */
 
void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination);
 
void InvalidateVehicleOrder(const Vehicle *v, int data);
 
bool VehicleHasDepotOrders(const Vehicle *v);
 
void CheckOrders(const Vehicle*);
 
void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false);
 
bool ProcessOrders(Vehicle *v);
 
bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth = 0);
 
VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v);
 

	
 
void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int width);
 
void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int right);
 

	
 
#define MIN_SERVINT_PERCENT  5
 
#define MAX_SERVINT_PERCENT 90
 
#define MIN_SERVINT_DAYS    30
 
#define MAX_SERVINT_DAYS   800
 

	
 
/**
 
 * Clamp the service interval to the correct min/max. The actual min/max values
 
 * depend on whether it's in percent or days.
 
 * @param interval proposed service interval
 
 * @param company_id the owner of the vehicle
 
 * @return Clamped service interval
src/order_gui.cpp
Show inline comments
 
@@ -174,25 +174,25 @@ static const StringID _order_depot_actio
 

	
 
static int DepotActionStringIndex(const Order *order)
 
{
 
	if (order->GetDepotActionType() & ODATFB_HALT) {
 
		return DA_STOP;
 
	} else if (order->GetDepotOrderType() & ODTFB_SERVICE) {
 
		return DA_SERVICE;
 
	} else {
 
		return DA_ALWAYS_GO;
 
	}
 
}
 

	
 
void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int width)
 
void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int right)
 
{
 
	StringID str = (v->cur_order_index == order_index) ? STR_ORDER_SELECTED : STR_ORDER;
 
	SetDParam(6, STR_EMPTY);
 

	
 
	switch (order->GetType()) {
 
		case OT_DUMMY:
 
			SetDParam(1, STR_INVALID_ORDER);
 
			SetDParam(2, order->GetDestination());
 
			break;
 

	
 
		case OT_GOTO_STATION: {
 
			OrderLoadFlags load = order->GetLoadType();
 
@@ -278,25 +278,25 @@ void DrawOrderString(const Vehicle *v, c
 
			if (timetable && order->wait_time > 0) {
 
				SetDParam(6, STR_TIMETABLE_AND_TRAVEL_FOR);
 
				SetTimetableParams(7, 8, order->wait_time);
 
			} else {
 
				SetDParam(6, STR_EMPTY);
 
			}
 
			break;
 

	
 
		default: NOT_REACHED();
 
	}
 

	
 
	SetDParam(0, order_index + 1);
 
	DrawString(2, width + 2, y, str, selected ? TC_WHITE : TC_BLACK);
 
	DrawString(left, right, y, str, selected ? TC_WHITE : TC_BLACK);
 
}
 

	
 

	
 
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
 
{
 
	Order order;
 
	order.next  = NULL;
 
	order.index = 0;
 

	
 
	/* check depot first */
 
	if (_settings_game.order.gotodepot) {
 
		switch (GetTileType(tile)) {
 
@@ -833,25 +833,25 @@ public:
 
		}
 
		this->DrawWidgets();
 

	
 
		int y = 15;
 

	
 
		int i = this->vscroll.GetPosition();
 
		order = this->vehicle->GetOrder(i);
 
		StringID str;
 
		while (order != NULL) {
 
			/* Don't draw anything if it extends past the end of the window. */
 
			if (!this->vscroll.IsVisible(i)) break;
 

	
 
			DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false, this->widget[ORDER_WIDGET_ORDER_LIST].right - 4);
 
			DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false, this->widget[ORDER_WIDGET_ORDER_LIST].left + 2, this->widget[ORDER_WIDGET_ORDER_LIST].right - 2);
 
			y += ORDER_LIST_LINE_HEIGHT;
 

	
 
			i++;
 
			order = order->next;
 
		}
 

	
 
		if (this->vscroll.IsVisible(i)) {
 
			str = shared_orders ? STR_ORDERS_END_OF_SHARED_ORDERS : STR_ORDERS_END_OF_ORDERS;
 
			DrawString(this->widget[ORDER_WIDGET_ORDER_LIST].left + 2, this->widget[ORDER_WIDGET_ORDER_LIST].right - 2, y, str, (i == this->selected_order) ? TC_WHITE : TC_BLACK);
 
		}
 
	}
 

	
src/timetable_gui.cpp
Show inline comments
 
@@ -181,25 +181,25 @@ struct TimetableWindow : Window {
 
		int y = 15;
 
		int i = this->vscroll.GetPosition();
 
		VehicleOrderID order_id = (i + 1) / 2;
 
		bool final_order = false;
 

	
 
		const Order *order = v->GetOrder(order_id);
 

	
 
		while (order != NULL) {
 
			/* Don't draw anything if it extends past the end of the window. */
 
			if (!this->vscroll.IsVisible(i)) break;
 

	
 
			if (i % 2 == 0) {
 
				DrawOrderString(v, order, order_id, y, i == selected, true, this->widget[TTV_TIMETABLE_PANEL].right - 4);
 
				DrawOrderString(v, order, order_id, y, i == selected, true, this->widget[TTV_TIMETABLE_PANEL].left + 2, this->widget[TTV_TIMETABLE_PANEL].right - 2);
 

	
 
				order_id++;
 

	
 
				if (order_id >= v->GetNumOrders()) {
 
					order = v->GetOrder(0);
 
					final_order = true;
 
				} else {
 
					order = order->next;
 
				}
 
			} else {
 
				StringID string;
 

	
0 comments (0 inline, 0 general)