fix: prevent GenerationConfig from being copied in TerrainGenerator

Signed-off-by: szdytom <szdytom@qq.com>
This commit is contained in:
方而静 2025-08-05 16:07:37 +08:00
parent b6b585b700
commit 95422cff7a
Signed by: szTom
GPG Key ID: 072D999D60C6473C
2 changed files with 3 additions and 2 deletions

View File

@ -70,7 +70,7 @@ struct GenerationConfig {
// Terrain generator class that manages the generation process // Terrain generator class that manages the generation process
class TerrainGenerator { class TerrainGenerator {
private: private:
GenerationConfig config_; const GenerationConfig &config_;
Xoroshiro128PP master_rng_; Xoroshiro128PP master_rng_;
public: public:

View File

@ -2,9 +2,10 @@
namespace istd { namespace istd {
TerrainGenerator::TerrainGenerator(const GenerationConfig &config) TerrainGenerator::TerrainGenerator(const GenerationConfig &config)
: config_(config), master_rng_(config.seed) {} : config_(config) {}
void TerrainGenerator::operator()(TileMap &tilemap) { void TerrainGenerator::operator()(TileMap &tilemap) {
master_rng_ = Xoroshiro128PP(config_.seed);
biome_pass(tilemap); biome_pass(tilemap);
base_tile_type_pass(tilemap); base_tile_type_pass(tilemap);
smoothen_mountains_pass(tilemap); smoothen_mountains_pass(tilemap);