Commented out debug statements again
[oweals/minetest.git] / src / utility.h
index 534aea483e17843ce88d68f67b5c2b33a920aca2..d331bafbb2896020b90d49e39e1c36dcf57729e8 100644 (file)
@@ -236,17 +236,14 @@ inline u16 readU32(std::istream &is)
 
 inline void writeF1000(std::ostream &os, f32 p)
 {
-       char buf[2];
+       char buf[4];
        writeF1000((u8*)buf, p);
-       os.write(buf, 2);
+       os.write(buf, 4);
 }
 inline f32 readF1000(std::istream &is)
 {
-       char buf[2];
-       is.read(buf, 2);
-       // TODO: verify if this gets rid of the valgrind warning
-       //if(is.gcount() != 2)
-       //      return 0;
+       char buf[4];
+       is.read(buf, 4);
        return readF1000((u8*)buf);
 }
 
@@ -1264,6 +1261,14 @@ public:
                m_settings[name] = value;
        }
 
+       void set(std::string name, const char *value)
+       {
+               JMutexAutoLock lock(m_mutex);
+
+               m_settings[name] = value;
+       }
+
+
        void setDefault(std::string name, std::string value)
        {
                JMutexAutoLock lock(m_mutex);
@@ -1456,6 +1461,8 @@ public:
                                        i.getNode()->getValue());
                }
 
+               return *this;
+
        }
 
        Settings & operator=(Settings &other)
@@ -1741,6 +1748,11 @@ void mysrand(unsigned seed);
 
 inline int myrand_range(int min, int max)
 {
+       if(max-min > MYRAND_MAX)
+       {
+               dstream<<"WARNING: myrand_range: max-min > MYRAND_MAX"<<std::endl;
+               assert(0);
+       }
        if(min > max)
        {
                assert(0);
@@ -1753,8 +1765,8 @@ inline int myrand_range(int min, int max)
        Miscellaneous functions
 */
 
-bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir, f32 range,
-               f32 *distance_ptr=NULL);
+bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir,
+               f32 camera_fov, f32 range, f32 *distance_ptr=NULL);
 
 /*
        Queue with unique values with fast checking of value existence