![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Public Member Functions | |
cVillage (int a_Seed, int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_MaxRoadDepth, int a_MaxSize, int a_Density, cVillagePiecePool &a_Prefabs, cTerrainHeightGen &a_HeightGen) | |
![]() | |
cStructure (int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) | |
Creates a structure that has its origin set at the specified coords. More... | |
virtual size_t | GetCacheCost (void) const |
Returns the cost of keeping this structure in the cache. More... | |
virtual | ~cStructure () |
Protected Member Functions | |
virtual void | DrawIntoChunk (cChunkDesc &a_Chunk) override |
Draws self into the specified chunk. More... | |
void | DrawRoad (cChunkDesc &a_Chunk, cPlacedPiece &a_Road, cChunkDef::HeightMap &a_HeightMap) |
Draws the road into the chunk. More... | |
virtual cPieces | GetPiecesWithConnector (int a_ConnectorType) override |
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) override |
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) override |
Returns the pieces that should be used as the starting point. More... | |
virtual int | GetStartingPieceWeight (const cPiece &a_NewPiece) override |
Returns the relative weight with which the a_NewPiece is to be selected for placing as the first piece. More... | |
void | MoveAllDescendants (cPlacedPieces &a_PlacedPieces, size_t a_Pivot, int a_HeightDifference) |
virtual void | PiecePlaced (const cPiece &a_Piece) override |
Called after a piece is placed, to notify the pool that it has been used. More... | |
void | PlacePieceOnGround (cPlacedPiece &a_Piece) |
Adjusts the Y coord of the given piece so that the piece is on the ground. More... | |
virtual void | Reset (void) override |
Called when the pool has finished the current structure and should reset any piece-counters it has for a new structure. More... | |
![]() | |
virtual | ~cPiecePool () |
Protected Attributes | |
cCuboid | m_Borders |
Borders of the village - no item may reach out of this cuboid. More... | |
int | m_Density |
The density for this village. More... | |
cTerrainHeightGen & | m_HeightGen |
The underlying height generator, used for placing the structures on top of the terrain. More... | |
int | m_MaxSize |
Maximum size, in X / Z blocks, of the village (radius from the origin) More... | |
cNoise | m_Noise |
The noise used as a pseudo-random generator. More... | |
cPlacedPieces | m_Pieces |
The village pieces, placed by the generator. More... | |
cVillagePiecePool & | m_Prefabs |
Prefabs to use for buildings. More... | |
int | m_Seed |
Seed for the random functions. More... | |
Private Types | |
using | Super = cGridStructGen::cStructure |
Additional Inherited Members | |
![]() | |
int | m_GridX |
The grid point for which the structure is generated. More... | |
int | m_GridZ |
int | m_OriginX |
The origin (the coords for which the structure is generated) More... | |
int | m_OriginZ |
Definition at line 112 of file VillageGen.cpp.
|
private |
Definition at line 116 of file VillageGen.cpp.
|
inline |
Definition at line 120 of file VillageGen.cpp.
|
inlineoverrideprotectedvirtual |
Draws self into the specified chunk.
Implements cGridStructGen::cStructure.
Definition at line 179 of file VillageGen.cpp.
|
inlineprotected |
Draws the road into the chunk.
The heightmap is not queried from the heightgen, but is given via parameter, so that it may be queried just once for all roads in a chunk.
Definition at line 224 of file VillageGen.cpp.
|
inlineoverrideprotectedvirtual |
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.
Implements cPiecePool.
Definition at line 255 of file VillageGen.cpp.
|
inlineoverrideprotectedvirtual |
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 from cPiecePool.
Definition at line 267 of file VillageGen.cpp.
|
inlineoverrideprotectedvirtual |
Returns the pieces that should be used as the starting point.
Multiple starting points are supported, one of the returned piece will be chosen.
Implements cPiecePool.
Definition at line 261 of file VillageGen.cpp.
|
inlineoverrideprotectedvirtual |
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 from cPiecePool.
Definition at line 289 of file VillageGen.cpp.
|
inlineprotected |
Definition at line 307 of file VillageGen.cpp.
|
inlineoverrideprotectedvirtual |
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.
Implements cPiecePool.
Definition at line 295 of file VillageGen.cpp.
|
inlineprotected |
Adjusts the Y coord of the given piece so that the piece is on the ground.
Ground level is assumed to be represented by the first connector in the piece.
Definition at line 206 of file VillageGen.cpp.
|
inlineoverrideprotectedvirtual |
Called when the pool has finished the current structure and should reset any piece-counters it has for a new structure.
Implements cPiecePool.
Definition at line 301 of file VillageGen.cpp.
|
protected |
Borders of the village - no item may reach out of this cuboid.
Definition at line 166 of file VillageGen.cpp.
|
protected |
The density for this village.
Used to refrain from populating all house connectors. Range [0, 100]
Definition at line 163 of file VillageGen.cpp.
|
protected |
The underlying height generator, used for placing the structures on top of the terrain.
Definition at line 172 of file VillageGen.cpp.
|
protected |
Maximum size, in X / Z blocks, of the village (radius from the origin)
Definition at line 160 of file VillageGen.cpp.
|
protected |
The noise used as a pseudo-random generator.
Definition at line 157 of file VillageGen.cpp.
|
protected |
The village pieces, placed by the generator.
Definition at line 175 of file VillageGen.cpp.
|
protected |
Prefabs to use for buildings.
Definition at line 169 of file VillageGen.cpp.
|
protected |
Seed for the random functions.
Definition at line 154 of file VillageGen.cpp.