MCPcopy Create free account
hub / github.com/cuberite/cuberite / cPOCPieceGenerator

Method cPOCPieceGenerator

src/Generating/POCPieceGenerator.cpp:156–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154// cPOCPieceGenerator:
155
156cPOCPieceGenerator::cPOCPieceGenerator(int a_Seed) :
157 m_Seed(a_Seed)
158{
159 // Prepare a vector of available pieces:
160 m_AvailPieces.push_back(new cPOCPiece(5, 3));
161 m_AvailPieces.push_back(new cPOCPiece(7, 5));
162 m_AvailPieces.push_back(new cPOCPiece(9, 5));
163 m_AvailPieces.push_back(new cPOCPiece(5, 7));
164
165 // Generate the structure:
166 cBFSPieceGenerator Gen(*this, a_Seed);
167 Gen.PlacePieces(0, 50, 0, 6, m_Pieces);
168
169 // DebugPieces(m_Pieces);
170
171 // Get the smallest cuboid encompassing the entire generated structure:
172 cCuboid Bounds(0, 50, 0, 0, 50, 0);
173 for (cPlacedPieces::const_iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr)
174 {
175 Vector3i MinCoords = (*itr)->GetCoords();
176 Bounds.Engulf(MinCoords);
177 Bounds.Engulf(MinCoords + (*itr)->GetPiece().GetSize());
178 } // for itr - m_Pieces[]
179 m_Bounds = Bounds;
180}
181
182
183

Callers

nothing calls this directly

Calls 5

PlacePiecesMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
EngulfMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected