]> git.lizzy.rs Git - minetest.git/blobdiff - src/dungeongen.cpp
Profiler: Fix var args not being passed to callback register function
[minetest.git] / src / dungeongen.cpp
index f8859dcd0804f9dbcc78092e5a6fb6b42346159c..fa867b3988494f75ec0de1d4ddf4a4dda4dd8c20 100644 (file)
@@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapnode.h"
 #include "map.h"
 #include "nodedef.h"
-#include "profiler.h"
 #include "settings.h"
 
 //#define DGEN_USE_TORCHES
@@ -201,7 +200,7 @@ void DungeonGen::makeDungeon(v3s16 start_padding)
                }
        }
        // No place found
-       if (fits == false)
+       if (!fits)
                return;
 
        /*
@@ -564,7 +563,7 @@ bool DungeonGen::findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace,
                v3s16 doorplace;
                v3s16 doordir;
                bool r = findPlaceForDoor(doorplace, doordir);
-               if (r == false)
+               if (!r)
                        continue;
                v3s16 roomplace;
                // X east, Z north, Y up
@@ -596,7 +595,7 @@ bool DungeonGen::findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace,
                                break;
                        }
                }
-               if (fits == false) {
+               if (!fits) {
                        // Find new place
                        continue;
                }
@@ -625,12 +624,12 @@ v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs)
                } while ((dir.X == 0 || dir.Z == 0) && trycount < 10);
 
                return dir;
-       } else {
-               if (random.next() % 2 == 0)
-                       return random.next() % 2 ? v3s16(-1, 0, 0) : v3s16(1, 0, 0);
-               else
-                       return random.next() % 2 ? v3s16(0, 0, -1) : v3s16(0, 0, 1);
        }
+
+       if (random.next() % 2 == 0)
+               return random.next() % 2 ? v3s16(-1, 0, 0) : v3s16(1, 0, 0);
+
+       return random.next() % 2 ? v3s16(0, 0, -1) : v3s16(0, 0, 1);
 }
 
 
@@ -673,6 +672,6 @@ int dir_to_facedir(v3s16 d)
 {
        if (abs(d.X) > abs(d.Z))
                return d.X < 0 ? 3 : 1;
-       else
-               return d.Z < 0 ? 2 : 0;
+
+       return d.Z < 0 ? 2 : 0;
 }