(svn r4440) - Fix: Yoyo-effect of rail in desert/snow introduced by r4379. When a special groundtype below the track is encountered in the tileloop, always return even if groundtype hasn't changed.
This commit is contained in:
		
							
								
								
									
										17
									
								
								rail_cmd.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								rail_cmd.c
									
									
									
									
									
								
							@@ -1737,26 +1737,31 @@ static void TileLoop_Track(TileIndex tile)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	RailGroundType old_ground = GetRailGroundType(tile);
 | 
						RailGroundType old_ground = GetRailGroundType(tile);
 | 
				
			||||||
	RailGroundType new_ground = old_ground;
 | 
						RailGroundType new_ground = old_ground;
 | 
				
			||||||
 | 
						bool quick_return = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (_opt.landscape) {
 | 
						switch (_opt.landscape) {
 | 
				
			||||||
		case LT_HILLY:
 | 
							case LT_HILLY:
 | 
				
			||||||
			if (GetTileZ(tile) > _opt.snow_line) new_ground = RAIL_GROUND_ICE_DESERT;
 | 
								if (GetTileZ(tile) > _opt.snow_line) {
 | 
				
			||||||
 | 
									new_ground = RAIL_GROUND_ICE_DESERT;
 | 
				
			||||||
 | 
									quick_return = true;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case LT_DESERT:
 | 
							case LT_DESERT:
 | 
				
			||||||
			if (GetTropicZone(tile) == TROPICZONE_DESERT) new_ground = RAIL_GROUND_ICE_DESERT;
 | 
								if (GetTropicZone(tile) == TROPICZONE_DESERT) {
 | 
				
			||||||
			break;
 | 
									new_ground = RAIL_GROUND_ICE_DESERT;
 | 
				
			||||||
 | 
									quick_return = true;
 | 
				
			||||||
		default:
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (new_ground != old_ground) {
 | 
						if (new_ground != old_ground) {
 | 
				
			||||||
		SetRailGroundType(tile, new_ground);
 | 
							SetRailGroundType(tile, new_ground);
 | 
				
			||||||
		MarkTileDirtyByTile(tile);
 | 
							MarkTileDirtyByTile(tile);
 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (quick_return) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Don't continue tile loop for depots
 | 
						// Don't continue tile loop for depots
 | 
				
			||||||
	if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) return;
 | 
						if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user