mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +00:00
Use appropriate sized type for VoxelArea extent
This commit is contained in:
parent
3c5e0d10fc
commit
8957739cdf
16 changed files with 62 additions and 47 deletions
|
@ -64,7 +64,7 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm,
|
|||
noise_cave1->perlinMap3D(nmin.X, nmin.Y - 1, nmin.Z);
|
||||
noise_cave2->perlinMap3D(nmin.X, nmin.Y - 1, nmin.Z);
|
||||
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 index2d = 0; // Biomemap index
|
||||
|
||||
for (s16 z = nmin.Z; z <= nmax.Z; z++)
|
||||
|
@ -230,7 +230,7 @@ bool CavernsNoise::generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax)
|
|||
|
||||
//// Place nodes
|
||||
bool near_cavern = false;
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 index2d = 0;
|
||||
|
||||
for (s16 z = nmin.Z; z <= nmax.Z; z++)
|
||||
|
|
|
@ -127,7 +127,7 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
|
|||
|
||||
void DungeonGen::makeDungeon(v3s16 start_padding)
|
||||
{
|
||||
const v3s16 &areasize = vm->m_area.getExtent();
|
||||
const v3s32 &areasize = vm->m_area.getExtent();
|
||||
v3s16 roomsize;
|
||||
v3s16 roomplace;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ u32 Mapgen::getBlockSeed2(v3s16 p, s32 seed)
|
|||
// Returns -MAX_MAP_GENERATION_LIMIT if not found
|
||||
s16 Mapgen::findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax)
|
||||
{
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 i = vm->m_area.index(p2d.X, ymax, p2d.Y);
|
||||
s16 y;
|
||||
|
||||
|
@ -258,7 +258,7 @@ s16 Mapgen::findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax)
|
|||
// Returns -MAX_MAP_GENERATION_LIMIT if not found or if ground is found first
|
||||
s16 Mapgen::findLiquidSurface(v2s16 p2d, s16 ymin, s16 ymax)
|
||||
{
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 i = vm->m_area.index(p2d.X, ymax, p2d.Y);
|
||||
s16 y;
|
||||
|
||||
|
@ -296,7 +296,7 @@ void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax)
|
|||
void Mapgen::getSurfaces(v2s16 p2d, s16 ymin, s16 ymax,
|
||||
std::vector<s16> &floors, std::vector<s16> &ceilings)
|
||||
{
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
|
||||
bool is_walkable = false;
|
||||
u32 vi = vm->m_area.index(p2d.X, ymax, p2d.Y);
|
||||
|
@ -320,7 +320,7 @@ void Mapgen::getSurfaces(v2s16 p2d, s16 ymin, s16 ymax,
|
|||
}
|
||||
|
||||
|
||||
inline bool Mapgen::isLiquidHorizontallyFlowable(u32 vi, v3s16 em)
|
||||
inline bool Mapgen::isLiquidHorizontallyFlowable(u32 vi, v3s32 em)
|
||||
{
|
||||
u32 vi_neg_x = vi;
|
||||
VoxelArea::add_x(em, vi_neg_x, -1);
|
||||
|
@ -357,7 +357,7 @@ void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nm
|
|||
{
|
||||
bool isignored, isliquid, wasignored, wasliquid, waschecked, waspushed;
|
||||
content_t was_n;
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
|
||||
isignored = true;
|
||||
isliquid = false;
|
||||
|
@ -481,7 +481,7 @@ void Mapgen::propagateSunlight(v3s16 nmin, v3s16 nmax, bool propagate_shadow)
|
|||
//TimeTaker t("propagateSunlight");
|
||||
VoxelArea a(nmin, nmax);
|
||||
bool block_is_underground = (water_level >= nmax.Y);
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
|
||||
// NOTE: Direct access to the low 4 bits of param1 is okay here because,
|
||||
// by definition, sunlight will never be in the night lightbank.
|
||||
|
@ -629,7 +629,7 @@ void MapgenBasic::generateBiomes()
|
|||
assert(biomegen);
|
||||
assert(biomemap);
|
||||
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 index = 0;
|
||||
|
||||
noise_filler_depth->perlinMap2D(node_min.X, node_min.Z);
|
||||
|
@ -774,7 +774,7 @@ void MapgenBasic::dustTopNodes()
|
|||
if (node_max.Y < water_level)
|
||||
return;
|
||||
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 index = 0;
|
||||
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
|
|
|
@ -261,7 +261,7 @@ private:
|
|||
// isLiquidHorizontallyFlowable() is a helper function for updateLiquid()
|
||||
// that checks whether there are floodable nodes without liquid beneath
|
||||
// the node at index vi.
|
||||
inline bool isLiquidHorizontallyFlowable(u32 vi, v3s16 em);
|
||||
inline bool isLiquidHorizontallyFlowable(u32 vi, v3s32 em);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -445,7 +445,7 @@ int MapgenCarpathian::generateTerrain()
|
|||
noise_rivers->perlinMap2D(node_min.X, node_min.Z);
|
||||
|
||||
//// Place nodes
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
s16 stone_surface_max_y = -MAX_MAP_GENERATION_LIMIT;
|
||||
u32 index2d = 0;
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ s16 MapgenFlat::generateTerrain()
|
|||
MapNode n_stone(c_stone);
|
||||
MapNode n_water(c_water_source);
|
||||
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
s16 stone_surface_max_y = -MAX_MAP_GENERATION_LIMIT;
|
||||
u32 ni2d = 0;
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ void MapgenV6Params::setDefaultSettings(Settings *settings)
|
|||
// Returns Y one under area minimum if not found
|
||||
s16 MapgenV6::find_stone_level(v2s16 p2d)
|
||||
{
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
s16 y_nodes_max = vm->m_area.MaxEdge.Y;
|
||||
s16 y_nodes_min = vm->m_area.MinEdge.Y;
|
||||
u32 i = vm->m_area.index(p2d.X, y_nodes_max, p2d.Y);
|
||||
|
@ -670,7 +670,7 @@ int MapgenV6::generateGround()
|
|||
BiomeV6Type bt = getBiome(v2s16(x, z));
|
||||
|
||||
// Fill ground with stone
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 i = vm->m_area.index(x, node_min.Y, z);
|
||||
for (s16 y = node_min.Y; y <= node_max.Y; y++) {
|
||||
if (vm->m_data[i].getContent() == CONTENT_IGNORE) {
|
||||
|
@ -739,7 +739,7 @@ void MapgenV6::addMud()
|
|||
|
||||
// Add mud on ground
|
||||
s16 mudcount = 0;
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
s16 y_start = surface_y + 1;
|
||||
u32 i = vm->m_area.index(x, y_start, z);
|
||||
for (s16 y = y_start; y <= node_max.Y; y++) {
|
||||
|
@ -757,7 +757,7 @@ void MapgenV6::addMud()
|
|||
|
||||
void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos)
|
||||
{
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
static const v3s16 dirs4[4] = {
|
||||
v3s16(0, 0, 1), // Back
|
||||
v3s16(1, 0, 0), // Right
|
||||
|
@ -870,7 +870,7 @@ void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos)
|
|||
|
||||
|
||||
void MapgenV6::moveMud(u32 remove_index, u32 place_index,
|
||||
u32 above_remove_index, v2s16 pos, v3s16 em)
|
||||
u32 above_remove_index, v2s16 pos, v3s32 em)
|
||||
{
|
||||
MapNode n_air(CONTENT_AIR);
|
||||
// Copy mud from old place to new place
|
||||
|
@ -920,7 +920,7 @@ void MapgenV6::placeTreesAndJungleGrass()
|
|||
if (c_junglegrass == CONTENT_IGNORE)
|
||||
c_junglegrass = CONTENT_AIR;
|
||||
MapNode n_junglegrass(c_junglegrass);
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
|
||||
// Divide area into parts
|
||||
s16 div = 8;
|
||||
|
@ -1027,7 +1027,7 @@ void MapgenV6::growGrass() // Add surface nodes
|
|||
MapNode n_dirt_with_grass(c_dirt_with_grass);
|
||||
MapNode n_dirt_with_snow(c_dirt_with_snow);
|
||||
MapNode n_snowblock(c_snowblock);
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
|
||||
u32 index = 0;
|
||||
for (s16 z = full_node_min.Z; z <= full_node_max.Z; z++)
|
||||
|
|
|
@ -150,7 +150,7 @@ public:
|
|||
void addMud();
|
||||
void flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos);
|
||||
void moveMud(u32 remove_index, u32 place_index,
|
||||
u32 above_remove_index, v2s16 pos, v3s16 em);
|
||||
u32 above_remove_index, v2s16 pos, v3s32 em);
|
||||
void growGrass();
|
||||
void placeTreesAndJungleGrass();
|
||||
virtual void generateCaves(int max_stone_y);
|
||||
|
|
|
@ -523,7 +523,7 @@ int MapgenV7::generateTerrain()
|
|||
}
|
||||
|
||||
//// Place nodes
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
s16 stone_surface_max_y = -MAX_MAP_GENERATION_LIMIT;
|
||||
u32 index2d = 0;
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ int MapgenValleys::generateTerrain()
|
|||
|
||||
noise_inter_valley_fill->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z);
|
||||
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
s16 surface_max_y = -MAX_MAP_GENERATION_LIMIT;
|
||||
u32 index_2d = 0;
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ size_t DecoSimple::generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling)
|
|||
pr->range(deco_param2, deco_param2_max) : deco_param2;
|
||||
bool force_placement = (flags & DECO_FORCE_PLACEMENT);
|
||||
|
||||
const v3s16 &em = vm->m_area.getExtent();
|
||||
const v3s32 &em = vm->m_area.getExtent();
|
||||
u32 vi = vm->m_area.index(p);
|
||||
|
||||
if (ceiling) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue