]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Deal with compiler warnings
authorsfan5 <sfan5@live.de>
Thu, 28 Apr 2022 18:53:15 +0000 (20:53 +0200)
committersfan5 <sfan5@live.de>
Sat, 30 Apr 2022 14:49:41 +0000 (16:49 +0200)
12 files changed:
src/client/client.h
src/client/clientmap.h
src/client/content_cao.cpp
src/client/content_cao.h
src/client/game.cpp
src/client/minimap.cpp
src/client/shadows/dynamicshadowsrender.cpp
src/client/shadows/dynamicshadowsrender.h
src/database/database-postgresql.h
src/map.h
src/network/connection.h
src/network/socket.cpp

index 0e29fdbe205ec11230a8046cc46b179693820bda..cb1227768f9d8bc6f82e674bfad38066017bf648 100644 (file)
@@ -407,7 +407,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        }
 
        ClientScripting *getScript() { return m_script; }
-       const bool modsLoaded() const { return m_mods_loaded; }
+       bool modsLoaded() const { return m_mods_loaded; }
 
        void pushToEventQueue(ClientEvent *event);
 
index 7bd7af266ecfd7fa494df0abc715646833fb5a68..6d57f1911571c1471db23e775ce641df4357e83c 100644 (file)
@@ -81,9 +81,9 @@ class ClientMap : public Map, public scene::ISceneNode
                return false;
        }
 
-       void drop()
+       void drop() override
        {
-               ISceneNode::drop();
+               ISceneNode::drop(); // calls destructor
        }
 
        void updateCamera(v3f pos, v3f dir, f32 fov, v3s16 offset);
@@ -91,24 +91,22 @@ class ClientMap : public Map, public scene::ISceneNode
        /*
                Forcefully get a sector from somewhere
        */
-       MapSector * emergeSector(v2s16 p);
-
-       //void deSerializeSector(v2s16 p2d, std::istream &is);
+       MapSector * emergeSector(v2s16 p) override;
 
        /*
                ISceneNode methods
        */
 
-       virtual void OnRegisterSceneNode();
+       virtual void OnRegisterSceneNode() override;
 
-       virtual void render()
+       virtual void render() override
        {
                video::IVideoDriver* driver = SceneManager->getVideoDriver();
                driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
                renderMap(driver, SceneManager->getSceneNodeRenderPass());
        }
 
-       virtual const aabb3f &getBoundingBox() const
+       virtual const aabb3f &getBoundingBox() const override
        {
                return m_box;
        }
@@ -130,7 +128,7 @@ class ClientMap : public Map, public scene::ISceneNode
        void renderPostFx(CameraMode cam_mode);
 
        // For debug printing
-       virtual void PrintInfo(std::ostream &out);
+       void PrintInfo(std::ostream &out) override;
 
        const MapDrawControl & getControl() const { return m_control; }
        f32 getWantedRange() const { return m_control.wanted_range; }
index 3c31d4a3689e275e16119ee91e0aa9d8812cd774..d89bb53b31881a7123bd0328268f275dd50557b2 100644 (file)
@@ -435,7 +435,7 @@ const v3f GenericCAO::getPosition() const
        return m_position;
 }
 
-const bool GenericCAO::isImmortal()
+bool GenericCAO::isImmortal() const
 {
        return itemgroup_get(getGroups(), "immortal");
 }
index 70f1557e1812e39b7ce5e81a35deb14b1f816487..783aa41999b2c86d608ed42c32000a277eff5d7f 100644 (file)
@@ -172,7 +172,7 @@ class GenericCAO : public ClientActiveObject
 
        inline const v3f &getRotation() const { return m_rotation; }
 
-       const bool isImmortal();
+       bool isImmortal() const;
 
        inline const ObjectProperties &getProperties() const { return m_prop; }
 
