src/newgrf_engine.cpp
changeset 7353 716c6dd9322a
parent 7318 9fa3dc1d39ca
child 7408 d5ba4fd845dd
equal deleted inserted replaced
7352:e2e8432018f6 7353:716c6dd9322a
   505 
   505 
   506 	/* Calculated vehicle parameters */
   506 	/* Calculated vehicle parameters */
   507 	switch (variable) {
   507 	switch (variable) {
   508 		case 0x40: // Get length of consist
   508 		case 0x40: // Get length of consist
   509 		case 0x41: // Get length of same consecutive wagons
   509 		case 0x41: // Get length of same consecutive wagons
   510 			if (v->type != VEH_TRAIN) return 1;
   510 			if (!v->HasFront()) return 1;
   511 
   511 
   512 			{
   512 			{
   513 				const Vehicle* u;
   513 				const Vehicle* u;
   514 				byte chain_before = 0;
   514 				byte chain_before = 0;
   515 				byte chain_after  = 0;
   515 				byte chain_after  = 0;
   828 	res->SetTriggers   = &VehicleSetTriggers;
   828 	res->SetTriggers   = &VehicleSetTriggers;
   829 	res->GetVariable   = &VehicleGetVariable;
   829 	res->GetVariable   = &VehicleGetVariable;
   830 	res->ResolveReal   = &VehicleResolveReal;
   830 	res->ResolveReal   = &VehicleResolveReal;
   831 
   831 
   832 	res->u.vehicle.self   = v;
   832 	res->u.vehicle.self   = v;
   833 	res->u.vehicle.parent = (v != NULL && v->type == VEH_TRAIN) ? GetFirstVehicleInChain(v) : v;
   833 	res->u.vehicle.parent = (v != NULL && v->HasFront()) ? GetFirstVehicleInChain(v) : v;
   834 
   834 
   835 	res->u.vehicle.self_type = engine_type;
   835 	res->u.vehicle.self_type = engine_type;
   836 
   836 
   837 	res->info_view = false;
   837 	res->info_view = false;
   838 
   838