Changeset - r8903:9c0d5a75fa24
[Not reviewed]
master
0 5 0
rubidium - 16 years ago 2008-04-12 13:07:25
rubidium@openttd.org
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
5 files changed with 43 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -2688,57 +2688,59 @@ STR_GO_TO_STATION                       
 
STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}Insert an advanced order
 
STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Go to nearest depot
 
STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Go to nearest hangar
 
STR_ORDER_NEAREST_DEPOT                                         :the nearest
 
STR_ORDER_NEAREST_HANGAR                                        :the nearest Hangar
 
STR_ORDER_SERVICE_AT                                            :Service at
 
STR_ORDER_SERVICE_NON_STOP_AT                                   :Service non-stop at
 
STR_ORDER_TRAIN_DEPOT                                           :Train Depot
 
STR_ORDER_ROAD_DEPOT                                            :Road Vehicle Depot
 
STR_ORDER_SHIP_DEPOT                                            :Ship Depot
 
STR_GO_TO_DEPOT                                                 :{STRING} {TOWN} {STRING}
 
STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
 
STR_GO_TO_HANGAR                                                :{STRING} {STATION} Hangar
 

	
 
STR_ORDER_CONDITIONAL                                           :Conditional order jump
 
STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP                          :{BLACK}Vehicle data to base jumping on
 
STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP                        :{BLACK}How to compare the vehicle data to the given value
 
STR_ORDER_CONDITIONAL_VALUE_TOOLTIP                             :{BLACK}The value to compare the vehicle data against
 
STR_ORDER_CONDITIONAL_VALUE_CAPT                                :{WHITE}Enter value to compare against
 
STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :Load percentage
 
STR_ORDER_CONDITIONAL_RELIABILITY                               :Reliability
 
STR_ORDER_CONDITIONAL_MAX_SPEED                                 :Maximum speed
 
STR_ORDER_CONDITIONAL_AGE                                       :Vehicle age (years)
 
STR_ORDER_CONDITIONAL_REQUIRES_SERVICE                          :Requires service
 
STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :Always
 
STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS                         :is equal to
 
STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :is not equal to
 
STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN                      :is less than
 
STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS                    :is less or equal to
 
STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN                      :is more than
 
STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS                    :is more or equal to
 
STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE                        :is true
 
STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE                       :is false
 
STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
 
STR_CONDITIONAL_UNCONDITIONAL                                   :Jump to order {COMMA}
 
STR_CONDITIONAL_NUM                                             :Jump to order {COMMA} when {STRING} {STRING} {COMMA}
 
STR_CONDITIONAL_TRUE_FALSE                                      :Jump to order {COMMA} when {STRING} {STRING}
 

	
 
STR_TIMETABLE_GO_TO                                             :{STRING4} {STRING2}
 
STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Travel (not timetabled)
 
STR_TIMETABLE_TRAVEL_FOR                                        :Travel for {STRING1}
 
STR_TIMETABLE_STAY_FOR                                          :and stay for {STRING1}
 
STR_TIMETABLE_DAYS                                              :{COMMA} day{P "" s}
 
STR_TIMETABLE_TICKS                                             :{COMMA} tick{P "" s}
 

	
 
STR_HEADING_FOR_TRAIN_DEPOT                                     :{ORANGE}Heading for {TOWN} Train Depot
 
STR_HEADING_FOR_TRAIN_DEPOT_VEL                                 :{ORANGE}Heading for {TOWN} Train Depot, {VELOCITY}
 
STR_HEADING_FOR_TRAIN_DEPOT_SERVICE                             :{LTBLUE}Service at {TOWN} Train Depot
 
STR_HEADING_FOR_TRAIN_DEPOT_SERVICE_VEL                         :{LTBLUE}Service at {TOWN} Train Depot, {VELOCITY}
 

	
 
STR_INVALID_ORDER                                               :{RED} (Invalid Order)
 

	
 
STR_UNKNOWN_DESTINATION                                         :unknown destination
 
STR_8812_EMPTY                                                  :{LTBLUE}Empty
 
STR_8813_FROM                                                   :{LTBLUE}{CARGO} from {STATION}
 
