summaryrefslogtreecommitdiff
path: root/src/dungeongen.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-17 23:02:50 +0200
committerGitHub <noreply@github.com>2017-08-17 23:02:50 +0200
commit13e995b811e80dc48c0769274d3dca3a2221b843 (patch)
treeb75e58314fa98b57d23fefd92547f298ea419e5f /src/dungeongen.cpp
parent921151d97a2fb2238ab514324fb95e2732248b96 (diff)
downloadminetest-13e995b811e80dc48c0769274d3dca3a2221b843.tar.gz
minetest-13e995b811e80dc48c0769274d3dca3a2221b843.tar.bz2
minetest-13e995b811e80dc48c0769274d3dca3a2221b843.zip
Modernize src/c* src/d* and src/e* files (#6263)
* Modernize src/c* src/d* and src/e* files * default operator * redundant init * delete default constructors on CraftDefinition childs (never used) * fix some missing init values * const ref fix reported by clang-tidy * ranged-based for loops * simple conditions & returns * empty stl function instead of size * emplace_back stl function instead of push_back + construct temp obj * auto for some iterators * code style fixes * c++ stl headers instead of C stl headers (stdio.h -> cstdio)
Diffstat (limited to 'src/dungeongen.cpp')
-rw-r--r--src/dungeongen.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp
index f8859dcd0..851b1e25f 100644
--- a/src/dungeongen.cpp
+++ b/src/dungeongen.cpp
@@ -201,7 +201,7 @@ void DungeonGen::makeDungeon(v3s16 start_padding)
}
}
// No place found
- if (fits == false)
+ if (!fits)
return;
/*
@@ -564,7 +564,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 +596,7 @@ bool DungeonGen::findPlaceForRoomDoor(v3s16 roomsize, v3s16 &result_doorplace,
break;
}
}
- if (fits == false) {
+ if (!fits) {
// Find new place
continue;
}
@@ -625,12 +625,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 +673,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;
}