summaryrefslogtreecommitdiffstats
path: root/src/Generating/MineShafts.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-13 18:38:06 +0200
committerAlexander Harkness <me@bearbin.net>2020-04-16 22:07:48 +0200
commit9ee47e59995f858ec531b3ee467f131594e4ba1f (patch)
treef005d8af4a0362d7eab8a96a71aca0d73275f8e1 /src/Generating/MineShafts.cpp
parentPrevent crash when breeding (diff)
downloadcuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.gz
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.bz2
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.lz
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.xz
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.zst
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/MineShafts.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp
index 80ba3f5b5..2045533c1 100644
--- a/src/Generating/MineShafts.cpp
+++ b/src/Generating/MineShafts.cpp
@@ -81,18 +81,19 @@ public:
virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) = 0;
} ;
-typedef std::vector<cMineShaft *> cMineShafts;
+using cMineShafts = std::vector<cMineShaft *>;
-class cMineShaftDirtRoom :
+class cMineShaftDirtRoom:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
cMineShaftDirtRoom(cStructGenMineShafts::cMineShaftSystem & a_Parent, cNoise & a_Noise);
// cMineShaft overrides:
@@ -104,16 +105,16 @@ public:
-class cMineShaftCorridor :
+class cMineShaftCorridor:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
/** Creates a new Corridor attached to the specified pivot point and direction.
Checks all ParentSystem's objects and disallows intersecting. Initializes the new object to fit.
- May return nullptr if cannot fit.
- */
+ May return nullptr if cannot fit. */
static cMineShaft * CreateAndFit(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
int a_PivotX, int a_PivotY, int a_PivotZ, eDirection a_Direction,
@@ -157,16 +158,16 @@ protected:
-class cMineShaftCrossing :
+class cMineShaftCrossing:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
/** Creates a new Crossing attached to the specified pivot point and direction.
Checks all ParentSystem's objects and disallows intersecting. Initializes the new object to fit.
- May return nullptr if cannot fit.
- */
+ May return nullptr if cannot fit. */
static cMineShaft * CreateAndFit(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
int a_PivotX, int a_PivotY, int a_PivotZ, eDirection a_Direction,
@@ -185,12 +186,13 @@ protected:
-class cMineShaftStaircase :
+class cMineShaftStaircase:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
enum eSlope
{
sUp,
@@ -228,12 +230,13 @@ protected:
-class cStructGenMineShafts::cMineShaftSystem :
+class cStructGenMineShafts::cMineShaftSystem:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
public:
+
int m_GridSize; ///< Maximum offset of the dirtroom from grid center, * 2, in each direction
int m_MaxRecursion; ///< Maximum recursion level (initialized from cStructGenMineShafts::m_MaxRecursion)
int m_ProbLevelCorridor; ///< Probability level of a branch object being the corridor
@@ -283,7 +286,7 @@ cStructGenMineShafts::cMineShaftSystem::cMineShaftSystem(
int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase
) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_GridSize(a_GridSize),
m_MaxRecursion(8), // TODO: settable
m_ProbLevelCorridor(a_ProbLevelCorridor),
@@ -404,7 +407,7 @@ bool cStructGenMineShafts::cMineShaftSystem::CanAppend(const cCuboid & a_Boundin
// cMineShaftDirtRoom:
cMineShaftDirtRoom::cMineShaftDirtRoom(cStructGenMineShafts::cMineShaftSystem & a_Parent, cNoise & a_Noise) :
- super(a_Parent, mskDirtRoom)
+ Super(a_Parent, mskDirtRoom)
{
// Make the room of random size, min 10 x 4 x 10; max 18 x 12 x 18:
int rnd = a_Noise.IntNoise3DInt(a_Parent.m_OriginX, 0, a_Parent.m_OriginZ) / 7;
@@ -500,7 +503,7 @@ cMineShaftCorridor::cMineShaftCorridor(
const cCuboid & a_BoundingBox, int a_NumSegments, eDirection a_Direction,
cNoise & a_Noise
) :
- super(a_ParentSystem, mskCorridor, a_BoundingBox),
+ Super(a_ParentSystem, mskCorridor, a_BoundingBox),
m_NumSegments(a_NumSegments),
m_Direction(a_Direction),
m_ChestPosition(-1),
@@ -973,7 +976,7 @@ void cMineShaftCorridor::PlaceTorches(cChunkDesc & a_ChunkDesc)
// cMineShaftCrossing:
cMineShaftCrossing::cMineShaftCrossing(cStructGenMineShafts::cMineShaftSystem & a_ParentSystem, const cCuboid & a_BoundingBox) :
- super(a_ParentSystem, mskCrossing, a_BoundingBox)
+ Super(a_ParentSystem, mskCrossing, a_BoundingBox)
{
}
@@ -1113,7 +1116,7 @@ cMineShaftStaircase::cMineShaftStaircase(
eDirection a_Direction,
eSlope a_Slope
) :
- super(a_ParentSystem, mskStaircase, a_BoundingBox),
+ Super(a_ParentSystem, mskStaircase, a_BoundingBox),
m_Direction(a_Direction),
m_Slope(a_Slope)
{
@@ -1289,7 +1292,7 @@ cStructGenMineShafts::cStructGenMineShafts(
int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxSystemSize,
int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase
) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSystemSize, a_MaxSystemSize, 100),
+ Super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSystemSize, a_MaxSystemSize, 100),
m_GridSize(a_GridSize),
m_MaxSystemSize(a_MaxSystemSize),
m_ProbLevelCorridor(std::max(0, a_ChanceCorridor)),