STR_FROM_MULT                                                   :{LTBLUE}{CARGO} from {STATION} (x{NUM})
 
STR_8814_TRAIN_IS_WAITING_IN_DEPOT                              :{WHITE}Train {COMMA} is waiting in depot
 
STR_8815_NEW_VEHICLES                                           :{BLACK}New Vehicles
 
STR_8816                                                        :{BLACK}-
src/order_cmd.cpp
Show inline comments
 
@@ -875,102 +875,111 @@ CommandCost CmdModifyOrder(TileIndex til
 

	
 
		case MOF_UNLOAD:
 
			if ((data & ~(OUFB_UNLOAD | OUFB_TRANSFER | OUFB_NO_UNLOAD)) != 0) return CMD_ERROR;
 
			/* Unload and no-unload are mutual exclusive and so are transfer and no unload. */
 
			if (data != 0 && ((data & (OUFB_UNLOAD | OUFB_TRANSFER)) != 0) == ((data & OUFB_NO_UNLOAD) != 0)) return CMD_ERROR;
 
			if (data == order->GetUnloadType()) return CMD_ERROR;
 
			break;
 

	
 
		case MOF_LOAD:
 
			if (data > OLFB_NO_LOAD || data == 1) return CMD_ERROR;
 
			if (data == order->GetLoadType()) return CMD_ERROR;
 
			break;
 

	
 
		case MOF_DEPOT_ACTION:
 
			if (data != 0) return CMD_ERROR;
 
			break;
 

	
 
		case MOF_COND_VARIABLE:
 
			if (data >= OCV_END) return CMD_ERROR;
 
			break;
 

	
 
		case MOF_COND_COMPARATOR:
 
			if (data >= OCC_END) return CMD_ERROR;
 
			switch (order->GetConditionVariable()) {
 
				case OCV_UNCONDITIONALLY: return CMD_ERROR;
 

	
 
				case OCV_REQUIRES_SERVICE:
 
					if (data != OCC_IS_TRUE && data != OCC_IS_FALSE) return CMD_ERROR;
 
					break;
 

	
 
				default:
 
					if (data == OCC_IS_TRUE || data == OCC_IS_FALSE) return CMD_ERROR;
 
					break;
 
			}
 
			break;
 

	
 
		case MOF_COND_VALUE:
 
			switch (order->GetConditionVariable()) {
 
				case OCV_UNCONDITIONALLY: return CMD_ERROR;
 

	
 
				case OCV_LOAD_PERCENTAGE:
 
				case OCV_RELIABILITY:
 
					if (data > 100) return CMD_ERROR;
 
					break;
 

	
 
				default:
 
					if (data > 2047) return CMD_ERROR;
 
					break;
 
			}
 
			break;
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		switch (mof) {
 
			case MOF_NON_STOP:
 
				order->SetNonStopType((OrderNonStopFlags)data);
 
				break;
 

	
 
			case MOF_UNLOAD:
 
				order->SetUnloadType((OrderUnloadFlags)data);
 
				if ((data & OUFB_NO_UNLOAD) != 0 && (order->GetLoadType() & OLFB_NO_LOAD) != 0) {
 
					order->SetLoadType((OrderLoadFlags)(order->GetLoadType() & ~OLFB_NO_LOAD));
 
				}
 
				break;
 

	
 
			case MOF_LOAD:
 
				order->SetLoadType((OrderLoadFlags)data);
 
				if ((data & OLFB_NO_LOAD) != 0 && (order->GetUnloadType() & OUFB_NO_UNLOAD) != 0) {
 
					/* No load + no unload isn't compatible */
 
					order->SetUnloadType((OrderUnloadFlags)(order->GetUnloadType() & ~OUFB_NO_UNLOAD));
 
				}
 
				break;
 

	
 
			case MOF_DEPOT_ACTION:
 
				order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() ^ ODTFB_SERVICE));
 
				break;
 

	
 
			case MOF_COND_VARIABLE: {
 
				order->SetConditionVariable((OrderConditionVariable)data);
 

	
 
				OrderConditionComparator occ = order->GetConditionComparator();
 
				switch (order->GetConditionVariable()) {
 
					case OCV_UNCONDITIONALLY:
 
						order->SetConditionComparator(OCC_EQUALS);
 
						order->SetConditionValue(0);
 
						break;
 

	
 
					case OCV_REQUIRES_SERVICE:
 
						if (occ != OCC_IS_TRUE && occ != OCC_IS_FALSE) order->SetConditionComparator(OCC_IS_TRUE);
 
						break;
 

	
 
					case OCV_LOAD_PERCENTAGE:
 
					case OCV_RELIABILITY:
 
						if (order->GetConditionValue() > 100) order->SetConditionValue(100);
 
						/* FALL THROUGH */
 
					default:
 
						if (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) order->SetConditionComparator(OCC_EQUALS);
 
						break;
 
				}
 
			} break;
 

	
 
			case MOF_COND_COMPARATOR:
 
				order->SetConditionComparator((OrderConditionComparator)data);
 
				break;
 

	
 
			case MOF_COND_VALUE:
 
				order->SetConditionValue(data);
 
				break;
 

	
 
			default: NOT_REACHED();
 
		}
 
