Changeset - r3005:f513fb8e8842
[Not reviewed]
master
0 3 0
tron - 19 years ago 2006-02-10 06:33:56
tron@openttd.org
(svn r3585) Similar changes to the order handlers of the other vehicle types like r3584
3 files changed with 34 insertions and 39 deletions:
0 comments (0 inline, 0 general)
aircraft_cmd.c
Show inline comments
 
@@ -1040,38 +1040,35 @@ static void HandleAircraftSmoke(Vehicle 
 
}
 

	
 
static void ProcessAircraftOrder(Vehicle *v)
 
{
 
	const Order *order;
 

	
 
	// OT_GOTO_DEPOT, OT_LOADING
 
	if (v->current_order.type == OT_GOTO_DEPOT ||
 
			v->current_order.type == OT_LOADING) {
 
		if (v->current_order.type != OT_GOTO_DEPOT ||
 
				!(v->current_order.flags & OF_UNLOAD))
 
			return;
 
	switch (v->current_order.type) {
 
		case OT_GOTO_DEPOT:
 
			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
 
			if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
 
					!VehicleNeedsService(v)) {
 
				v->cur_order_index++;
 
			}
 
			break;
 

	
 
		case OT_LOADING: return;
 
	}
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT &&
 
			(v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
 
 			!VehicleNeedsService(v)) {
 
			v->cur_order_index++;
 
		}
 

	
 
	if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
 

	
 
	order = GetVehicleOrder(v, v->cur_order_index);
 

	
 
	if (order == NULL) {
 
		v->current_order.type = OT_NOTHING;
 
		v->current_order.flags = 0;
 
		return;
 
	}
 

	
 
	if (order->type == OT_DUMMY && !CheckForValidOrders(v))
 
		CrashAirplane(v);
 
	if (order->type == OT_DUMMY && !CheckForValidOrders(v)) CrashAirplane(v);
 

	
 
	if (order->type    == v->current_order.type   &&
 
			order->flags   == v->current_order.flags  &&
 
			order->station == v->current_order.station)
 
		return;
 

	
ship_cmd.c
Show inline comments
 
@@ -200,28 +200,27 @@ static const TileIndexDiffC _dock_offs[]
 
};
 

	
 
static void ProcessShipOrder(Vehicle *v)
 
{
 
	const Order *order;
 

	
 
	if (v->current_order.type >= OT_GOTO_DEPOT &&
 
			v->current_order.type <= OT_LEAVESTATION) {
 
		if (v->current_order.type != OT_GOTO_DEPOT ||
 
				!(v->current_order.flags & OF_UNLOAD))
 
	switch (v->current_order.type) {
 
		case OT_GOTO_DEPOT:
 
			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
 
			if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
 
					!VehicleNeedsService(v)) {
 
				v->cur_order_index++;
 
			}
 
			break;
 

	
 
		case OT_LOADING:
 
		case OT_LEAVESTATION:
 
			return;
 
	}
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT &&
 
			(v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
 
			!VehicleNeedsService(v)) {
 
		v->cur_order_index++;
 
	}
 

	
 

	
 
	if (v->cur_order_index >= v->num_orders)
 
		v->cur_order_index = 0;
 
	if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
 

	
 
	order = GetVehicleOrder(v, v->cur_order_index);
 

	
 
	if (order == NULL) {
 
		v->current_order.type  = OT_NOTHING;
 
		v->current_order.flags = 0;
train_cmd.c
Show inline comments
 
@@ -2271,27 +2271,26 @@ bad:;
 

	
 
static bool ProcessTrainOrder(Vehicle *v)
 
{
 
	const Order *order;
 
	bool result;
 

	
 
	// These are un-interruptible
 
	if (v->current_order.type >= OT_GOTO_DEPOT &&
 
			v->current_order.type <= OT_LEAVESTATION) {
 
		// Let a depot order in the orderlist interrupt.
 
		if (v->current_order.type != OT_GOTO_DEPOT ||
 
				!(v->current_order.flags & OF_UNLOAD))
 
	switch (v->current_order.type) {
 
		case OT_GOTO_DEPOT:
 
			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false;
 
			if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) &&
 
					!VehicleNeedsService(v)) {
 
				v->cur_order_index++;
 
			}
 
			break;
 

	
 
		case OT_LOADING:
 
		case OT_LEAVESTATION:
 
			return false;
 
	}
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT &&
 
			(v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) ==  (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
 
			!VehicleNeedsService(v)) {
 
		v->cur_order_index++;
 
	}
 

	
 
	// check if we've reached the waypoint?
 
	if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
 
		v->cur_order_index++;
 
	}
 

	
 
	// check if we've reached a non-stop station while TTDPatch nonstop is enabled..
0 comments (0 inline, 0 general)