File diff r10531:c98697a29661 → r10532:23a12232250b
src/clear_cmd.cpp
Show inline comments
 
@@ -265,99 +265,100 @@ static void TileLoop_Clear(TileIndex til
 

	
 
		default:
 
			return;
 
	}
 

	
 
	MarkTileDirtyByTile(tile);
 
}
 

	
 
void GenerateClearTile()
 
{
 
	uint i, gi;
 
	TileIndex tile;
 

	
 
	/* add rough tiles */
 
	i = ScaleByMapSize(GB(Random(), 0, 10) + 0x400);
 
	gi = ScaleByMapSize(GB(Random(), 0, 7) + 0x80);
 

	
 
	SetGeneratingWorldProgress(GWP_ROUGH_ROCKY, gi + i);
 
	do {
 
		IncreaseGeneratingWorldProgress(GWP_ROUGH_ROCKY);
 
		tile = RandomTile();
 
		if (IsTileType(tile, MP_CLEAR) && !IsClearGround(tile, CLEAR_DESERT)) SetClearGroundDensity(tile, CLEAR_ROUGH, 3);
 
	} while (--i);
 

	
 
	/* add rocky tiles */
 
	i = gi;
 
	do {
 
		uint32 r = Random();
 
		tile = RandomTileSeed(r);
 

	
 
		IncreaseGeneratingWorldProgress(GWP_ROUGH_ROCKY);
 
		if (IsTileType(tile, MP_CLEAR) && !IsClearGround(tile, CLEAR_DESERT)) {
 
			uint j = GB(r, 16, 4) + 5;
 
			for (;;) {
 
				TileIndex tile_new;
 

	
 
				SetClearGroundDensity(tile, CLEAR_ROCKS, 3);
 
				do {
 
					if (--j == 0) goto get_out;
 
					tile_new = tile + TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
 
				} while (!IsTileType(tile_new, MP_CLEAR) || IsClearGround(tile_new, CLEAR_DESERT));
 
				tile = tile_new;
 
			}
 
get_out:;
 
		}
 
	} while (--i);
 
}
 

	
 
static void ClickTile_Clear(TileIndex tile)
 
static bool ClickTile_Clear(TileIndex tile)
 
{
 
	/* not used */
 
	return false;
 
}
 

	
 
static TrackStatus GetTileTrackStatus_Clear(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
 
{
 
	return 0;
 
}
 

	
 
static const StringID _clear_land_str[] = {
 
	STR_080D_GRASS,
 
	STR_080B_ROUGH_LAND,
 
	STR_080A_ROCKS,
 
	STR_080E_FIELDS,
 
	STR_080F_SNOW_COVERED_LAND,
 
	STR_0810_DESERT
 
};
 

	
 
static void GetTileDesc_Clear(TileIndex tile, TileDesc *td)
 
{
 
	if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) == 0) {
 
		td->str = STR_080C_BARE_LAND;
 
	} else {
 
		td->str = _clear_land_str[GetClearGround(tile)];
 
	}
 
	td->owner[0] = GetTileOwner(tile);
 
}
 

	
 
static void ChangeTileOwner_Clear(TileIndex tile, Owner old_owner, Owner new_owner)
 
{
 
	return;
 
}
 

	
 
void InitializeClearLand()
 
{
 
	_settings_game.game_creation.snow_line = _settings_game.game_creation.snow_line_height * TILE_HEIGHT;
 
}
 

	
 
static CommandCost TerraformTile_Clear(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 
{
 
	return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
}
 

	
 
extern const TileTypeProcs _tile_type_clear_procs = {
 
	DrawTile_Clear,           ///< draw_tile_proc
 
	GetSlopeZ_Clear,          ///< get_slope_z_proc
 
	ClearTile_Clear,          ///< clear_tile_proc
 
	GetAcceptedCargo_Clear,   ///< get_accepted_cargo_proc
 
	GetTileDesc_Clear,        ///< get_tile_desc_proc
 
	GetTileTrackStatus_Clear, ///< get_tile_track_status_proc