@@ -1685,48 +1694,49 @@ bool ProcessOrders(Vehicle *v)
 
				} else {
 
					UpdateVehicleTimetable(v, true);
 
					v->cur_order_index++;
 
				}
 
			} else if (v->type != VEH_AIRCRAFT) {
 
				v->dest_tile = GetDepot(order->GetDestination())->xy;
 
			}
 
			break;
 

	
 
		case OT_GOTO_WAYPOINT:
 
			v->dest_tile = GetWaypoint(order->GetDestination())->xy;
 
			break;
 

	
 
		case OT_CONDITIONAL: {
 
			bool skip_order = false;
 
			OrderConditionComparator occ = order->GetConditionComparator();
 
			uint16 value = order->GetConditionValue();
 

	
 
			switch (order->GetConditionVariable()) {
 
				case OCV_LOAD_PERCENTAGE:  skip_order = OrderConditionCompare(occ, CalcPercentVehicleFilled(v, NULL), value); break;
 
				case OCV_RELIABILITY:      skip_order = OrderConditionCompare(occ, v->reliability * 100 >> 16,        value); break;
 
				case OCV_MAX_SPEED:        skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed(),           value); break;
 
				case OCV_AGE:              skip_order = OrderConditionCompare(occ, v->age / 366,                      value); break;
 
				case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(),               value); break;
 
				case OCV_UNCONDITIONALLY:  skip_order = true; break;
 
				default: NOT_REACHED();
 
			}
 
			UpdateVehicleTimetable(v, true);
 
			if (skip_order) {
 
				v->cur_order_index = order->GetConditionSkipToOrder();
 
			} else {
 
				v->cur_order_index++;
 
			}
 
		} return false;
 

	
 
		default:
 
			v->dest_tile = 0;
 
			return false;
 
	}
 

	
 
	return may_reverse;
 
}
 

	
 
/**
 
 * Check whether the given vehicle should stop at the given station
 
 * based on this order and the non-stop settings.
 
 * @param v       the vehicle that might be stopping.
 
 * @param station the station to stop at.
 
 * @return true if the vehicle should stop.
src/order_gui.cpp
Show inline comments
 
@@ -170,48 +170,49 @@ static const StringID _order_unload_drow
 
	STR_ORDER_DROP_NO_UNLOADING,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _order_goto_dropdown[] = {
 
	STR_ORDER_GO_TO,
 
	STR_ORDER_GO_TO_NEAREST_DEPOT,
 
	STR_ORDER_CONDITIONAL,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _order_goto_dropdown_aircraft[] = {
 
	STR_ORDER_GO_TO,
 
	STR_ORDER_GO_TO_NEAREST_HANGAR,
 
	STR_ORDER_CONDITIONAL,
 
	INVALID_STRING_ID
 
};
 

	
 
static const StringID _order_conditional_variable[] = {
 
	STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE,
 
	STR_ORDER_CONDITIONAL_RELIABILITY,
 
	STR_ORDER_CONDITIONAL_MAX_SPEED,
 
	STR_ORDER_CONDITIONAL_AGE,
 
	STR_ORDER_CONDITIONAL_REQUIRES_SERVICE,
 
	STR_ORDER_CONDITIONAL_UNCONDITIONALLY,
 
	INVALID_STRING_ID,
 
};
 

	
 
static const StringID _order_conditional_condition[] = {
 
	STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
 
	STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
 
	STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
 
	STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
 
	STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
 
	STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
 
	STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
 
	STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
 
	INVALID_STRING_ID,
 
};
 

	
 
extern uint ConvertSpeedToDisplaySpeed(uint speed);
 
extern uint ConvertDisplaySpeedToSpeed(uint speed);
 

	
 

	
 
static void DrawOrdersWindow(Window *w)
 
{
 
	const Vehicle *v = GetVehicle(w->window_number);
 
	bool shared_orders = v->IsOrderListShared();
 

	
 
@@ -264,49 +265,50 @@ static void DrawOrdersWindow(Window *w)
 
			case OT_GOTO_WAYPOINT:
 
				w->DisableWidget(ORDER_WIDGET_FULL_LOAD);
 
				w->DisableWidget(ORDER_WIDGET_UNLOAD);
 
				break;
 

	
 
			case OT_GOTO_DEPOT:
 
				w->DisableWidget(ORDER_WIDGET_FULL_LOAD);
 

	
 
				/* Remove unload and replace it with refit */
 
				w->HideWidget(ORDER_WIDGET_UNLOAD);
 
				w->ShowWidget(ORDER_WIDGET_REFIT);
 
				w->HideWidget(ORDER_WIDGET_FULL_LOAD);
 
				w->ShowWidget(ORDER_WIDGET_SERVICE);
 
				break;
 

	
 
			case OT_CONDITIONAL: {
 
				w->HideWidget(ORDER_WIDGET_NON_STOP);
 
				w->HideWidget(ORDER_WIDGET_UNLOAD);
 
				w->HideWidget(ORDER_WIDGET_FULL_LOAD);
 
				w->ShowWidget(ORDER_WIDGET_COND_VARIABLE);
 
				w->ShowWidget(ORDER_WIDGET_COND_COMPARATOR);
 
				w->ShowWidget(ORDER_WIDGET_COND_VALUE);
 

	
 
				OrderConditionVariable ocv = order->GetConditionVariable();
 
				w->SetWidgetDisabledState(ORDER_WIDGET_COND_VALUE, ocv == OCV_REQUIRES_SERVICE);
 
				w->SetWidgetDisabledState(ORDER_WIDGET_COND_COMPARATOR, ocv == OCV_UNCONDITIONALLY);
 
				w->SetWidgetDisabledState(ORDER_WIDGET_COND_VALUE, ocv == OCV_REQUIRES_SERVICE || ocv == OCV_UNCONDITIONALLY);
 

	
 
				uint value = order->GetConditionValue();
 
				if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
 
				SetDParam(1, value);
 
			} break;
 

	
 
			default: // every other orders
 
				w->DisableWidget(ORDER_WIDGET_NON_STOP);
 
				w->DisableWidget(ORDER_WIDGET_FULL_LOAD);
 
				w->DisableWidget(ORDER_WIDGET_UNLOAD);
 
		}
 
	}
 

	
 
	SetDParam(0, v->index);
 
	DrawWindowWidgets(w);
 

	
 
	int y = 15;
 

	
 
	int i = w->vscroll.pos;
 
	order = GetVehicleOrder(v, i);
 
	StringID str;
 
	while (order != NULL) {
 
		str = (v->cur_order_index == i) ? STR_8805 : STR_8804;
 
		SetDParam(6, STR_EMPTY);
 
@@ -351,59 +353,63 @@ static void DrawOrdersWindow(Window *w)
 
							case VEH_TRAIN: SetDParam(4, STR_ORDER_TRAIN_DEPOT); break;
 
							case VEH_ROAD:  SetDParam(4, STR_ORDER_ROAD_DEPOT); break;
 
							case VEH_SHIP:  SetDParam(4, STR_ORDER_SHIP_DEPOT); break;
 
							default: NOT_REACHED();
 
						}
 
					}
 

	
 
					if (order->GetDepotOrderType() & ODTFB_SERVICE) {
 
						SetDParam(2, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_SERVICE_NON_STOP_AT : STR_ORDER_SERVICE_AT);
 
					} else {
 
						SetDParam(2, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO : STR_ORDER_GO_TO);
 
					}
 

	
 
					if (order->IsRefit()) {
 
						SetDParam(6, STR_REFIT_ORDER);
 
						SetDParam(7, GetCargo(order->GetRefitCargo())->name);
 
					}
 
					break;
 

	
 
				case OT_GOTO_WAYPOINT:
 
					SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
 
					SetDParam(2, order->GetDestination());
 
					break;
 

	
 
				case OT_CONDITIONAL: {
 
					OrderConditionComparator occ = order->GetConditionComparator();
 
					SetDParam(1, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_CONDITIONAL_TRUE_FALSE : STR_CONDITIONAL_NUM);
 
				case OT_CONDITIONAL:
 
					SetDParam(2, order->GetConditionSkipToOrder() + 1);
 
					SetDParam(3, STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + order->GetConditionVariable());
 
					SetDParam(4, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
 
					if (order->GetConditionVariable() == OCV_UNCONDITIONALLY) {
 
						SetDParam(1, STR_CONDITIONAL_UNCONDITIONAL);
 
					} else {
 
						OrderConditionComparator occ = order->GetConditionComparator();
 
						SetDParam(1, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_CONDITIONAL_TRUE_FALSE : STR_CONDITIONAL_NUM);
 
						SetDParam(3, STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + order->GetConditionVariable());
 
						SetDParam(4, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
 

	
 
					uint value = order->GetConditionValue();
 
					if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
 
					SetDParam(5, value);
 
				} break;
 
						uint value = order->GetConditionValue();
 
						if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
 
						SetDParam(5, value);
 
					}
 
					break;
 

	
 
				default: NOT_REACHED();
 
			}
 

	
 
			SetDParam(0, i + 1);
 
			DrawString(2, y, str, (i == WP(w, order_d).sel) ? TC_WHITE : TC_BLACK);
 

	
 
			y += 10;
 
		}
 

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

	
 
	if (i - w->vscroll.pos < w->vscroll.cap) {
 
		str = shared_orders ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS;
 
		DrawString(2, y, str, (i == WP(w, order_d).sel) ? TC_WHITE : TC_BLACK);
 
	}
 
}
 

	
 
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
 
