From a89afe1229e327da3c397a3912b2d43d2196ea2b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 28 Apr 2022 20:53:15 +0200 Subject: [PATCH] Deal with compiler warnings --- src/client/client.h | 2 +- src/client/clientmap.h | 16 +++++++--------- src/client/content_cao.cpp | 2 +- src/client/content_cao.h | 2 +- src/client/game.cpp | 6 +++--- src/client/minimap.cpp | 2 +- src/client/shadows/dynamicshadowsrender.cpp | 6 ++++-- src/client/shadows/dynamicshadowsrender.h | 1 - src/database/database-postgresql.h | 3 ++- src/map.h | 14 +++++++------- src/network/connection.h | 2 +- src/network/socket.cpp | 4 ++-- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/client/client.h b/src/client/client.h index 0e29fdbe2..cb1227768 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -407,7 +407,7 @@ public: } ClientScripting *getScript() { return m_script; } - const bool modsLoaded() const { return m_mods_loaded; } + bool modsLoaded() const { return m_mods_loaded; } void pushToEventQueue(ClientEvent *event); diff --git a/src/client/clientmap.h b/src/client/clientmap.h index 7bd7af266..6d57f1911 100644 --- a/src/client/clientmap.h +++ b/src/client/clientmap.h @@ -81,9 +81,9 @@ public: 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 @@ public: /* 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 @@ public: 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; } diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index 3c31d4a36..d89bb53b3 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -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"); } diff --git a/src/client/content_cao.h b/src/client/content_cao.h index 70f1557e1..783aa4199 100644 --- a/src/client/content_cao.h +++ b/src/client/content_cao.h @@ -172,7 +172,7 @@ public: inline const v3f &getRotation() const { return m_rotation; } - const bool isImmortal(); + bool isImmortal() const; inline const ObjectProperties &getProperties() const { return m_prop; } diff --git a/src/client/game.cpp b/src/client/game.cpp index 1290534eb..d21bdbe99 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -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 diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index f26aa1c70..320621d91 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -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; } diff --git a/src/client/shadows/dynamicshadowsrender.cpp b/src/client/shadows/dynamicshadowsrender.cpp index a008c3e06..07dc6daf2 100644 --- a/src/client/shadows/dynamicshadowsrender.cpp +++ b/src/client/shadows/dynamicshadowsrender.cpp @@ -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; diff --git a/src/client/shadows/dynamicshadowsrender.h b/src/client/shadows/dynamicshadowsrender.h index bbeb254b0..0e4ef6b70 100644 --- a/src/client/shadows/dynamicshadowsrender.h +++ b/src/client/shadows/dynamicshadowsrender.h @@ -109,7 +109,6 @@ private: 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}; diff --git a/src/database/database-postgresql.h b/src/database/database-postgresql.h index 81b4a2b10..0a9ead01e 100644 --- a/src/database/database-postgresql.h +++ b/src/database/database-postgresql.h @@ -94,7 +94,8 @@ protected: 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(); diff --git a/src/map.h b/src/map.h index 9dc7a101c..d8ed29106 100644 --- a/src/map.h +++ b/src/map.h @@ -327,7 +327,7 @@ public: - 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 @@ public: 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 &dst); void listAllLoadedBlocks(std::vector &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; } diff --git a/src/network/connection.h b/src/network/connection.h index 88e323bb1..b5ae24882 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -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 diff --git a/src/network/socket.cpp b/src/network/socket.cpp index 0bb7ea234..97a5f19f7 100644 --- a/src/network/socket.cpp +++ b/src/network/socket.cpp @@ -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());