Changeset - r2994:fb86abee17d9
[Not reviewed]
master
0 1 0
peter1138 - 18 years ago 2006-02-07 18:57:16
peter1138@openttd.org
(svn r3571) - When loading a game, call TrainConsistChanged() for each train head separately before updating images, as v->first is used extensively in GetTrainImage() for custom graphics. This gives a significant speed improvement on loading a game.
1 file changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
vehicle.c
Show inline comments
 
@@ -218,6 +218,11 @@ void AfterLoadVehicles(void)
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		v->first = NULL;
 
		if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))
 
			TrainConsistChanged(v);
 
	}
 

	
 
	FOR_ALL_VEHICLES(v) {
 
		if (v->type != 0) {
 
			switch (v->type) {
 
				case VEH_Train: v->cur_image = GetTrainImage(v, v->direction); break;
 
@@ -234,9 +239,6 @@ void AfterLoadVehicles(void)
 

	
 
			v->left_coord = INVALID_COORD;
 
			VehiclePositionChanged(v);
 

	
 
			if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))
 
				TrainConsistChanged(v);
 
		}
 
	}
 
}
0 comments (0 inline, 0 general)