Changeset - r18210:7537b311432e
[Not reviewed]
master
0 1 0
frosch - 13 years ago 2011-10-21 21:03:40
frosch@openttd.org
(svn r23050) -Fix: [NewGRF] When vehicles break down, update the image cache after changing the vehicle state to make fish happy.
1 file changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -1087,16 +1087,12 @@ bool Vehicle::HandleBreakdown()
 
			this->breakdown_ctr = 1;
 

	
 
			if (this->breakdowns_since_last_service != 255) {
 
				this->breakdowns_since_last_service++;
 
			}
 

	
 
			this->MarkDirty();
 
			SetWindowDirty(WC_VEHICLE_VIEW, this->index);
 
			SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
 

	
 
			if (this->type == VEH_AIRCRAFT) {
 
				/* Aircraft just need this flag, the rest is handled elsewhere */
 
				this->vehstatus |= VS_AIRCRAFT_BROKEN;
 
			} else {
 
				this->cur_speed = 0;
 

	
 
@@ -1108,12 +1104,17 @@ bool Vehicle::HandleBreakdown()
 

	
 
				if (!(this->vehstatus & VS_HIDDEN)) {
 
					EffectVehicle *u = CreateEffectVehicleRel(this, 4, 4, 5, EV_BREAKDOWN_SMOKE);
 
					if (u != NULL) u->animation_state = this->breakdown_delay * 2;
 
				}
 
			}
 

	
 
			this->MarkDirty(); // Update graphics after speed is zeroed
 
			SetWindowDirty(WC_VEHICLE_VIEW, this->index);
 
			SetWindowDirty(WC_VEHICLE_DETAILS, this->index);
 

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

	
 
			/* For trains this function is called twice per tick, so decrease v->breakdown_delay at half the rate */
0 comments (0 inline, 0 general)