index 1290534eb9ab4e0818170cebc6a94798cfd822b6..d21bdbe991b1a7576a62090339183f2f5ab3ca7a 100644 (file)
@@ -1063,9 +1063,9 @@ bool Game::startup(bool *kill,
 void Game::run()
 {
        ProfilerGraph graph;
-       RunStats stats              = { 0 };
-       CameraOrientation cam_view_target  = { 0 };
-       CameraOrientation cam_view  = { 0 };
+       RunStats stats;
+       CameraOrientation cam_view_target = {};
+       CameraOrientation cam_view = {};
        FpsControl draw_times;
        f32 dtime; // in seconds
 
index f26aa1c70ef07152b0d03bb8c492ccd98a099f97..320621d914cc41a5d9746a41a2088babb10b3440 100644 (file)
@@ -304,7 +304,7 @@ void Minimap::setModeIndex(size_t index)
                data->mode = m_modes[index];
                m_current_mode_index = index;
        } else {
-               data->mode = MinimapModeDef{MINIMAP_TYPE_OFF, gettext("Minimap hidden"), 0, 0, ""};
+               data->mode = {MINIMAP_TYPE_OFF, gettext("Minimap hidden"), 0, 0, "", 0};
                m_current_mode_index = 0;
        }
 
index a008c3e062d6e6a6180202da82fd0d4b3ee2dfc6..07dc6daf265595b6bcba690b9f976bf2c5d77687 100644 (file)
@@ -31,10 +31,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "profiler.h"
 
 ShadowRenderer::ShadowRenderer(IrrlichtDevice *device, Client *client) :
-               m_device(device), m_smgr(device->getSceneManager()),
-               m_driver(device->getVideoDriver()), m_client(client), m_current_frame(0),
+               m_smgr(device->getSceneManager()), m_driver(device->getVideoDriver()),
+               m_client(client), m_current_frame(0),
                m_perspective_bias_xy(0.8), m_perspective_bias_z(0.5)
 {
+       (void) m_client;
+
        m_shadows_supported = true; // assume shadows supported. We will check actual support in initialize
        m_shadows_enabled = true;
 
index bbeb254b0a435c0c5b9927ec112bfb2d13fb51f0..0e4ef6b70cd29ee220845531cf2a6644db2c0832 100644 (file)
@@ -109,7 +109,6 @@ class ShadowRenderer
        void enable() { m_shadows_enabled = m_shadows_supported; }
 
        // a bunch of variables
-       IrrlichtDevice *m_device{nullptr};
        scene::ISceneManager *m_smgr{nullptr};
        video::IVideoDriver *m_driver{nullptr};
        Client *m_client{nullptr};
index 81b4a2b10ac483055cee00e5528bd46d53f0dbe6..0a9ead01ea2d0c34461be59cf79fab128b1daf24 100644 (file)
@@ -94,7 +94,8 @@ class Database_PostgreSQL: public Database
                checkResults(PQprepare(m_conn, name.c_str(), sql.c_str(), 0, NULL));
        }
 
-       const int getPGVersion() const { return m_pgversion; }
+       int getPGVersion() const { return m_pgversion; }
+
 private:
        // Database connectivity checks
        void ping();
index 9dc7a101c57d39c01c4f49c1f6c1ad9c9b5d6348..d8ed291061f8f2167ec4541707a4b32a8baa7bff 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -327,7 +327,7 @@ class ServerMap : public Map
                - Create blank filled with CONTENT_IGNORE
 
        */
-       MapBlock *emergeBlock(v3s16 p, bool create_blank=true);
+       MapBlock *emergeBlock(v3s16 p, bool create_blank=true) override;
 
        /*
                Try to get a block.
@@ -349,27 +349,27 @@ class ServerMap : public Map
        static MapDatabase *createDatabase(const std::string &name, const std::string &savedir, Settings &conf);
 
        // Call these before and after saving of blocks
-       void beginSave();
-       void endSave();
+       void beginSave() override;
+       void endSave() override;
 
-       void save(ModifiedState save_level);
+       void save(ModifiedState save_level) override;
        void listAllLoadableBlocks(std::vector<v3s16> &dst);
        void listAllLoadedBlocks(std::vector<v3s16> &dst);
 
        MapgenParams *getMapgenParams();
 
-       bool saveBlock(MapBlock *block);
+       bool saveBlock(MapBlock *block) override;
        static bool saveBlock(MapBlock *block, MapDatabase *db, int compression_level = -1);
        MapBlock* loadBlock(v3s16 p);
        // Database version
        void loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load=false);
 
-       bool deleteBlock(v3s16 blockpos);
+       bool deleteBlock(v3s16 blockpos) override;
 
        void updateVManip(v3s16 pos);
 
        // For debug printing
-       virtual void PrintInfo(std::ostream &out);
+       void PrintInfo(std::ostream &out) override;
 
        bool isSavingEnabled(){ return m_map_saving_enabled; }
 
index 88e323bb1195b2c7bed178dda5bc9b1f60e02aa8..b5ae24882abbd093821f86aa6d39d429348986be 100644 (file)
@@ -194,7 +194,7 @@ struct BufferedPacket {
 
        u16 getSeqnum() const;
 
-       inline const size_t size() const { return m_data.size(); }
+       inline size_t size() const { return m_data.size(); }
 
        u8 *data; // Direct memory access
        float time = 0.0f; // Seconds from buffering the packet or re-sending
index 0bb7ea234f8b36f183fa32fca6868da068f355cb..97a5f19f751403978e3130060539e6596cb2e55b 100644 (file)
@@ -231,7 +231,7 @@ void UDPSocket::Send(const Address &destination, const void *data, int size)
 
        int sent;
        if (m_addr_family == AF_INET6) {
-               struct sockaddr_in6 address = {0};
+               struct sockaddr_in6 address = {};
                address.sin6_family = AF_INET6;
                address.sin6_addr = destination.getAddress6();
                address.sin6_port = htons(destination.getPort());
@@ -239,7 +239,7 @@ void UDPSocket::Send(const Address &destination, const void *data, int size)
                sent = sendto(m_handle, (const char *)data, size, 0,
                                (struct sockaddr *)&address, sizeof(struct sockaddr_in6));
        } else {
-               struct sockaddr_in address = {0};
+               struct sockaddr_in address = {};
                address.sin_family = AF_INET;
                address.sin_addr = destination.getAddress();
                address.sin_port = htons(destination.getPort());