Change biomemap data type from u8 to u16.
New technical (not practical) maximum is 65535 biomes.
Used by `minetest.register_biome`.
+The maximum number of biomes that can be used is 65535. However, using an
+excessive number of biomes will slow down map generation. Depending on desired
+performance and computing power the practical limit is much lower.
+
{
name = "tundra",
/*
Minetest
-Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2010-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
-Copyright (C) 2015-2018 paramat
+Copyright (C) 2010-2020 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2015-2020 paramat
+Copyright (C) 2010-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
void CavesNoiseIntersection::generateCaves(MMVManip *vm,
- v3s16 nmin, v3s16 nmax, u8 *biomemap)
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap)
{
assert(vm);
assert(biomemap);
/*
Minetest
-Copyright (C) 2010-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
-Copyright (C) 2015-2018 paramat
+Copyright (C) 2015-2020 paramat
+Copyright (C) 2010-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
#define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1
+typedef u16 biome_t; // copy from mg_biome.h to avoid an unnecessary include
+
class GenerateNotifier;
/*
NoiseParams *np_cave2, s32 seed, float cave_width);
~CavesNoiseIntersection();
- void generateCaves(MMVManip *vm, v3s16 nmin, v3s16 nmax, u8 *biomemap);
+ void generateCaves(MMVManip *vm, v3s16 nmin, v3s16 nmax, biome_t *biomemap);
private:
const NodeDefManager *m_ndef;
/*
Minetest
-Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2013-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
-Copyright (C) 2015-2018 paramat
+Copyright (C) 2010-2020 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2015-2020 paramat
+Copyright (C) 2013-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
#define MG_DECORATIONS 0x20
#define MG_BIOMES 0x40
-typedef u8 biome_t; // copy from mg_biome.h to avoid an unnecessary include
+typedef u16 biome_t; // copy from mg_biome.h to avoid an unnecessary include
class Settings;
class MMVManip;
/*
Minetest
-Copyright (C) 2014-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
-Copyright (C) 2014-2018 paramat
+Copyright (C) 2014-2020 paramat
+Copyright (C) 2014-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
//// Biome
////
-typedef u8 biome_t;
+typedef u16 biome_t;
#define BIOME_NONE ((biome_t)0)
// All-surfaces decorations
// Check biome of column
if (mg->biomemap && !biomes.empty()) {
- std::unordered_set<u8>::const_iterator iter =
- biomes.find(mg->biomemap[mapindex]);
+ auto iter = biomes.find(mg->biomemap[mapindex]);
if (iter == biomes.end())
continue;
}
continue;
if (mg->biomemap && !biomes.empty()) {
- std::unordered_set<u8>::const_iterator iter =
- biomes.find(mg->biomemap[mapindex]);
+ auto iter = biomes.find(mg->biomemap[mapindex]);
if (iter == biomes.end())
continue;
}
#include "noise.h"
#include "nodedef.h"
+typedef u16 biome_t; // copy from mg_biome.h to avoid an unnecessary include
+
class Mapgen;
class MMVManip;
class PcgRandom;
s16 nspawnby;
s16 place_offset_y = 0;
- std::unordered_set<u8> biomes;
+ std::unordered_set<biome_t> biomes;
protected:
void cloneTo(Decoration *def) const;
/*
Minetest
-Copyright (C) 2014-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
-Copyright (C) 2015-2018 paramat
+Copyright (C) 2015-2020 paramat
+Copyright (C) 2014-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
void OreScatter::generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap)
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap)
{
PcgRandom pr(blockseed);
MapNode n_ore(c_ore, 0, ore_param2);
if (biomemap && !biomes.empty()) {
u32 index = sizex * (z0 - nmin.Z) + (x0 - nmin.X);
- std::unordered_set<u8>::const_iterator it = biomes.find(biomemap[index]);
+ auto it = biomes.find(biomemap[index]);
if (it == biomes.end())
continue;
}
void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap)
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap)
{
PcgRandom pr(blockseed + 4234);
MapNode n_ore(c_ore, 0, ore_param2);
continue;
if (biomemap && !biomes.empty()) {
- std::unordered_set<u8>::const_iterator it = biomes.find(biomemap[index]);
+ auto it = biomes.find(biomemap[index]);
if (it == biomes.end())
continue;
}
void OrePuff::generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap)
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap)
{
PcgRandom pr(blockseed + 4234);
MapNode n_ore(c_ore, 0, ore_param2);
continue;
if (biomemap && !biomes.empty()) {
- std::unordered_set<u8>::const_iterator it = biomes.find(biomemap[index]);
+ auto it = biomes.find(biomemap[index]);
if (it == biomes.end())
continue;
}
void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap)
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap)
{
PcgRandom pr(blockseed + 2404);
MapNode n_ore(c_ore, 0, ore_param2);
if (biomemap && !biomes.empty()) {
u32 bmapidx = sizex * (z0 - nmin.Z) + (x0 - nmin.X);
- std::unordered_set<u8>::const_iterator it = biomes.find(biomemap[bmapidx]);
+ auto it = biomes.find(biomemap[bmapidx]);
if (it == biomes.end())
continue;
}
void OreVein::generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap)
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap)
{
PcgRandom pr(blockseed + 520);
MapNode n_ore(c_ore, 0, ore_param2);
if (biomemap && !biomes.empty()) {
u32 bmapidx = sizex * (z - nmin.Z) + (x - nmin.X);
- std::unordered_set<u8>::const_iterator it = biomes.find(biomemap[bmapidx]);
+ auto it = biomes.find(biomemap[bmapidx]);
if (it == biomes.end())
continue;
}
void OreStratum::generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap)
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap)
{
PcgRandom pr(blockseed + 4234);
MapNode n_ore(c_ore, 0, ore_param2);
for (int z = nmin.Z; z <= nmax.Z; z++)
for (int x = nmin.X; x <= nmax.X; x++, index++) {
if (biomemap && !biomes.empty()) {
- std::unordered_set<u8>::const_iterator it = biomes.find(biomemap[index]);
+ auto it = biomes.find(biomemap[index]);
if (it == biomes.end())
continue;
}
/*
Minetest
-Copyright (C) 2014-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
-Copyright (C) 2015-2018 paramat
+Copyright (C) 2015-2020 paramat
+Copyright (C) 2014-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
#include "noise.h"
#include "nodedef.h"
+typedef u16 biome_t; // copy from mg_biome.h to avoid an unnecessary include
+
class Noise;
class Mapgen;
class MMVManip;
float nthresh; // threshold for noise at which an ore is placed
NoiseParams np; // noise for distribution of clusters (NULL for uniform scattering)
Noise *noise = nullptr;
- std::unordered_set<u8> biomes;
+ std::unordered_set<biome_t> biomes;
Ore() = default;;
virtual ~Ore();
size_t placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap) = 0;
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap) = 0;
protected:
void cloneTo(Ore *def) const;
ObjDef *clone() const;
virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap);
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap);
};
class OreSheet : public Ore {
float column_midpoint_factor;
virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap);
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap);
};
class OrePuff : public Ore {
virtual ~OrePuff();
virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap);
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap);
};
class OreBlob : public Ore {
ObjDef *clone() const;
virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap);
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap);
};
class OreVein : public Ore {
virtual ~OreVein();
virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap);
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap);
};
class OreStratum : public Ore {
virtual ~OreStratum();
virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
- v3s16 nmin, v3s16 nmax, u8 *biomemap);
+ v3s16 nmin, v3s16 nmax, biome_t *biomemap);
};
class OreManager : public ObjDefManager {
BiomeManager *biomemgr);
Biome *read_biome_def(lua_State *L, int index, const NodeDefManager *ndef);
size_t get_biome_list(lua_State *L, int index,
- BiomeManager *biomemgr, std::unordered_set<u8> *biome_id_list);
+ BiomeManager *biomemgr, std::unordered_set<biome_t> *biome_id_list);
Schematic *get_or_load_schematic(lua_State *L, int index,
SchematicManager *schemmgr, StringMap *replace_names);
size_t get_biome_list(lua_State *L, int index,
- BiomeManager *biomemgr, std::unordered_set<u8> *biome_id_list)
+ BiomeManager *biomemgr, std::unordered_set<biome_t> *biome_id_list)
{
if (index < 0)
index = lua_gettop(L) + 1 + index;
#include "lua_api/l_base.h"
+typedef u16 biome_t; // copy from mg_biome.h to avoid an unnecessary include
+
class ModApiMapgen : public ModApiBase
{
private: