Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
cPieceGeneratorBFSTree Class Reference

#include <PieceGeneratorBFSTree.h>

Collaboration diagram for cPieceGeneratorBFSTree:
Collaboration graph
[legend]

Classes

struct  cConnection
 The type used for storing a connection from one piece to another, while building the piece tree. More...
 
struct  cFreeConnector
 The type used for storing a pool of connectors that will be attempted to expand by another piece. More...
 

Public Member Functions

 cPieceGeneratorBFSTree (cPiecePool &a_PiecePool, int a_Seed)
 Creates a new object tied to the specified PiecePool, using the specified seed. More...
 
void PlacePieces (int a_BlockX, int a_BlockZ, int a_MaxDepth, cPlacedPieces &a_OutPieces)
 Generates a placement for pieces at the specified coords. More...
 

Protected Types

typedef std::vector< cConnectioncConnections
 
typedef std::vector< cFreeConnectorcFreeConnectors
 

Protected Member Functions

bool CheckConnection (const cPiece::cConnector &a_ExistingConnector, const Vector3i &a_ToPos, const cPiece &a_Piece, const cPiece::cConnector &a_NewConnector, int a_NumCCWRotations, const cPlacedPieces &a_OutPieces)
 Checks if the specified piece would fit with the already-placed pieces, using the specified connector and number of CCW rotations. More...
 
void DebugConnectorPool (const cFreeConnectors &a_ConnectorPool, size_t a_NumProcessed)
 DEBUG: Outputs all the connectors in the pool into stdout. More...
 
cPlacedPiecePtr PlaceStartingPiece (int a_BlockX, int a_BlockZ, cFreeConnectors &a_OutConnectors)
 Selects a starting piece and places it, including its height and rotation. More...
 
bool TryPlacePieceAtConnector (const cPlacedPiece &a_ParentPiece, const cPiece::cConnector &a_Connector, cPlacedPieces &a_OutPieces, cFreeConnectors &a_OutConnectors)
 Tries to place a new piece at the specified (placed) connector. More...
 

Protected Attributes

cNoise m_Noise
 The noise used for random number generation. More...
 
cPiecePoolm_PiecePool
 The pool from which pieces are taken. More...
 
int m_Seed
 The seed used by this generator. More...
 

Detailed Description

Definition at line 19 of file PieceGeneratorBFSTree.h.

Member Typedef Documentation

◆ cConnections

typedef std::vector<cConnection> cPieceGeneratorBFSTree::cConnections
protected

Definition at line 43 of file PieceGeneratorBFSTree.h.

◆ cFreeConnectors

Definition at line 54 of file PieceGeneratorBFSTree.h.

Constructor & Destructor Documentation

◆ cPieceGeneratorBFSTree()

cPieceGeneratorBFSTree::cPieceGeneratorBFSTree ( cPiecePool a_PiecePool,
int  a_Seed 
)

Creates a new object tied to the specified PiecePool, using the specified seed.

Definition at line 22 of file PieceGeneratorBFSTree.cpp.

Member Function Documentation

◆ CheckConnection()

bool cPieceGeneratorBFSTree::CheckConnection ( const cPiece::cConnector a_ExistingConnector,
const Vector3i a_ToPos,
const cPiece a_Piece,
const cPiece::cConnector a_NewConnector,
int  a_NumCCWRotations,
const cPlacedPieces a_OutPieces 
)
protected

Checks if the specified piece would fit with the already-placed pieces, using the specified connector and number of CCW rotations.

a_ExistingConnector is in world-coords and is already rotated properly a_ToPos is the world-coords position on which the new connector should be placed (1 block away from a_ExistingConnector, in its Direction) a_NewConnector is in the original (non-rotated) coords. Returns true if the piece fits, false if not.

Definition at line 202 of file PieceGeneratorBFSTree.cpp.

◆ DebugConnectorPool()

void cPieceGeneratorBFSTree::DebugConnectorPool ( const cFreeConnectors a_ConnectorPool,
size_t  a_NumProcessed 
)
protected

DEBUG: Outputs all the connectors in the pool into stdout.

a_NumProcessed signals the number of connectors from the pool that should be considered processed (not listed).

Definition at line 293 of file PieceGeneratorBFSTree.cpp.

◆ PlacePieces()

void cPieceGeneratorBFSTree::PlacePieces ( int  a_BlockX,
int  a_BlockZ,
int  a_MaxDepth,
cPlacedPieces a_OutPieces 
)

Generates a placement for pieces at the specified coords.

The Y coord is generated automatically based on the starting piece that is chosen.

Definition at line 228 of file PieceGeneratorBFSTree.cpp.

◆ PlaceStartingPiece()

cPlacedPiecePtr cPieceGeneratorBFSTree::PlaceStartingPiece ( int  a_BlockX,
int  a_BlockZ,
cFreeConnectors a_OutConnectors 
)
protected

Selects a starting piece and places it, including its height and rotation.

Also puts the piece's connectors in a_OutConnectors.

Definition at line 33 of file PieceGeneratorBFSTree.cpp.

◆ TryPlacePieceAtConnector()

bool cPieceGeneratorBFSTree::TryPlacePieceAtConnector ( const cPlacedPiece a_ParentPiece,
const cPiece::cConnector a_Connector,
cPlacedPieces a_OutPieces,
cPieceGeneratorBFSTree::cFreeConnectors a_OutConnectors 
)
protected

Tries to place a new piece at the specified (placed) connector.

Returns true if successful.

Definition at line 100 of file PieceGeneratorBFSTree.cpp.

Member Data Documentation

◆ m_Noise

cNoise cPieceGeneratorBFSTree::m_Noise
protected

The noise used for random number generation.

Definition at line 61 of file PieceGeneratorBFSTree.h.

◆ m_PiecePool

cPiecePool& cPieceGeneratorBFSTree::m_PiecePool
protected

The pool from which pieces are taken.

Definition at line 58 of file PieceGeneratorBFSTree.h.

◆ m_Seed

int cPieceGeneratorBFSTree::m_Seed
protected

The seed used by this generator.

Definition at line 64 of file PieceGeneratorBFSTree.h.


The documentation for this class was generated from the following files: