clear_cmd.c
changeset 3422 a6eba3443452
parent 3418 ec9003ebf933
child 3447 1c62c085638a
equal deleted inserted replaced
3421:7968a4b5ff0a 3422:a6eba3443452
   575 static void TileLoopClearAlps(TileIndex tile)
   575 static void TileLoopClearAlps(TileIndex tile)
   576 {
   576 {
   577 	/* distance from snow line, in steps of 8 */
   577 	/* distance from snow line, in steps of 8 */
   578 	int k = GetTileZ(tile) - _opt.snow_line;
   578 	int k = GetTileZ(tile) - _opt.snow_line;
   579 
   579 
   580 	if (k < -8) { // well below the snow line
   580 	if (k < -TILE_HEIGHT) { // well below the snow line
   581 		if (!IsClearGround(tile, CL_SNOW)) return;
   581 		if (!IsClearGround(tile, CL_SNOW)) return;
   582 		if (GetClearDensity(tile) == 0) SetClearGroundDensity(tile, CL_GRASS, 3);
   582 		if (GetClearDensity(tile) == 0) SetClearGroundDensity(tile, CL_GRASS, 3);
   583 	} else {
   583 	} else {
   584 		if (!IsClearGround(tile, CL_SNOW)) {
   584 		if (!IsClearGround(tile, CL_SNOW)) {
   585 			SetClearGroundDensity(tile, CL_SNOW, 0);
   585 			SetClearGroundDensity(tile, CL_SNOW, 0);
   586 		} else {
   586 		} else {
   587 			uint density = min((uint)(k + 8) / 8, 3);
   587 			uint density = min((uint)(k + TILE_HEIGHT) / TILE_HEIGHT, 3);
   588 
   588 
   589 			if (GetClearDensity(tile) < density) {
   589 			if (GetClearDensity(tile) < density) {
   590 				AddClearDensity(tile, 1);
   590 				AddClearDensity(tile, 1);
   591 			} else if (GetClearDensity(tile) > density) {
   591 			} else if (GetClearDensity(tile) > density) {
   592 				AddClearDensity(tile, -1);
   592 				AddClearDensity(tile, -1);
   736 	return;
   736 	return;
   737 }
   737 }
   738 
   738 
   739 void InitializeClearLand(void)
   739 void InitializeClearLand(void)
   740 {
   740 {
   741 	_opt.snow_line = _patches.snow_line_height * 8;
   741 	_opt.snow_line = _patches.snow_line_height * TILE_HEIGHT;
   742 }
   742 }
   743 
   743 
   744 const TileTypeProcs _tile_type_clear_procs = {
   744 const TileTypeProcs _tile_type_clear_procs = {
   745 	DrawTile_Clear,						/* draw_tile_proc */
   745 	DrawTile_Clear,						/* draw_tile_proc */
   746 	GetSlopeZ_Clear,					/* get_slope_z_proc */
   746 	GetSlopeZ_Clear,					/* get_slope_z_proc */