chore: update clang-format

Signed-off-by: szdytom <szdytom@qq.com>
This commit is contained in:
方而静 2025-08-03 11:34:24 +08:00
parent 45836dc897
commit 6a3f23f989
Signed by: szTom
GPG Key ID: 072D999D60C6473C
6 changed files with 35 additions and 33 deletions

View File

@ -7,7 +7,7 @@ AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignOperands: DontAlign
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2

View File

@ -1,8 +1,6 @@
#include "biome.h"
#include "chunk.h"
#include <algorithm>
#include <array>
#include <cmath>
namespace istd {

View File

@ -23,24 +23,26 @@ void BiomeGenerationPass::operator()(TileMap &tilemap) {
// Generate biomes for each sub-chunk
for (std::uint8_t chunk_x = 0; chunk_x < map_size; ++chunk_x) {
for (std::uint8_t chunk_y = 0; chunk_y < map_size; ++chunk_y) {
Chunk &chunk = tilemap.get_chunk(chunk_x, chunk_y);
auto &chunk = tilemap.get_chunk(chunk_x, chunk_y);
for (std::uint8_t sub_x = 0; sub_x < Chunk::subchunk_count;
++sub_x) {
for (std::uint8_t sub_y = 0; sub_y < Chunk::subchunk_count;
++sub_y) {
// Calculate global position for this sub-chunk's center
auto [start_x, start_y]
= subchunk_to_tile_start(SubChunkPos(sub_x, sub_y));
double global_x = chunk_x * Chunk::size + start_x
+ Chunk::subchunk_size / 2;
auto [start_x, start_y] = subchunk_to_tile_start(
{sub_x, sub_y}
);
double global_x = chunk_x * Chunk::size + start_x
+ (Chunk::subchunk_size >> 1);
double global_y = chunk_y * Chunk::size + start_y
+ Chunk::subchunk_size / 2;
+ (Chunk::subchunk_size >> 1);
// Get climate values
auto [temperature, humidity]
= get_climate(global_x, global_y);
auto [temperature, humidity] = get_climate(
global_x, global_y
);
// Determine biome and store directly in chunk
BiomeType biome = determine_biome(temperature, humidity);

View File

@ -21,8 +21,9 @@ void DeepwaterGenerationPass::operator()(TileMap &tilemap) {
++sub_y) {
SubChunkPos sub_pos(sub_x, sub_y);
BiomeType biome = chunk.get_biome(sub_pos);
const BiomeProperties &properties
= get_biome_properties(biome);
const BiomeProperties &properties = get_biome_properties(
biome
);
// Only process ocean biomes
if (!properties.is_ocean) {
@ -83,10 +84,10 @@ bool DeepwaterGenerationPass::is_surrounded_by_water(
dx <= static_cast<std::int32_t>(radius); ++dx) {
for (std::int32_t dy = -static_cast<std::int32_t>(radius);
dy <= static_cast<std::int32_t>(radius); ++dy) {
std::int32_t check_x
= static_cast<std::int32_t>(center_global_x) + dx;
std::int32_t check_y
= static_cast<std::int32_t>(center_global_y) + dy;
std::int32_t check_x = static_cast<std::int32_t>(center_global_x)
+ dx;
std::int32_t check_y = static_cast<std::int32_t>(center_global_y)
+ dy;
// Check bounds
if (check_x < 0 || check_y < 0

View File

@ -1,4 +1,5 @@
#include "generation.h"
#include <algorithm>
#include <queue>
namespace istd {
@ -44,13 +45,13 @@ void MountainHoleFillPass::operator()(TileMap &tilemap) {
);
// Check if this component touches the boundary
bool touches_boundary = false;
for (const auto component_pos : component_positions) {
if (tilemap.is_at_boundary(component_pos)) {
touches_boundary = true;
break;
}
}
auto boundary_checker =
[&tilemap](const TilePos &component_pos) {
return tilemap.is_at_boundary(component_pos);
};
bool touches_boundary = std::ranges::any_of(
component_positions, boundary_checker
);
// Fill small holes that don't touch the boundary
if (!touches_boundary

View File

@ -57,14 +57,14 @@ void SmoothenIslandPass::remove_small_island(TileMap &tilemap) {
tilemap, pos, visited, component_positions
);
// If the component touches the boundary, skip it
bool touches_boundary = false;
for (auto component_pos : component_positions) {
if (tilemap.is_at_boundary(component_pos)) {
touches_boundary = true;
break;
}
}
// Check if this component touches the boundary
auto boundary_checker =
[&tilemap](const TilePos &component_pos) {
return tilemap.is_at_boundary(component_pos);
};
bool touches_boundary = std::ranges::any_of(
component_positions, boundary_checker
);
// Skip if it touches the boundary
if (touches_boundary) {