mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
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)
This commit is contained in:
parent
921151d97a
commit
13e995b811
25 changed files with 298 additions and 343 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue