]> git.lizzy.rs Git - minetest.git/commitdiff
Remove unused functions reported by cppcheck (#10463)
authorSmallJoker <SmallJoker@users.noreply.github.com>
Mon, 5 Oct 2020 07:07:33 +0000 (09:07 +0200)
committerGitHub <noreply@github.com>
Mon, 5 Oct 2020 07:07:33 +0000 (09:07 +0200)
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.

29 files changed:
src/chat.cpp
src/chat.h
src/client/client.cpp
src/client/client.h
src/client/clientenvironment.cpp
src/client/clientmap.cpp
src/client/mapblock_mesh.cpp
src/client/mapblock_mesh.h
src/content/CMakeLists.txt
src/content/packages.cpp [deleted file]
src/content/packages.h [deleted file]
src/gui/guiChatConsole.cpp
src/gui/guiChatConsole.h
src/log.cpp
src/log.h
src/map.cpp
src/map.h
src/mapgen/mapgen.cpp
src/mapgen/mapgen.h
src/mapgen/mapgen_v6.cpp
src/mapgen/mapgen_v6.h
src/mapgen/treegen.cpp
src/mapgen/treegen.h
src/network/networkpacket.cpp
src/network/networkpacket.h
src/script/common/c_converter.cpp
src/script/common/c_converter.h
src/script/lua_api/l_mainmenu.cpp
src/unittest/test_map_settings_manager.cpp

index c3ed59804c0adbbb4f45a796a2aba1785bf0035b..2f65e68b35b7c9d7459274e2337ddd58b74c3240 100644 (file)
@@ -123,14 +123,14 @@ void ChatBuffer::deleteByAge(f32 maxAge)
        deleteOldest(count);
 }
 
-u32 ChatBuffer::getColumns() const
+u32 ChatBuffer::getRows() const
 {
-       return m_cols;
+       return m_rows;
 }
 
-u32 ChatBuffer::getRows() const
+void ChatBuffer::scrollTop()
 {
-       return m_rows;
+       m_scroll = getTopScrollPos();
 }
 
 void ChatBuffer::reformat(u32 cols, u32 rows)
@@ -220,11 +220,6 @@ void ChatBuffer::scrollBottom()
        m_scroll = getBottomScrollPos();
 }
 
-void ChatBuffer::scrollTop()
-{
-       m_scroll = getTopScrollPos();
-}
-
 u32 ChatBuffer::formatChatLine(const ChatLine& line, u32 cols,
                std::vector<ChatFormattedLine>& destination) const
 {
index f84ece206c4fc0cb75adc236cf380c6653ae44d9..0b98e4d3c0507118b6485a70754998ad36ba128b 100644 (file)
@@ -94,8 +94,6 @@ class ChatBuffer
        // Delete lines older than maxAge.
        void deleteByAge(f32 maxAge);
 
-       // Get number of columns, 0 if reformat has not been called yet.
-       u32 getColumns() const;
        // Get number of rows, 0 if reformat has not been called yet.
        u32 getRows() const;
        // Update console size and reformat all formatted lines.
index 7fafe0da9471b2e13c59f1495bdbdff9ff21bc22..0bd98b256724110e22c111421aa71675c8560c67 100644 (file)
@@ -1665,11 +1665,6 @@ ClientEvent *Client::getClientEvent()
        return event;
 }
 
-bool Client::connectedToServer()
-{
-       return m_con->Connected();
-}
-
 const Address Client::getServerAddress()
 {
        return m_con->GetPeerAddress(PEER_ID_SERVER);
index 8f4aac6e3d0f2ad2035c207b1f0d461ce579e494..bffdc7ec6c856e897411c8f624029bce98e70160 100644 (file)
@@ -338,7 +338,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        u16 getProtoVersion()
        { return m_proto_ver; }
 
-       bool connectedToServer();
        void confirmRegistration();
        bool m_is_registration_confirmation_state = false;
        bool m_simple_singleplayer_mode;
index 0b7e92325b9c9bb4a5a4ab43a95d75bb15248e9b..f831978a88e534b96871e54ff6c74c08a8f08419 100644 (file)
@@ -368,21 +368,6 @@ bool isFreeClientActiveObjectId(const u16 id,
 
 }
 
-u16 getFreeClientActiveObjectId(ClientActiveObjectMap &objects)
-{
-       // try to reuse id's as late as possible
-       static u16 last_used_id = 0;
-       u16 startid = last_used_id;
-       for(;;) {
-               last_used_id ++;
-               if (isFreeClientActiveObjectId(last_used_id, objects))
-                       return last_used_id;
-
-               if (last_used_id == startid)
-                       return 0;
-       }
-}
-
 u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
 {
        // Register object. If failed return zero id
index 3e4ab2e94aefed7ebf7f048b16c8fac1bc66359c..3124313e72f0d23c242e9dde7b908ac6e9246178 100644 (file)
@@ -36,7 +36,7 @@ ClientMap::ClientMap(
                MapDrawControl &control,
                s32 id
 ):
-       Map(dout_client, client),
+       Map(client),
        scene::ISceneNode(RenderingEngine::get_scene_manager()->getRootSceneNode(),
                RenderingEngine::get_scene_manager(), id),
        m_client(client),
index b596795237a08f28d2dac6de344bfc7099fc4d92..f9332e39987a6923ebbed24e344b92aac925a394 100644 (file)
@@ -81,33 +81,6 @@ void MeshMakeData::fill(MapBlock *block)
        }
 }
 