{
 
	Order order;
 
	order.next  = NULL;
src/order_type.h
Show inline comments
 
@@ -74,48 +74,49 @@ enum OrderNonStopFlags {
 
enum OrderDepotTypeFlags {
 
	ODTF_MANUAL          = 0,      ///< The player initiated this order manually.
 
	ODTFB_SERVICE        = 1 << 0, ///< This depot order is because of the servicing limit.
 
	ODTFB_PART_OF_ORDERS = 1 << 1, ///< This depot order is because of a regular order.
 
};
 

	
 
/**
 
 * Actions that can be performed when the vehicle enters the depot.
 
 */
 
enum OrderDepotActionFlags {
 
	ODATF_SERVICE_ONLY   = 0,      ///< Only service the vehicle.
 
	ODATFB_HALT          = 1 << 0, ///< Service the vehicle and then halt it.
 
	ODATFB_NEAREST_DEPOT = 1 << 1, ///< Send the vehicle to the nearest depot.
 
};
 

	
 
/**
 
 * Variables (of a vehicle) to 'cause' skipping on.
 
 */
 
enum OrderConditionVariable {
 
	OCV_LOAD_PERCENTAGE,  ///< Skip based on the amount of load
 
	OCV_RELIABILITY,      ///< Skip based on the reliability
 
	OCV_MAX_SPEED,        ///< Skip based on the maximum speed
 
	OCV_AGE,              ///< Skip based on the age
 
	OCV_REQUIRES_SERVICE, ///< Skip when the vehicle requires service
 
	OCV_UNCONDITIONALLY,  ///< Always skip
 
	OCV_END
 
};
 

	
 
/**
 
 * Comparator for the skip reasoning.
 
 */
 
enum OrderConditionComparator {
 
	OCC_EQUALS,      ///< Skip if both values are equal
 
	OCC_NOT_EQUALS,  ///< Skip if both values are not equal
 
	OCC_LESS_THAN,   ///< Skip if the value is less than the limit
 
	OCC_LESS_EQUALS, ///< Skip if the value is less or equal to the limit
 
	OCC_MORE_THAN,   ///< Skip if the value is more than the limit
 
	OCC_MORE_EQUALS, ///< Skip if the value is more or equal to the limit
 
	OCC_IS_TRUE,     ///< Skip if the variable is true
 
	OCC_IS_FALSE,    ///< Skip if the variable is false
 
	OCC_END
 
};
 

	
 

	
 
/**
 
 * Enumeration for the data to set in CmdModifyOrder.
 
 */
 
enum ModifyOrderFlags {
 
	MOF_NON_STOP,        ///< Passes a OrderNonStopFlags.
src/timetable_gui.cpp
Show inline comments
 
@@ -158,60 +158,64 @@ static void DrawTimetableWindow(Window *
 
							SetDParam(2, GetDepot(order->GetDestination())->town_index);
 
						}
 

	
 
						switch (v->type) {
 
							case VEH_TRAIN: SetDParam(3, STR_ORDER_TRAIN_DEPOT); break;
 
							case VEH_ROAD:  SetDParam(3, STR_ORDER_ROAD_DEPOT); break;
 
							case VEH_SHIP:  SetDParam(3, STR_ORDER_SHIP_DEPOT); break;
 
							default: NOT_REACHED();
 
						}
 
					}
 

	
 
					if (order->GetDepotOrderType() & ODTFB_SERVICE) {
 
						SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_SERVICE_NON_STOP_AT : STR_ORDER_SERVICE_AT);
 
					} else {
 
						SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO : STR_ORDER_GO_TO);
 
					}
 
					break;
 

	
 
				case OT_GOTO_WAYPOINT:
 
					SetDParam(0, (order->GetNonStopType() != ONSF_STOP_EVERYWHERE) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
 
					SetDParam(1, order->GetDestination());
 
					break;
 

	
 

	
 
				case OT_CONDITIONAL: {
 
					extern uint ConvertSpeedToDisplaySpeed(uint speed);
 
					OrderConditionComparator occ = order->GetConditionComparator();
 
					SetDParam(0, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_CONDITIONAL_TRUE_FALSE : STR_CONDITIONAL_NUM);
 
				case OT_CONDITIONAL:
 
					SetDParam(1, order->GetConditionSkipToOrder() + 1);
 
					SetDParam(2, STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + order->GetConditionVariable());
 
					SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
 
					if (order->GetConditionVariable() == OCV_UNCONDITIONALLY) {
 
						SetDParam(0, STR_CONDITIONAL_UNCONDITIONAL);
 
					} else {
 
						extern uint ConvertSpeedToDisplaySpeed(uint speed);
 
						OrderConditionComparator occ = order->GetConditionComparator();
 
						SetDParam(0, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_CONDITIONAL_TRUE_FALSE : STR_CONDITIONAL_NUM);
 
						SetDParam(2, STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + order->GetConditionVariable());
 
						SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
 

	
 
					uint value = order->GetConditionValue();
 
					if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
 
					SetDParam(4, value);
 
				} break;
 
						uint value = order->GetConditionValue();
 
						if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
 
						SetDParam(4, value);
 
					}
 
					break;
 

	
 
				default: break;
 
			}
 

	
 
			DrawString(2, y, STR_TIMETABLE_GO_TO, (i == selected) ? TC_WHITE : TC_BLACK);
 

	
 
			order_id++;
 

	
 
			if (order_id >= v->num_orders) {
 
				order = GetVehicleOrder(v, 0);
 
				final_order = true;
 
			} else {
 
				order = order->next;
 
			}
 
		} else {
 
			StringID string;
 

	
 
			if (order->travel_time == 0) {
 
				string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED;
 
			} else {
 
				SetTimetableParams(0, 1, order->travel_time);
 
				string = STR_TIMETABLE_TRAVEL_FOR;
 
			}
 

	
0 comments (0 inline, 0 general)