File diff r26193:4bc7915a2156 → r26194:f7347205838e
src/ground_vehicle.hpp
Show inline comments
 
@@ -89,9 +89,11 @@ struct GroundVehicle : public Specialize
 

	
 
	void PowerChanged();
 
	void CargoChanged();
 
	int GetAcceleration() const;
 
	int GetAcceleration();
 
	bool IsChainInDepot() const override;
 

	
 
	void CalculatePower(uint32& power, uint32& max_te, bool breakdowns) const;
 

	
 
	/**
 
	 * Common code executed for crashed ground vehicles
 
	 * @param flooded was this vehicle flooded?
 
@@ -367,7 +369,22 @@ protected:
 

	
 
		/* When we are going faster than the maximum speed, reduce the speed
 
		 * somewhat gradually. But never lower than the maximum speed. */
 
		int tempmax = max_speed;
 
		int tempmax = ((this->breakdown_ctr == 1) ? this->cur_speed : max_speed);
 
		
 
		if (this->breakdown_ctr == 1) {
 
			if (this->breakdown_type == BREAKDOWN_LOW_POWER) {
 
				if((this->tick_counter & 0x7) == 0) {
 
					if(this->cur_speed > (this->breakdown_severity * max_speed) >> 8) {
 
						tempmax = this->cur_speed - (this->cur_speed / 10) - 1;
 
					} else {
 
						tempmax = (this->breakdown_severity * max_speed) >> 8;
 
					}
 
				}
 
			}
 
			if(this->breakdown_type == BREAKDOWN_LOW_SPEED)
 
				tempmax = std::min<int>(max_speed, this->breakdown_severity);
 
		}
 

	
 
		if (this->cur_speed > max_speed) {
 
			tempmax = std::max(this->cur_speed - (this->cur_speed / 10) - 1, max_speed);
 
		}