mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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.
This commit is contained in:
parent
81c66d6efb
commit
f46509d5e2
29 changed files with 14 additions and 440 deletions
63
src/map.cpp
63
src/map.cpp
|
@ -62,8 +62,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
Map
|
||||
*/
|
||||
|
||||
Map::Map(std::ostream &dout, IGameDef *gamedef):
|
||||
m_dout(dout),
|
||||
Map::Map(IGameDef *gamedef):
|
||||
m_gamedef(gamedef),
|
||||
m_nodedef(gamedef->ndef())
|
||||
{
|
||||
|
@ -1201,7 +1200,7 @@ bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes)
|
|||
*/
|
||||
ServerMap::ServerMap(const std::string &savedir, IGameDef *gamedef,
|
||||
EmergeManager *emerge, MetricsBackend *mb):
|
||||
Map(dout_server, gamedef),
|
||||
Map(gamedef),
|
||||
settings_mgr(g_settings, savedir + DIR_DELIM + "map_meta.txt"),
|
||||
m_emerge(emerge)
|
||||
{
|
||||
|
@ -1327,11 +1326,6 @@ u64 ServerMap::getSeed()
|
|||
return getMapgenParams()->seed;
|
||||
}
|
||||
|
||||
s16 ServerMap::getWaterLevel()
|
||||
{
|
||||
return getMapgenParams()->water_level;
|
||||
}
|
||||
|
||||
bool ServerMap::blockpos_over_mapgen_limit(v3s16 p)
|
||||
{
|
||||
const s16 mapgen_limit_bp = rangelim(
|
||||
|
@ -1732,59 +1726,6 @@ void ServerMap::updateVManip(v3s16 pos)
|
|||
vm->m_is_dirty = true;
|
||||
}
|
||||
|
||||
s16 ServerMap::findGroundLevel(v2s16 p2d)
|
||||
{
|
||||
#if 0
|
||||
/*
|
||||
Uh, just do something random...
|
||||
*/
|
||||
// Find existing map from top to down
|
||||
s16 max=63;
|
||||
s16 min=-64;
|
||||
v3s16 p(p2d.X, max, p2d.Y);
|
||||
for(; p.Y>min; p.Y--)
|
||||
{
|
||||
MapNode n = getNodeNoEx(p);
|
||||
if(n.getContent() != CONTENT_IGNORE)
|
||||
break;
|
||||
}
|
||||
if(p.Y == min)
|
||||
goto plan_b;
|
||||
// If this node is not air, go to plan b
|
||||
if(getNodeNoEx(p).getContent() != CONTENT_AIR)
|
||||
goto plan_b;
|
||||
// Search existing walkable and return it
|
||||
for(; p.Y>min; p.Y--)
|
||||
{
|
||||
MapNode n = getNodeNoEx(p);
|
||||
if(content_walkable(n.d) && n.getContent() != CONTENT_IGNORE)
|
||||
return p.Y;
|
||||
}
|
||||
|
||||
// Move to plan b
|
||||
plan_b:
|
||||
#endif
|
||||
|
||||
/*
|
||||
Determine from map generator noise functions
|
||||
*/
|
||||
|
||||
s16 level = m_emerge->getGroundLevelAtPoint(p2d);
|
||||
return level;
|
||||
|
||||
//double level = base_rock_level_2d(m_seed, p2d) + AVERAGE_MUD_AMOUNT;
|
||||
//return (s16)level;
|
||||
}
|
||||
|
||||
void ServerMap::createDirs(const std::string &path)
|
||||
{
|
||||
if (!fs::CreateAllDirs(path)) {
|
||||
m_dout<<"ServerMap: Failed to create directory "
|
||||
<<"\""<<path<<"\""<<std::endl;
|
||||
throw BaseException("ServerMap failed to create directory");
|
||||
}
|
||||
}
|
||||
|
||||
void ServerMap::save(ModifiedState save_level)
|
||||
{
|
||||
if (!m_map_saving_enabled) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue