(svn r5468) -Fix: fixed declaration after statement added in 5465 (I wonder why the makefile failed to warn about this)
also removed a few lines of debug code
This commit is contained in:
		| @@ -1657,9 +1657,9 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags) | |||||||
| 	if (CmdFailed(cost)) return cost; | 	if (CmdFailed(cost)) return cost; | ||||||
|  |  | ||||||
| 	if (flags & DC_EXEC) { | 	if (flags & DC_EXEC) { | ||||||
|  | 		CargoID new_cargo_type = old_v->cargo_type; | ||||||
| 		new_v = GetVehicle(_new_vehicle_id); | 		new_v = GetVehicle(_new_vehicle_id); | ||||||
| 		*w = new_v;	//we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is | 		*w = new_v;	//we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is | ||||||
| 		CargoID new_cargo_type = old_v->cargo_type; |  | ||||||
|  |  | ||||||
| 		/* refit if needed */ | 		/* refit if needed */ | ||||||
| 		if (old_v->type == VEH_Train && old_v->cargo_cap == 0 && new_v->cargo_cap != 0) { | 		if (old_v->type == VEH_Train && old_v->cargo_cap == 0 && new_v->cargo_cap != 0) { | ||||||
| @@ -1667,16 +1667,13 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags) | |||||||
| 			// now we will figure out what cargo the train is carrying and refit to fit this | 			// now we will figure out what cargo the train is carrying and refit to fit this | ||||||
| 			Vehicle *v = old_v; | 			Vehicle *v = old_v; | ||||||
| 			CargoID cargo_type_buffer = new_v->cargo_type; | 			CargoID cargo_type_buffer = new_v->cargo_type; | ||||||
| 			printf("A: %d\n", cargo_type_buffer); |  | ||||||
| 			do { | 			do { | ||||||
| 				if (v->cargo_cap == 0) continue; | 				if (v->cargo_cap == 0) continue; | ||||||
| 				printf("B: %d\n", cargo_type_buffer); |  | ||||||
| 				if (v->cargo_type == new_v->cargo_type) { | 				if (v->cargo_type == new_v->cargo_type) { | ||||||
| 					// the default type is already being carried on the train. No need to refit | 					// the default type is already being carried on the train. No need to refit | ||||||
| 					cargo_type_buffer = new_v->cargo_type; | 					cargo_type_buffer = new_v->cargo_type; | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 				printf("C: %d\n", cargo_type_buffer); |  | ||||||
| 				// now we know that the vehicle is carrying cargo and that it's not the same as | 				// now we know that the vehicle is carrying cargo and that it's not the same as | ||||||
| 				cargo_type_buffer = v->cargo_type; | 				cargo_type_buffer = v->cargo_type; | ||||||
| 			} while ((v=v->next) != NULL); | 			} while ((v=v->next) != NULL); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 bjarni
					bjarni