Fix all warnings reported by clang
authorSfan5 <sfan5@live.de>
Tue, 15 Apr 2014 17:49:32 +0000 (19:49 +0200)
committerSfan5 <sfan5@live.de>
Tue, 15 Apr 2014 19:34:53 +0000 (21:34 +0200)
27 files changed:
src/camera.cpp
src/camera.h
src/cguittfont/irrUString.h
src/clientiface.h
src/clientobject.h
src/clouds.h
src/connection.cpp
src/connection.h
src/content_cao.cpp
src/emerge.cpp
src/environment.cpp
src/environment.h
src/game.cpp
src/guiVolumeChange.cpp
src/guiVolumeChange.h
src/localplayer.cpp
src/localplayer.h
src/main.cpp
src/map.cpp
src/mapgen.h
src/mapgen_indev.cpp
src/mapgen_indev.h
src/player.h
src/script/cpp_api/s_item.h
src/script/lua_api/l_mapgen.cpp
src/shader.cpp
src/sky.h

index 6fbd1dd8c26b2326b886c18878f87c7418501d9c..b49e8e748354b9d7bb433b8b72d10ef8394c2c14 100644 (file)
@@ -44,7 +44,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
                IGameDef *gamedef):
-       m_smgr(smgr),
        m_playernode(NULL),
        m_headnode(NULL),
        m_cameranode(NULL),
index 82c8d4be34824121ab98e6fa3e84478c833e01d8..d1c3b59d4d177ba373b9d26ad74eaf703498c808 100644 (file)
@@ -136,8 +136,7 @@ public:
        void drawWieldedTool();
 
 private:
-       // Scene manager and nodes
-       scene::ISceneManager* m_smgr;
+       // Nodes
        scene::ISceneNode* m_playernode;
        scene::ISceneNode* m_headnode;
        scene::ICameraSceneNode* m_cameranode;
index 21109ea480b8f66741ad97408739c1ced52320df..132a35ee2d08962758b55510a36c224094b35fa4 100644 (file)
@@ -3395,7 +3395,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const short ri
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const short left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
@@ -3415,7 +3415,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const unsigned short left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
@@ -3435,7 +3435,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const int righ
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const int left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
@@ -3455,7 +3455,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const unsigned int left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
@@ -3475,7 +3475,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const long rig
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const long left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
@@ -3495,7 +3495,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const unsigned
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const unsigned long left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
@@ -3515,7 +3515,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const float ri
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const float left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
@@ -3535,7 +3535,7 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const double r
 template <typename TAlloc>
 inline ustring16<TAlloc> operator+(const double left, const ustring16<TAlloc>& right)
 {
-       ustring16<TAlloc> ret(core::stringc(left));
+       ustring16<TAlloc> ret((core::stringc(left)));
        ret += right;
        return ret;
 }
index 95f8bd30531241f25c80887b589ce98c216a3060..752e2bb8a466329f18f9e2ec55793c4674c13767 100644 (file)
@@ -141,6 +141,8 @@ namespace con {
        class Connection;
 }
 
