File diff r26828:fa6e2fa4b68c → r26829:f1ebd010c392
src/timetable_gui.cpp
Show inline comments
 
@@ -82,33 +82,33 @@ static bool CanDetermineTimeTaken(const 
 
 * @param v Vehicle which must have at least 2 orders.
 
 * @param start order index to start at
 
 * @param travelling Are we still in the travelling part of the start order
 
 * @param table Fill in arrival and departures including intermediate orders
 
 * @param offset Add this value to result and all arrivals and departures
 
 */
 
static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID start, bool travelling, TimetableArrivalDeparture *table, Ticks offset)
 
{
 
	assert(table != nullptr);
 
	assert(v->GetNumOrders() >= 2);
 
	assert(start < v->GetNumOrders());
 

	
 
	Ticks sum = offset;
 
	VehicleOrderID i = start;
 
	const Order *order = v->GetOrder(i);
 

	
 
	/* Pre-initialize with unknown time */
 
	for (int i = 0; i < v->GetNumOrders(); ++i) {
 
		table[i].arrival = table[i].departure = INVALID_TICKS;
 
	}
 

	
 
	Ticks sum = offset;
 
	VehicleOrderID i = start;
 
	const Order *order = v->GetOrder(i);
 

	
 
	/* Cyclically loop over all orders until we reach the current one again.
 
	 * As we may start at the current order, do a post-checking loop */
 
	do {
 
		/* Automatic orders don't influence the overall timetable;
 
		 * they just add some untimetabled entries, but the time till
 
		 * the next non-implicit order can still be known. */
 
		if (!order->IsType(OT_IMPLICIT)) {
 
			if (travelling || i != start) {
 
				if (!CanDetermineTimeTaken(order, true)) return;
 
				sum += order->GetTimetabledTravel();
 
				table[i].arrival = sum;
 
			}