src/train_cmd.cpp
changeset 9191 ae14770c829a
parent 9163 79101c0c3bc9
child 9192 7e4b0b777375
equal deleted inserted replaced
9190:6aacd72e0d05 9191:ae14770c829a
  1212 
  1212 
  1213 			/* link in the wagon(s) in the chain. */
  1213 			/* link in the wagon(s) in the chain. */
  1214 			{
  1214 			{
  1215 				Vehicle *v;
  1215 				Vehicle *v;
  1216 
  1216 
  1217 				for (v = src; GetNextVehicle(v) != NULL; v = GetNextVehicle(v));
  1217 				for (v = src; GetNextVehicle(v) != NULL; v = GetNextVehicle(v)) {}
  1218 				GetLastEnginePart(v)->SetNext(dst->Next());
  1218 				GetLastEnginePart(v)->SetNext(dst->Next());
  1219 			}
  1219 			}
  1220 			dst->SetNext(src);
  1220 			dst->SetNext(src);
  1221 		}
  1221 		}
  1222 
  1222 
  3743 						SetTrainEngine(u);
  3743 						SetTrainEngine(u);
  3744 						u->spritenum--;
  3744 						u->spritenum--;
  3745 					}
  3745 					}
  3746 
  3746 
  3747 					Vehicle *w;
  3747 					Vehicle *w;
  3748 					for (w = u->Next(); w != NULL && (w->engine_type != u->engine_type || w->u.rail.other_multiheaded_part != NULL); w = GetNextVehicle(w));
  3748 					for (w = u->Next(); w != NULL && (w->engine_type != u->engine_type || w->u.rail.other_multiheaded_part != NULL); w = GetNextVehicle(w)) {}
  3749 					if (w != NULL) {
  3749 					if (w != NULL) {
  3750 						/* we found a car to partner with this engine. Now we will make sure it face the right way */
  3750 						/* we found a car to partner with this engine. Now we will make sure it face the right way */
  3751 						if (IsTrainEngine(w)) {
  3751 						if (IsTrainEngine(w)) {
  3752 							ClearTrainEngine(w);
  3752 							ClearTrainEngine(w);
  3753 							w->spritenum++;
  3753 							w->spritenum++;