Cuberite
A lightweight, fast and extensible game server for Minecraft
|
This class is an interface that stores pieces for a generator. More...
#include <PiecePool.h>
Public Member Functions | |
virtual cPieces | GetPiecesWithConnector (int a_ConnectorType)=0 |
Returns a list of pieces that contain the specified connector type. More... | |
virtual int | GetPieceWeight (const cPlacedPiece &a_PlacedPiece, const cPiece::cConnector &a_ExistingConnector, const cPiece &a_NewPiece) |
Returns the relative weight with which the a_NewPiece is to be selected for placing under a_PlacedPiece through a_ExistingConnector. More... | |
virtual cPieces | GetStartingPieces (void)=0 |
Returns the pieces that should be used as the starting point. More... | |
virtual int | GetStartingPieceWeight (const cPiece &a_NewPiece) |
Returns the relative weight with which the a_NewPiece is to be selected for placing as the first piece. More... | |
virtual void | PiecePlaced (const cPiece &a_Piece)=0 |
Called after a piece is placed, to notify the pool that it has been used. More... | |
virtual void | Reset (void)=0 |
Called when the pool has finished the current structure and should reset any piece-counters it has for a new structure. More... | |
virtual | ~cPiecePool () |
This class is an interface that stores pieces for a generator.
Provides lists of pieces based on criteria (IsStarting, HasConnector). Provides per-piece weights for random distribution of individual pieces.
Definition at line 277 of file PiecePool.h.
|
inlinevirtual |
Definition at line 281 of file PiecePool.h.
|
pure virtual |
Returns a list of pieces that contain the specified connector type.
The cPiece pointers returned are managed by the pool and the caller doesn't free them.
Implemented in cVillageGen::cVillage, and cPrefabPiecePool.
|
inlinevirtual |
Returns the relative weight with which the a_NewPiece is to be selected for placing under a_PlacedPiece through a_ExistingConnector.
a_ExistingConnector is the original connector, before any movement or rotation is applied to it. This allows the pool to tweak the piece's chances, based on the previous pieces in the tree and the connector used. The higher the number returned, the higher the chance the piece will be chosen. 0 means the piece will never be chosen.
Reimplemented in cVillageGen::cVillage, cVillagePiecePool, and cPrefabPiecePool.
Definition at line 295 of file PiecePool.h.
|
pure virtual |
Returns the pieces that should be used as the starting point.
Multiple starting points are supported, one of the returned piece will be chosen.
Implemented in cVillageGen::cVillage, and cPrefabPiecePool.
|
inlinevirtual |
Returns the relative weight with which the a_NewPiece is to be selected for placing as the first piece.
This allows the pool to tweak the piece's chances. The higher the number returned, the higher the chance the piece will be chosen. 0 means the piece will not be chosen. If all pieces return 0, a random piece is chosen, with all equal chances.
Reimplemented in cVillageGen::cVillage, and cPrefabPiecePool.
Definition at line 308 of file PiecePool.h.
|
pure virtual |
Called after a piece is placed, to notify the pool that it has been used.
The pool may adjust the pieces it will return the next time.
Implemented in cVillageGen::cVillage, and cPrefabPiecePool.
|
pure virtual |
Called when the pool has finished the current structure and should reset any piece-counters it has for a new structure.
Implemented in cVillageGen::cVillage, and cPrefabPiecePool.