From c28fbd06a8bfafc9691a92c90f0cf10ec94cd314 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 10 Apr 2020 02:43:49 +0200 Subject: Fix remaining issues with mapgen scriptapi --- src/mapgen/mg_biome.cpp | 3 ++- src/mapgen/mg_biome.h | 4 +++- src/mapgen/mg_schematic.cpp | 5 +++-- src/mapgen/mg_schematic.h | 5 +++-- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/mapgen') diff --git a/src/mapgen/mg_biome.cpp b/src/mapgen/mg_biome.cpp index f3bc4e829..8c59ac9e6 100644 --- a/src/mapgen/mg_biome.cpp +++ b/src/mapgen/mg_biome.cpp @@ -123,7 +123,8 @@ float BiomeManager::getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity // For BiomeGen type 'BiomeGenOriginal' -Biome *BiomeManager::getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos) const +const Biome *BiomeManager::getBiomeFromNoiseOriginal(float heat, + float humidity, v3s16 pos) const { Biome *biome_closest = nullptr; Biome *biome_closest_blend = nullptr; diff --git a/src/mapgen/mg_biome.h b/src/mapgen/mg_biome.h index 0a4471cc3..57f4aa20d 100644 --- a/src/mapgen/mg_biome.h +++ b/src/mapgen/mg_biome.h @@ -90,6 +90,7 @@ struct BiomeParams { s32 seed; }; +// WARNING: this class is not thread-safe class BiomeGen { public: virtual ~BiomeGen() = default; @@ -233,7 +234,8 @@ public: NoiseParams &np_heat_blend, u64 seed) const; float getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity, NoiseParams &np_humidity_blend, u64 seed) const; - Biome *getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos) const; + const Biome *getBiomeFromNoiseOriginal(float heat, float humidity, + v3s16 pos) const; private: BiomeManager() {}; diff --git a/src/mapgen/mg_schematic.cpp b/src/mapgen/mg_schematic.cpp index c3bd89f3a..ba102d997 100644 --- a/src/mapgen/mg_schematic.cpp +++ b/src/mapgen/mg_schematic.cpp @@ -359,7 +359,7 @@ bool Schematic::deserializeFromMts(std::istream *is, bool Schematic::serializeToMts(std::ostream *os, - const std::vector &names) + const std::vector &names) const { std::ostream &ss = *os; @@ -383,7 +383,8 @@ bool Schematic::serializeToMts(std::ostream *os, bool Schematic::serializeToLua(std::ostream *os, - const std::vector &names, bool use_comments, u32 indent_spaces) + const std::vector &names, bool use_comments, + u32 indent_spaces) const { std::ostream &ss = *os; diff --git a/src/mapgen/mg_schematic.h b/src/mapgen/mg_schematic.h index 3222085e6..6b31251b6 100644 --- a/src/mapgen/mg_schematic.h +++ b/src/mapgen/mg_schematic.h @@ -106,9 +106,10 @@ public: bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2); bool deserializeFromMts(std::istream *is, std::vector *names); - bool serializeToMts(std::ostream *os, const std::vector &names); + bool serializeToMts(std::ostream *os, + const std::vector &names) const; bool serializeToLua(std::ostream *os, const std::vector &names, - bool use_comments, u32 indent_spaces); + bool use_comments, u32 indent_spaces) const; void blitToVManip(MMVManip *vm, v3s16 p, Rotation rot, bool force_place); bool placeOnVManip(MMVManip *vm, v3s16 p, u32 flags, Rotation rot, bool force_place); -- cgit v1.2.3