(svn r3223) -Fix: [autoreplace] fixed crash when replacing a train engine without any cars (introduced in r3220)
This commit is contained in:
		@@ -1655,7 +1655,9 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags)
 | 
				
			|||||||
			new_v->current_order = old_v->current_order;
 | 
								new_v->current_order = old_v->current_order;
 | 
				
			||||||
			if (old_v->type == VEH_Train){
 | 
								if (old_v->type == VEH_Train){
 | 
				
			||||||
				// move the entire train to the new engine, including the old engine. It will be sold in a moment anyway
 | 
									// move the entire train to the new engine, including the old engine. It will be sold in a moment anyway
 | 
				
			||||||
 | 
									if (GetNextVehicle(old_v) != NULL) {
 | 
				
			||||||
					DoCommand(0, 0, (new_v->index << 16) | GetNextVehicle(old_v)->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
 | 
										DoCommand(0, 0, (new_v->index << 16) | GetNextVehicle(old_v)->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				new_v->u.rail.shortest_platform[0] = old_v->u.rail.shortest_platform[0];
 | 
									new_v->u.rail.shortest_platform[0] = old_v->u.rail.shortest_platform[0];
 | 
				
			||||||
				new_v->u.rail.shortest_platform[1] = old_v->u.rail.shortest_platform[1];
 | 
									new_v->u.rail.shortest_platform[1] = old_v->u.rail.shortest_platform[1];
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user