Commented out debug statements again
[oweals/minetest.git] / src / utility.cpp
index 186881c5acc2ba59a794301f457248a202a2a4d4..9c1edc8a95fa6c5ee3ce268718b56f2e7229c5f7 100644 (file)
@@ -162,8 +162,8 @@ void mysrand(unsigned seed)
        camera_dir: an unit vector pointing to camera direction
        range: viewing range
 */
-bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir, f32 range,
-               f32 *distance_ptr)
+bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir,
+               f32 camera_fov, f32 range, f32 *distance_ptr)
 {
        v3s16 blockpos_nodes = blockpos_b * MAP_BLOCKSIZE;
        
@@ -211,8 +211,7 @@ bool isBlockInSight(v3s16 blockpos_b, v3f camera_pos, v3f camera_dir, f32 range,
                cosangle += block_max_radius / dforward;
 
                // If block is not in the field of view, skip it
-               //if(cosangle < cos(FOV_ANGLE/2))
-               if(cosangle < cos(FOV_ANGLE/2. * 4./3.))
+               if(cosangle < cos(camera_fov / 2))
                        return false;
        }
 
@@ -229,10 +228,10 @@ std::string translatePassword(std::string playername, std::wstring password)
        if(password.length() == 0)
                return "";
 
-       std::string slt=playername + wide_to_narrow(password);
-       SHA1 *sha1 = new SHA1();
-       sha1->addBytes(slt.c_str(), slt.length());
-       unsigned char *digest = sha1->getDigest();
+       std::string slt = playername + wide_to_narrow(password);
+       SHA1 sha1;
+       sha1.addBytes(slt.c_str(), slt.length());
+       unsigned char *digest = sha1.getDigest();
        std::string pwd = base64_encode(digest, 20);
        free(digest);
        return pwd;