-void MeshMakeData::fillSingleNode(MapNode *node)
-{
-       m_blockpos = v3s16(0,0,0);
-
-       v3s16 blockpos_nodes = v3s16(0,0,0);
-       VoxelArea area(blockpos_nodes-v3s16(1,1,1)*MAP_BLOCKSIZE,
-                       blockpos_nodes+v3s16(1,1,1)*MAP_BLOCKSIZE*2-v3s16(1,1,1));
-       s32 volume = area.getVolume();
-       s32 our_node_index = area.index(1,1,1);
-
-       // Allocate this block + neighbors
-       m_vmanip.clear();
-       m_vmanip.addArea(area);
-
-       // Fill in data
-       MapNode *data = new MapNode[volume];
-       for(s32 i = 0; i < volume; i++)
-       {
-               if (i == our_node_index)
-                       data[i] = *node;
-               else
-                       data[i] = MapNode(CONTENT_AIR, LIGHT_MAX, 0);
-       }
-       m_vmanip.copyFrom(data, area, area.MinEdge, area.MinEdge, area.getExtent());
-       delete[] data;
-}
-
 void MeshMakeData::setCrack(int crack_level, v3s16 crack_pos)
 {
        if (crack_level >= 0)
index 6af23a656fdd3e004abf3884ba4c4f6b193b7c25..f8aed40dcbc26a7465b0aa49d8817c1426350bb8 100644 (file)
@@ -62,11 +62,6 @@ struct MeshMakeData
        */
        void fill(MapBlock *block);
 
-       /*
-               Set up with only a single node at (1,1,1)
-       */
-       void fillSingleNode(MapNode *node);
-
        /*
                Set the (node) position of a crack
        */
index 5adcf6b1eef7046631e704a557abad15996359d1..6dd049418e2844301971cebb97b55806f585c40e 100644 (file)
@@ -1,6 +1,5 @@
 set(content_SRCS
        ${CMAKE_CURRENT_SOURCE_DIR}/content.cpp
-       ${CMAKE_CURRENT_SOURCE_DIR}/packages.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/mods.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/subgames.cpp
        PARENT_SCOPE
diff --git a/src/content/packages.cpp b/src/content/packages.cpp
deleted file mode 100644 (file)
index 2d488eb..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-Minetest
-Copyright (C) 2018 rubenwardy <rw@rubenwardy.com>
-
-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
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#include "content/packages.h"
-#include "log.h"
-#include "filesys.h"
-#include "porting.h"
-#include "settings.h"
-#include "content/mods.h"
-#include "content/subgames.h"
-
-std::string Package::getDownloadURL(const std::string &baseURL) const
-{
-       return baseURL + "/packages/" + author + "/" + name + "/releases/" +
-              std::to_string(release) + "/download/";
-}
-
-#if USE_CURL
-std::vector<Package> getPackagesFromURL(const std::string &url)
-{
-       std::vector<std::string> extra_headers;
-       extra_headers.emplace_back("Accept: application/json");
-
-       Json::Value json = fetchJsonValue(url, &extra_headers);
-       if (!json.isArray()) {
-               errorstream << "Invalid JSON download " << std::endl;
-               return std::vector<Package>();
-       }
-
-       std::vector<Package> packages;
-
-       // Note: `unsigned int` is required to index JSON
-       for (unsigned int i = 0; i < json.size(); ++i) {
-               Package package;
-
-               package.author = json[i]["author"].asString();
-               package.name = json[i]["name"].asString();
-               package.title = json[i]["title"].asString();
-               package.type = json[i]["type"].asString();
-               package.shortDesc = json[i]["shortDesc"].asString();
-               package.release = json[i]["release"].asInt();
-               if (json[i].isMember("thumbnail"))
-                       package.thumbnail = json[i]["thumbnail"].asString();
-
-               if (package.valid())
-                       packages.push_back(package);
-               else
-                       errorstream << "Invalid package at " << i << std::endl;
-       }
-
-       return packages;
-}
-#endif
diff --git a/src/content/packages.h b/src/content/packages.h
deleted file mode 100644 (file)
index 9029475..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Minetest
-Copyright (C) 2018 rubenwardy <rw@rubenwardy.com>
-
-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
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#pragma once
-#include "config.h"
-#include "convert_json.h"
-#include "irrlichttypes.h"
-
-struct Package
-{
-       std::string author;
-       std::string name; // Technical name
-       std::string title;
-       std::string type; // One of "mod", "game", or "txp"
-
-       std::string shortDesc;
-       u32 release;
-       std::string thumbnail;
-
-       bool valid() const
-       {
-               return !(author.empty() || name.empty() || title.empty() ||
-                               type.empty() || release <= 0);
-       }
-
-       std::string getDownloadURL(const std::string &baseURL) const;
-};
-
-#if USE_CURL
-std::vector<Package> getPackagesFromURL(const std::string &url);
-#else
-inline std::vector<Package> getPackagesFromURL(const std::string &url)
-{
-       return std::vector<Package>();
-}
-#endif
index 575c6ab25221af80d2ad00650d0ca99eeacbdf50..ef471106d90d95f002e424cb20f7ccb40431e7b9 100644 (file)
@@ -136,11 +136,6 @@ void GUIChatConsole::closeConsoleAtOnce()
        recalculateConsolePosition();
 }
 
-f32 GUIChatConsole::getDesiredHeight() const
-{
-       return m_desired_height_fraction;
-}
-
 void GUIChatConsole::replaceAndAddToHistory(const std::wstring &line)
 {
        ChatPrompt& prompt = m_chat_backend->getPrompt();
index 7be40e27c1472d0a9a488b1c974c80db6811a6f6..204f9f9cc207731c6f76d83dc8a6d62820ad430e 100644 (file)
@@ -55,10 +55,6 @@ class GUIChatConsole : public gui::IGUIElement
        // Set whether to close the console after the user presses enter.
        void setCloseOnEnter(bool close) { m_close_on_enter = close; }
 
-       // Return the desired height (fraction of screen size)
-       // Zero if the console is closed or getting closed
-       f32 getDesiredHeight() const;
-
        // Replace actual line when adding the actual to the history (if there is any)
        void replaceAndAddToHistory(const std::wstring &line);
 
index 54442c39b1669561a5fa9b6a686395d9416d4c0a..3c61414e901c57e1626104d3c0e0df55b79be347 100644 (file)
@@ -97,16 +97,7 @@ LogBuffer verbose_buf(g_logger, LL_VERBOSE);
 std::ostream *dout_con_ptr = &null_stream;
 std::ostream *derr_con_ptr = &verbosestream;
 
-// Server
-std::ostream *dout_server_ptr = &infostream;
-std::ostream *derr_server_ptr = &errorstream;
-
-#ifndef SERVER
-// Client
-std::ostream *dout_client_ptr = &infostream;
-std::ostream *derr_client_ptr = &errorstream;
-#endif
-
+// Common streams
 std::ostream rawstream(&raw_buf);
 std::ostream dstream(&none_buf);
 std::ostream errorstream(&error_buf);
index 856d3479b94d44cfd8187591440ee859ca0b5520..6ed6b1fb710b272ae66a8e81614850cdad14ba63 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -192,14 +192,8 @@ extern std::ostream null_stream;
 
 extern std::ostream *dout_con_ptr;
 extern std::ostream *derr_con_ptr;
-extern std::ostream *dout_server_ptr;
 extern std::ostream *derr_server_ptr;
 
-#ifndef SERVER
-extern std::ostream *dout_client_ptr;
-extern std::ostream *derr_client_ptr;
-#endif
-
 extern Logger g_logger;
 
 // Writes directly to all LL_NONE log outputs for g_logger with no prefix.
@@ -222,8 +216,4 @@ extern std::ostream dstream;
 
 #define dout_con (*dout_con_ptr)
 #define derr_con (*derr_con_ptr)
-#define dout_server (*dout_server_ptr)
 
-#ifndef SERVER
-       #define dout_client (*dout_client_ptr)
-#endif
index b9ab7c066cf750f3099f9a1278ba4dceed6befba..ef7eddb39ebd57f139dabe02c0f08f4c3c9821c6 100644 (file)
@@ -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) {
index 4d9847063066075eb575c8a6c929bfd80b63289c..b28f34db30c75d7103d9b9ec9899fc7781da3451 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -123,7 +123,7 @@ class Map /*: public NodeContainer*/
 {
 public:
 
-       Map(std::ostream &dout, IGameDef *gamedef);
+       Map(IGameDef *gamedef);
        virtual ~Map();
        DISABLE_CLASS_COPY(Map);
 
@@ -149,8 +149,6 @@ class Map /*: public NodeContainer*/
        MapSector * getSectorNoGenerateNoLock(v2s16 p2d);
        // Same as the above (there exists no lock anymore)
        MapSector * getSectorNoGenerate(v2s16 p2d);
-       // Gets an existing sector or creates an empty one
-       //MapSector * getSectorCreate(v2s16 p2d);
 
        /*
                This is overloaded by ClientMap and ServerMap to allow
@@ -268,11 +266,6 @@ class Map /*: public NodeContainer*/
        void setNodeTimer(const NodeTimer &t);
        void removeNodeTimer(v3s16 p);
 
-       /*
-               Misc.
-       */
-       std::map<v2s16, MapSector*> *getSectorsPtr(){return &m_sectors;}
-
        /*
                Variables
        */
@@ -283,8 +276,6 @@ class Map /*: public NodeContainer*/
 protected:
        friend class LuaVoxelManip;
 
-       std::ostream &m_dout; // A bit deprecated, could be removed
-
        IGameDef *m_gamedef;
 
        std::set<MapEventReceiver*> m_event_receivers;
@@ -374,15 +365,6 @@ class ServerMap : public Map
        */
        MapBlock *getBlockOrEmerge(v3s16 p3d);
 
-       // Helper for placing objects on ground level
-       s16 findGroundLevel(v2s16 p2d);
-
-       /*
-               Misc. helper functions for fiddling with directory and file
-               names when saving
-       */
-       void createDirs(const std::string &path);
-
        /*
                Database functions
        */
@@ -414,7 +396,6 @@ class ServerMap : public Map
        bool isSavingEnabled(){ return m_map_saving_enabled; }
 
        u64 getSeed();
-       s16 getWaterLevel();
 
        /*!
         * Fixes lighting in one map block.
index 52ef64e7e41166f22719ef258a58c2abcf957307..e0dfd2d71f9c8a0380c4676ca3093f53319ecbd7 100644 (file)
@@ -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)))
index 0f2977c4cfa4d2e9e65ab4f241722b6b790b5586..1487731e20bb46ef19de89c3efecfbd4bd3d9b3a 100644 (file)
@@ -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 @@ class Mapgen {
 
        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);
index 8bea5eb698a7ab086086453592456f91bc390117..90a52e0316f631394d6b5d1dbce83e30e85809f0 100644 (file)
@@ -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;
index ff565edecdb87178d1bec0e81acbf24be03b2504..a6e6da8c6ea8acdcb2b2f4dd9ebf8b77af3fbce3 100644 (file)
@@ -150,7 +150,6 @@ class MapgenV6 : public Mapgen {
 
        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);
index e7e30c880ea284a76d0a40f698475c0d89b44dd1..e633d800a3713001d68289fd7d487574abd0b2ba 100644 (file)
@@ -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));
index 447baabb3758484a41e6540eb7cfe89ceb445931..59a418824128f1a958f29e6fd43cbdb772e90d9e 100644 (file)
@@ -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,
index 4d531b6114d5c0e482e172e4985ddff9aa2bf897..6d0abb12cc94d4279c666428f21ac4105be0bc4e 100644 (file)
@@ -223,13 +223,6 @@ NetworkPacket& NetworkPacket::operator>>(char& dst)
        return *this;
 }
 
-char NetworkPacket::getChar(u32 offset)
-{
-       checkReadOffset(offset, 1);
-
-       return readU8(&m_data[offset]);
-}
-
 NetworkPacket& NetworkPacket::operator<<(char src)
 {
        checkDataSize(1);
index fc86176515b336ccd9aeb8d4ed7545e51b036b8b..e77bfb7447b5e6b5eab698f29e2f25d5ae1de6df 100644 (file)
@@ -64,7 +64,6 @@ class NetworkPacket
 
        std::string readLongString();
 
-       char getChar(u32 offset);
        NetworkPacket &operator>>(char &dst);
        NetworkPacket &operator<<(char src);
 
index eb6ab53319a7a15d2b807864938ebb18f30edf34..c00401b588325c7f75827679fd69d75cd005dcda 100644 (file)
@@ -679,48 +679,3 @@ size_t write_array_slice_float(
 
        return elem_index - 1;
 }
-
-
-size_t write_array_slice_u16(
-       lua_State *L,
-       int table_index,
-       u16 *data,
-       v3u16 data_size,
-       v3u16 slice_offset,
-       v3u16 slice_size)
-{
-       v3u16 pmin, pmax(data_size);
-
-       if (slice_offset.X > 0) {
-               slice_offset.X--;
-               pmin.X = slice_offset.X;
-               pmax.X = MYMIN(slice_offset.X + slice_size.X, data_size.X);
-       }
-
-       if (slice_offset.Y > 0) {
-               slice_offset.Y--;
-               pmin.Y = slice_offset.Y;
-               pmax.Y = MYMIN(slice_offset.Y + slice_size.Y, data_size.Y);
-       }
-
-       if (slice_offset.Z > 0) {
-               slice_offset.Z--;
-               pmin.Z = slice_offset.Z;
-               pmax.Z = MYMIN(slice_offset.Z + slice_size.Z, data_size.Z);
-       }
-
-       const u32 ystride = data_size.X;
-       const u32 zstride = data_size.X * data_size.Y;
-
-       u32 elem_index = 1;
-       for (u32 z = pmin.Z; z != pmax.Z; z++)
-       for (u32 y = pmin.Y; y != pmax.Y; y++)
-       for (u32 x = pmin.X; x != pmax.X; x++) {
-               u32 i = z * zstride + y * ystride + x;
-               lua_pushinteger(L, data[i]);
-               lua_rawseti(L, table_index, elem_index);
-               elem_index++;
-       }
-
-       return elem_index - 1;
-}
index a4a7079fd1e6a725bda0d2194db0f8b3403f3374..6ad6f32121ecfd7950d10ff1695042e86e3d56d7 100644 (file)
@@ -136,5 +136,3 @@ void                warn_if_field_exists(lua_State *L, int table,
 
 size_t write_array_slice_float(lua_State *L, int table_index, float *data,
        v3u16 data_size, v3u16 slice_offset, v3u16 slice_size);
-size_t write_array_slice_u16(lua_State *L, int table_index, u16 *data,
-       v3u16 data_size, v3u16 slice_offset, v3u16 slice_size);
index e49ec40525c885edb6e3d939b75e7d7dc5dfaf03..0aa2760e9ff0105cb9ddf1aed4ede54fb1e50f31 100644 (file)
@@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "porting.h"
 #include "filesys.h"
 #include "convert_json.h"
-#include "content/packages.h"
 #include "content/content.h"
 #include "content/subgames.h"
 #include "serverlist.h"
index 0a5c971b9488b01c7920ee0220035241718f384c..3d642a9b40c5106c62101854ac2def67827aeb41 100644 (file)
@@ -65,31 +65,6 @@ void check_noise_params(const NoiseParams *np1, const NoiseParams *np2)
 }
 
 
-std::string read_file_to_string(const std::string &filepath)
-{
-       std::string buf;
-       FILE *f = fopen(filepath.c_str(), "rb");
-       if (!f)
-               return "";
-
-       fseek(f, 0, SEEK_END);
-
-       long filesize = ftell(f);
-       if (filesize == -1) {
-               fclose(f);
-               return "";
-       }
-       rewind(f);
-
-       buf.resize(filesize);
-
-       UASSERTEQ(size_t, fread(&buf[0], 1, filesize, f), 1);
-
-       fclose(f);
-       return buf;
-}
-
-
 void TestMapSettingsManager::makeUserConfig(Settings *conf)
 {
        conf->set("mg_name", "v7");
@@ -199,7 +174,8 @@ void TestMapSettingsManager::testMapSettingsManager()
        };
 
        SHA1 ctx;
-       std::string metafile_contents = read_file_to_string(test_mapmeta_path);
+       std::string metafile_contents;
+       UASSERT(fs::ReadFile(test_mapmeta_path, metafile_contents));
        ctx.addBytes(&metafile_contents[0], metafile_contents.size());
        unsigned char *sha1_result = ctx.getDigest();
        int resultdiff = memcmp(sha1_result, expected_contents_hash, 20);