summaryrefslogtreecommitdiff
path: root/src/mapgen
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2020-10-05 09:07:33 +0200
committerGitHub <noreply@github.com>2020-10-05 09:07:33 +0200
commitf46509d5e2c681b6da2abdeb27779be3c36a6916 (patch)
treedf654ae11cb73825e071e8222f37a73a1a604707 /src/mapgen
parent81c66d6efb9fb0ab8a03b40e2bc22aa49eff9a04 (diff)
downloadminetest-f46509d5e2c681b6da2abdeb27779be3c36a6916.tar.gz
minetest-f46509d5e2c681b6da2abdeb27779be3c36a6916.tar.bz2
minetest-f46509d5e2c681b6da2abdeb27779be3c36a6916.zip
Remove unused functions reported by cppcheck (#10463)
Run unused functions reported by cppcheck This change removes a few (but not all) unused functions. Some unused helper functions were not removed due to their complexity and potential of future use.
Diffstat (limited to 'src/mapgen')
-rw-r--r--src/mapgen/mapgen.cpp33
-rw-r--r--src/mapgen/mapgen.h7
-rw-r--r--src/mapgen/mapgen_v6.cpp6
-rw-r--r--src/mapgen/mapgen_v6.h1
-rw-r--r--src/mapgen/treegen.cpp13
-rw-r--r--src/mapgen/treegen.h2
6 files changed, 2 insertions, 60 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp
index 52ef64e7e..e0dfd2d71 100644
--- a/src/mapgen/mapgen.cpp
+++ b/src/mapgen/mapgen.cpp
@@ -244,26 +244,6 @@ u32 Mapgen::getBlockSeed2(v3s16 p, s32 seed)
}
-// Returns Y one under area minimum if not found
-s16 Mapgen::findGroundLevelFull(v2s16 p2d)
-{
- const v3s16 &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);
- s16 y;
-
- for (y = y_nodes_max; y >= y_nodes_min; y--) {
- MapNode &n = vm->m_data[i];
- if (ndef->get(n).walkable)
- break;
-
- VoxelArea::add_y(em, i, -1);
- }
- return (y >= y_nodes_min) ? y : y_nodes_min - 1;
-}
-
-
// Returns -MAX_MAP_GENERATION_LIMIT if not found
s16 Mapgen::findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax)
{
@@ -984,19 +964,6 @@ GenerateNotifier::GenerateNotifier(u32 notify_on,
}
-void GenerateNotifier::setNotifyOn(u32 notify_on)
-{
- m_notify_on = notify_on;
-}
-
-
-void GenerateNotifier::setNotifyOnDecoIds(
- const std::set<u32> *notify_on_deco_ids)
-{
- m_notify_on_deco_ids = notify_on_deco_ids;
-}
-
-
bool GenerateNotifier::addEvent(GenNotifyType type, v3s16 pos, u32 id)
{
if (!(m_notify_on & (1 << type)))
diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h
index 0f2977c4c..1487731e2 100644
--- a/src/mapgen/mapgen.h
+++ b/src/mapgen/mapgen.h
@@ -88,19 +88,17 @@ struct GenNotifyEvent {
class GenerateNotifier {
public:
+ // Use only for temporary Mapgen objects with no map generation!
GenerateNotifier() = default;
GenerateNotifier(u32 notify_on, const std::set<u32> *notify_on_deco_ids);
- void setNotifyOn(u32 notify_on);
- void setNotifyOnDecoIds(const std::set<u32> *notify_on_deco_ids);
-
bool addEvent(GenNotifyType type, v3s16 pos, u32 id=0);
void getEvents(std::map<std::string, std::vector<v3s16> > &event_map);
void clearEvents();
private:
u32 m_notify_on = 0;
- const std::set<u32> *m_notify_on_deco_ids;
+ const std::set<u32> *m_notify_on_deco_ids = nullptr;
std::list<GenNotifyEvent> m_notify_events;
};
@@ -186,7 +184,6 @@ public:
static u32 getBlockSeed(v3s16 p, s32 seed);
static u32 getBlockSeed2(v3s16 p, s32 seed);
- s16 findGroundLevelFull(v2s16 p2d);
s16 findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax);
s16 findLiquidSurface(v2s16 p2d, s16 ymin, s16 ymax);
void updateHeightmap(v3s16 nmin, v3s16 nmax);
diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp
index 8bea5eb69..90a52e031 100644
--- a/src/mapgen/mapgen_v6.cpp
+++ b/src/mapgen/mapgen_v6.cpp
@@ -341,12 +341,6 @@ float MapgenV6::baseTerrainLevelFromMap(int index)
}
-s16 MapgenV6::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision)
-{
- return baseTerrainLevelFromNoise(p2d) + MGV6_AVERAGE_MUD_AMOUNT;
-}
-
-
int MapgenV6::getGroundLevelAtPoint(v2s16 p)
{
return baseTerrainLevelFromNoise(p) + MGV6_AVERAGE_MUD_AMOUNT;
diff --git a/src/mapgen/mapgen_v6.h b/src/mapgen/mapgen_v6.h
index ff565edec..a6e6da8c6 100644
--- a/src/mapgen/mapgen_v6.h
+++ b/src/mapgen/mapgen_v6.h
@@ -150,7 +150,6 @@ public:
s16 find_stone_level(v2s16 p2d);
bool block_is_underground(u64 seed, v3s16 blockpos);
- s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
float getHumidity(v2s16 p);
float getTreeAmount(v2s16 p);
diff --git a/src/mapgen/treegen.cpp b/src/mapgen/treegen.cpp
index e7e30c880..e633d800a 100644
--- a/src/mapgen/treegen.cpp
+++ b/src/mapgen/treegen.cpp
@@ -527,19 +527,6 @@ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0,
}
-void tree_node_placement(MMVManip &vmanip, v3f p0, MapNode node)
-{
- v3s16 p1 = v3s16(myround(p0.X), myround(p0.Y), myround(p0.Z));
- if (!vmanip.m_area.contains(p1))
- return;
- u32 vi = vmanip.m_area.index(p1);
- if (vmanip.m_data[vi].getContent() != CONTENT_AIR
- && vmanip.m_data[vi].getContent() != CONTENT_IGNORE)
- return;
- vmanip.m_data[vmanip.m_area.index(p1)] = node;
-}
-
-
void tree_trunk_placement(MMVManip &vmanip, v3f p0, TreeDef &tree_definition)
{
v3s16 p1 = v3s16(myround(p0.X), myround(p0.Y), myround(p0.Z));
diff --git a/src/mapgen/treegen.h b/src/mapgen/treegen.h
index 447baabb3..59a418824 100644
--- a/src/mapgen/treegen.h
+++ b/src/mapgen/treegen.h
@@ -76,8 +76,6 @@ namespace treegen {
const NodeDefManager *ndef, const TreeDef &tree_definition);
// L-System tree gen helper functions
- void tree_node_placement(MMVManip &vmanip, v3f p0,
- MapNode node);
void tree_trunk_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition);
void tree_leaves_placement(MMVManip &vmanip, v3f p0,