(svn r2113) -Fix: first check if a vehicle is a train, before accessing u.rail
This commit is contained in:
		
							
								
								
									
										10
									
								
								rail_cmd.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								rail_cmd.c
									
									
									
									
									
								
							@@ -1572,15 +1572,17 @@ static void *SignalVehicleCheckProc(Vehicle *v, void *data)
 | 
				
			|||||||
	SignalVehicleCheckStruct *dest = data;
 | 
						SignalVehicleCheckStruct *dest = data;
 | 
				
			||||||
	TileIndex tile;
 | 
						TileIndex tile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (v->type != VEH_Train)
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Find the tile outside the tunnel, for signalling */
 | 
						/* Find the tile outside the tunnel, for signalling */
 | 
				
			||||||
	if (v->u.rail.track == 0x40) {
 | 
						if (v->u.rail.track == 0x40)
 | 
				
			||||||
		tile = GetVehicleOutOfTunnelTile(v);
 | 
							tile = GetVehicleOutOfTunnelTile(v);
 | 
				
			||||||
	} else {
 | 
						else
 | 
				
			||||||
		tile = v->tile;
 | 
							tile = v->tile;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Wrong tile, or no train? Not a match */
 | 
						/* Wrong tile, or no train? Not a match */
 | 
				
			||||||
	if (tile != dest->tile || v->type != VEH_Train)
 | 
						if (tile != dest->tile)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Are we on the same piece of track? */
 | 
						/* Are we on the same piece of track? */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user