Changeset - r15948:54c7a9cc770e
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-08-28 14:18:56
rubidium@openttd.org
(svn r20646) -Codechange: make the code flow of breakdown handling a bit clearer
1 file changed with 11 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -993,12 +993,11 @@ bool Vehicle::HandleBreakdown()
 
	 * 1  - vehicle is currently broken down
 
	 * 2  - vehicle is going to break down now
 
	 * >2 - vehicle is counting down to the actual breakdown event */
 
	if (this->breakdown_ctr == 0) return false;
 
	if (this->breakdown_ctr > 2) {
 
		if (!this->current_order.IsType(OT_LOADING)) this->breakdown_ctr--;
 
	switch (this->breakdown_ctr) {
 
		case 0:
 
		return false;
 
	}
 
	if (this->breakdown_ctr != 1) {
 

	
 
		case 2:
 
		this->breakdown_ctr = 1;
 

	
 
		if (this->breakdowns_since_last_service != 255) {
 
@@ -1026,8 +1025,8 @@ bool Vehicle::HandleBreakdown()
 
				if (u != NULL) u->animation_state = this->breakdown_delay * 2;
 
			}
 
		}
 
	}
 

	
 
			/* FALL THROUGH */
 
		case 1:
 
	/* Aircraft breakdowns end only when arriving at the airport */
 
	if (this->type == VEH_AIRCRAFT) return false;
 

	
 
@@ -1040,6 +1039,11 @@ bool Vehicle::HandleBreakdown()
 
		}
 
	}
 
	return true;
 

	
 
		default:
 
			if (!this->current_order.IsType(OT_LOADING)) this->breakdown_ctr--;
 
			return false;
 
	}
 
}
 

	
 
void AgeVehicle(Vehicle *v)
0 comments (0 inline, 0 general)