+#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
+
 enum ClientState
 {
        Invalid,
@@ -219,7 +221,6 @@ public:
                m_nearest_unsent_d(0),
                m_nearest_unsent_reset_timer(0.0),
                m_excess_gotblocks(0),
-               m_nothing_to_send_counter(0),
                m_nothing_to_send_pause_timer(0.0),
                m_name(""),
                m_version_major(0),
@@ -355,7 +356,6 @@ private:
        u32 m_excess_gotblocks;
 
        // CPU usage optimization
-       u32 m_nothing_to_send_counter;
        float m_nothing_to_send_pause_timer;
 
        /*
@@ -433,7 +433,7 @@ public:
        { assert(m_env == 0); m_env = env; }
 
        static std::string state2Name(ClientState state) {
-               assert(state < sizeof(statenames));
+               assert((int) state < ARRAYSIZE(statenames));
                return statenames[state];
        }
 
index 613c635a2dcf2df84a495f6eeb87489230bc23f6..233617b5c1c5ffc29f5267c60550c8f89c0a3849 100644 (file)
@@ -55,7 +55,7 @@ public:
        virtual void updateLight(u8 light_at_pos){}
        virtual v3s16 getLightPosition(){return v3s16(0,0,0);}
        virtual core::aabbox3d<f32>* getSelectionBox(){return NULL;}
-       virtual core::aabbox3d<f32>* getCollisionBox(){return NULL;}
+       virtual bool getCollisionBox(aabb3f *toset){return false;}
        virtual bool collideWithObjects(){return false;}
        virtual v3f getPosition(){return v3f(0,0,0);}
        virtual scene::IMeshSceneNode *getMeshSceneNode(){return NULL;}
index d718e56bf355241107e2ddadc4bc26efae9e9081..a6883a44a2aa6dd5d2cbb245bb495b72cf9b5689 100644 (file)
@@ -76,7 +76,6 @@ private:
        video::SMaterial m_material;
        core::aabbox3d<f32> m_box;
        float m_cloud_y;
-       float m_brightness;
        video::SColorf m_color;
        u32 m_seed;
        v2f m_camera_pos;
index c77ee7f4da2e98ce0d82d99032f9b9f5c247b865..32634ac8948f3979846ca78120f48f9c65f19c33 100644 (file)
@@ -212,7 +212,7 @@ SharedBuffer<u8> makeReliablePacket(
        ReliablePacketBuffer
 */
 
-ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0),writeptr(0) {}
+ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0) {}
 
 void ReliablePacketBuffer::print()
 {
@@ -1941,8 +1941,7 @@ void ConnectionSendThread::sendAsPacket(u16 peer_id, u8 channelnum,
 
 ConnectionReceiveThread::ConnectionReceiveThread(Connection* parent,
                                                                                                unsigned int max_packet_size) :
-       m_connection(parent),
-       m_max_packet_size(max_packet_size)
+       m_connection(parent)
 {
 }
 
index 0f936eb31524401245b0dcbe8f2e889ec3847b4e..43fd2fb88e8b6735a4f46d53dbbfe6e063bee630 100644 (file)
@@ -339,13 +339,11 @@ private:
        RPBSearchResult findPacket(u16 seqnum);
 
        std::list<BufferedPacket> m_list;
-       u16 m_list_size;
+       u32 m_list_size;
 
        u16 m_oldest_non_answered_ack;
 
        JMutex m_list_mutex;
-
-       unsigned int writeptr;
 };
 
 /*
@@ -975,7 +973,6 @@ private:
 
 
        Connection*           m_connection;
-       unsigned int          m_max_packet_size;
 };
 
 class Connection
index 5f53fd6447a9aa376b13a736e4106d6f81881ecd..10aa22e7e02f2dc568478a013133e12a765aa576 100644 (file)
@@ -166,7 +166,7 @@ public:
 
        void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
                        IrrlichtDevice *irr);
-       void removeFromScene();
+       void removeFromScene(bool permanent);
        void updateLight(u8 light_at_pos);
        v3s16 getLightPosition();
        void updateNodePos();
@@ -236,7 +236,7 @@ void TestCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
        updateNodePos();
 }
 
-void TestCAO::removeFromScene()
+void TestCAO::removeFromScene(bool permanent)
 {
        if(m_node == NULL)
                return;
@@ -310,7 +310,7 @@ public:
 
        void addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
                        IrrlichtDevice *irr);
-       void removeFromScene();
+       void removeFromScene(bool permanent);
        void updateLight(u8 light_at_pos);
        v3s16 getLightPosition();
        void updateNodePos();
@@ -412,7 +412,7 @@ void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
        updateTexture();
 }
 
-void ItemCAO::removeFromScene()
+void ItemCAO::removeFromScene(bool permanent)
 {
        if(m_node == NULL)
                return;
@@ -648,7 +648,6 @@ public:
 
        bool getCollisionBox(aabb3f *toset) {
                if (m_prop.physical) {
-                       aabb3f retval;
                        //update collision box
                        toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
                        toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;
index c26fab8375006f3c066f4907d868dcdf83047e3b..443d70384819de64b90a4f0ef45bea81bd298e7e 100644 (file)
@@ -465,7 +465,7 @@ void *EmergeThread::Thread() {
 
        v3s16 last_tried_pos(-32768,-32768,-32768); // For error output
        v3s16 p;
-       u8 flags;
+       u8 flags = 0;
 
        map    = (ServerMap *)&(m_server->m_env->getMap());
        emerge = m_server->m_emerge;
index 630f8d21a4fe5ac9f4061b216922ce15a1af2c0d..bc1b59d8924afcb88a08a809ae42b40045c714d6 100644 (file)
@@ -314,7 +314,6 @@ ServerEnvironment::ServerEnvironment(ServerMap *map,
        m_map(map),
        m_script(scriptIface),
        m_gamedef(gamedef),
-       m_random_spawn_timer(3),
        m_send_recommended_timer(0),
        m_active_block_interval_overload_skip(0),
        m_game_time(0),
@@ -1097,7 +1096,7 @@ void ServerEnvironment::step(float dtime)
                                continue;
                        
                        // Move
-                       player->move(dtime, *m_map, 100*BS);
+                       player->move(dtime, this, 100*BS);
                }
        }
 
@@ -2395,7 +2394,7 @@ void ClientEnvironment::step(float dtime)
                if(player->isLocal() == false)
                {
                        // Move
-                       player->move(dtime, *m_map, 100*BS);
+                       player->move(dtime, this, 100*BS);
 
                }
                
index d99e27ba4606f1b8875a93c93bd236a0d32f1fad..48d099bf93727dbbdd0e8fd654bcf90c1d30032a 100644 (file)
@@ -374,7 +374,6 @@ private:
        // Outgoing network message buffer for active objects
        std::list<ActiveObjectMessage> m_active_object_messages;
        // Some timers
-       float m_random_spawn_timer; // used for experimental code
        float m_send_recommended_timer;
        IntervalLimiter m_object_management_interval;
        // List of active blocks
index 2e8d3761d293434430233735f7527f950ebcb17a..1ad06acb19f7102141dd7bb4edb06b80b40abc27 100644 (file)
@@ -132,7 +132,7 @@ struct LocalFormspecHandler : public TextDest
                m_client = client;
        }
 
-       void gotText(std::string message) {
+       void gotText(std::wstring message) {
                errorstream << "LocalFormspecHandler::gotText old style message received" << std::endl;
        }
 
index 5e7476bb5ebd95906424d84830b66e5bdd261099..f31c650f3108688ac425dd1c4c39ea5e1e4af023 100644 (file)
@@ -41,8 +41,7 @@ GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env,
                IMenuManager *menumgr,
                Client* client
 ):
-       GUIModalMenu(env, parent, id, menumgr),
-       m_client(client)
+       GUIModalMenu(env, parent, id, menumgr)
 {
 }
 
index 5258ee1071be7bdda4ccceb55babc1debf8bf175..9f8199fa8bdfd36dcb9fa9308b7c0f4ae6334e6b 100644 (file)
@@ -44,11 +44,7 @@ public:
 
        bool OnEvent(const SEvent& event);
        
-       bool pausesGame(){ return true; }
-
-private:
-       Client* m_client;
-
+       bool pausesGame() { return true; }
 };
 
 #endif
index 15a208b8cb987aee8871dcdd2bf5120c41b3b621..e545dc42aa746726d46d4d98be92079f174b1d5d 100644 (file)
@@ -65,7 +65,7 @@ LocalPlayer::~LocalPlayer()
 {
 }
 
-void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
+void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
                std::list<CollisionInfo> *collision_info)
 {
        Map *map = &env->getMap();
@@ -360,7 +360,7 @@ void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
                m_can_jump = false;
 }
 
-void LocalPlayer::move(f32 dtime, ClientEnvironment *env, f32 pos_max_d)
+void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)
 {
        move(dtime, env, pos_max_d, NULL);
 }
index 67deb9367dd5b78fb2da345259bf57da27f0fee7..38e7a4cd9e739ba0955dde3fbaf60f20dffe36ac 100644 (file)
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "player.h"
 #include <list>
 
-class ClientEnvironment;
+class Environment;
 
 class ClientActiveObject;
 
@@ -46,9 +46,9 @@ public:
 
        v3f overridePosition;
        
-       void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d,
+       void move(f32 dtime, Environment *env, f32 pos_max_d);
+       void move(f32 dtime, Environment *env, f32 pos_max_d,
                        std::list<CollisionInfo> *collision_info);
-       void move(f32 dtime, ClientEnvironment *env, f32 pos_max_d);
 
        void applyControl(float dtime);
 
index baaf8ebde807e55ceacf4a3fa0e6014c317ec14a..c93af0d7704519ae3e10c2b761e02b0b700c56d8 100644 (file)
@@ -360,7 +360,6 @@ public:
        s32 mouse_wheel;
 
 private:
-       IrrlichtDevice *m_device;
 
        // The current state of keys
        KeyList keyIsDown;
index 22ea41e04d0431fcc48e54256282db59b8ed63cc..ec97fedf2da9a4464c4a13d4f7f82ee945d06f22 100644 (file)
@@ -2596,6 +2596,7 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
                        // Sector metadata is loaded from disk if not already loaded.
                        ServerMapSector *sector = createSector(sectorpos);
                        assert(sector);
+                       (void) sector;
 
                        for(s16 y=blockpos_min.Y-extra_borders.Y;
                                        y<=blockpos_max.Y+extra_borders.Y; y++)
@@ -3261,12 +3262,13 @@ std::string ServerMap::getSectorDir(v2s16 pos, int layout)
                        return m_savedir + DIR_DELIM + "sectors2" + DIR_DELIM + cc;
                default:
                        assert(false);
+                       return "";
        }
 }
 
 v2s16 ServerMap::getSectorPos(std::string dirname)
 {
-       unsigned int x, y;
+       unsigned int x = 0, y = 0;
        int r;
        std::string component;
        fs::RemoveLastPathComponent(dirname, &component, 1);
index 9bc162fe0fd8a53d81d3478b8774666efc0ff9fa..3c897e02315a58c58b3ea5d42d2e4d826070fb22 100644 (file)
@@ -209,7 +209,7 @@ Ore *createOre(OreType type);
 
 
 enum DecorationType {
-       DECO_SIMPLE,
+       DECO_SIMPLE = 1,
        DECO_SCHEMATIC,
        DECO_LSYSTEM
 };
index ac5b4e811599004bda56b3e592eee8fdc6ef67ae..f01547156c27b6b94df93c357e1ce388b787c888 100644 (file)
@@ -26,9 +26,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void NoiseIndev::init(NoiseIndevParams *np, int seed, int sx, int sy, int sz) {
-       Noise::init((NoiseParams*)np, seed, sx, sy, sz);
-       this->npindev   = np;
+void NoiseIndev::init(NoiseParams *np, int seed, int sx, int sy, int sz) {
+       Noise::init(np, seed, sx, sy, sz);
+       this->npindev = (NoiseIndevParams*) np;
 }
 
 NoiseIndev::NoiseIndev(NoiseIndevParams *np, int seed, int sx, int sy) : Noise(np, seed, sx, sy) {
index a5b0a66784b354449f6a182f76ede863d3a1ac7b..d8be7dce9a4f0b358d4453e57ffebbd5fae4b1ad 100644 (file)
@@ -61,7 +61,7 @@ public:
        virtual ~NoiseIndev() {};
        NoiseIndev(NoiseIndevParams *np, int seed, int sx, int sy);
        NoiseIndev(NoiseIndevParams *np, int seed, int sx, int sy, int sz);
-       void init(NoiseIndevParams *np, int seed, int sx, int sy, int sz);
+       void init(NoiseParams *np, int seed, int sx, int sy, int sz);
        void transformNoiseMapFarScale(float xx = 0, float yy = 0, float zz = 0);
 };
 
index dce167438a71b7a39c18e7d0d0087cacee24df37..4c5939d3d66e7b5c1bf8cc306bbd2fed03fd05b8 100644 (file)
@@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "irrlichttypes_bloated.h"
 #include "inventory.h"
 #include "constants.h" // BS
+#include <list>
 
 #define PLAYERNAME_SIZE 20
 
@@ -88,6 +89,7 @@ class IGameDef;
 struct CollisionInfo;
 class PlayerSAO;
 struct HudElement;
+class Environment;
 
 class Player
 {
@@ -96,7 +98,10 @@ public:
        Player(IGameDef *gamedef);
        virtual ~Player() = 0;
 
-       virtual void move(f32 dtime, Map &map, f32 pos_max_d)
+       virtual void move(f32 dtime, Environment *env, f32 pos_max_d)
+       {}
+       virtual void move(f32 dtime, Environment *env, f32 pos_max_d,
+                       std::list<CollisionInfo> *collision_info)
        {}
 
        v3f getSpeed()
index cca1641fdf478cb5917ec0154a7641a6dd953f5e..88cc1909d9016491dd5ac2e38e3499b7e576a13d 100644 (file)
@@ -30,7 +30,7 @@ struct ItemDefinition;
 class LuaItemStack;
 class ModApiItemMod;
 class InventoryList;
-class InventoryLocation;
+struct InventoryLocation;
 
 class ScriptApiItem
 : virtual public ScriptApiBase
index 56109a9dd6091d177cb3cea610e9ae5ce8eca245..9fbb46ee1c2b37a5310632d042bf8c6dc5c6bfcb 100644 (file)
@@ -324,8 +324,8 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
        BiomeDefManager *bdef = emerge->biomedef;
 
        enum DecorationType decotype = (DecorationType)getenumfield(L, index,
-                               "deco_type", es_DecorationType, -1);
-       if (decotype == -1) {
+                               "deco_type", es_DecorationType, 0);
+       if (decotype == 0) {
                errorstream << "register_decoration: unrecognized "
                        "decoration placement type";
                return 0;
index 4006e256f52c5927c83e08a68e40b23798050fdd..4013add6cf9c2d37e4076f58d0e8a756712a8662 100644 (file)
@@ -210,8 +210,7 @@ public:
 class MainShaderConstantSetter : public IShaderConstantSetter
 {
 public:
-       MainShaderConstantSetter(IrrlichtDevice *device):
-               m_device(device)
+       MainShaderConstantSetter(IrrlichtDevice *device)
        {}
        ~MainShaderConstantSetter() {}
 
@@ -255,9 +254,6 @@ public:
                        services->setVertexShaderConstant(world.pointer(), 8, 4);
 
        }
-
-private:
-       IrrlichtDevice *m_device;
 };
 
 /*
index 06a99310371f8b37de242806dd850d8f66091a6c..c906bd3242c154c62d58ab6c127577e397e19aae 100644 (file)
--- a/src/sky.h
+++ b/src/sky.h
@@ -125,7 +125,6 @@ private:
        video::SColor m_skycolor;
        video::SColorf m_cloudcolor_f;
        v3f m_stars[SKY_STAR_COUNT];
-       u16 m_star_indices[SKY_STAR_COUNT*4];
        video::S3DVertex m_star_vertices[SKY_STAR_COUNT*4];
        LocalPlayer* m_player;
 };