diff options
author | madmaxoft <github@xoft.cz> | 2014-03-30 19:17:33 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-03-30 19:17:33 +0200 |
commit | 1bda9b042403bbc20c564a582435a083fc4dcc84 (patch) | |
tree | 8210ebddd8925889c31d3b4fb77e813b3aea6ec1 /src/Generating/NetherFortGen.h | |
parent | APIDump: Added article: Setting up ZeroBrane Studio. (diff) | |
parent | Added all current NetherFort prefabs. (diff) | |
download | cuberite-1bda9b042403bbc20c564a582435a083fc4dcc84.tar cuberite-1bda9b042403bbc20c564a582435a083fc4dcc84.tar.gz cuberite-1bda9b042403bbc20c564a582435a083fc4dcc84.tar.bz2 cuberite-1bda9b042403bbc20c564a582435a083fc4dcc84.tar.lz cuberite-1bda9b042403bbc20c564a582435a083fc4dcc84.tar.xz cuberite-1bda9b042403bbc20c564a582435a083fc4dcc84.tar.zst cuberite-1bda9b042403bbc20c564a582435a083fc4dcc84.zip |
Diffstat (limited to 'src/Generating/NetherFortGen.h')
-rw-r--r-- | src/Generating/NetherFortGen.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/Generating/NetherFortGen.h b/src/Generating/NetherFortGen.h new file mode 100644 index 000000000..10ba01396 --- /dev/null +++ b/src/Generating/NetherFortGen.h @@ -0,0 +1,86 @@ + +// NetherFortGen.h + +// Declares the cNetherFortGen class representing the nether fortress generator + + + + + +#pragma once + +#include "ComposableGenerator.h" +#include "PieceGenerator.h" + + + + + +class cNetherFortGen : + public cFinishGen, + public cPiecePool +{ +public: + cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth); + + virtual ~cNetherFortGen(); + +protected: + class cNetherFort; // fwd: NetherFortGen.cpp + typedef std::list<cNetherFort *> cNetherForts; + + + /** The seed used for generating*/ + int m_Seed; + + /** The noise used for generating */ + cNoise m_Noise; + + /** Average spacing between the fortresses*/ + int m_GridSize; + + /** Maximum depth of the piece-generator tree */ + int m_MaxDepth; + + /** Cache of the most recently used systems. MoveToFront used. */ + cNetherForts m_Cache; + + /** All the pieces that are allowed for building. + This is the list that's used for memory allocation and deallocation for the pieces. */ + cPieces m_AllPieces; + + /** The pieces that are used as starting pieces. + This list is not shared and the pieces need deallocation. */ + cPieces m_StartingPieces; + + /** The pieces that have an "outer" connector. + The pieces are copies out of m_AllPieces and shouldn't be ever delete-d. */ + cPieces m_OuterPieces; + + /** The pieces that have an "inner" connector. + The pieces are copies out of m_AllPieces and shouldn't be ever delete-d. */ + cPieces m_InnerPieces; + + + /** Clears everything from the cache. + Also invalidates the forst returned by GetFortsForChunk(). */ + void ClearCache(void); + + /** Returns all forts that *may* intersect the given chunk. + The returned forts live within m_Cache.They are valid until the next call + to this function (which may delete some of the pointers). */ + void GetFortsForChunk(int a_ChunkX, int a_ChunkZ, cNetherForts & a_Forts); + + // cFinishGen overrides: + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; + + // cPiecePool overrides: + virtual cPieces GetPiecesWithConnector(int a_ConnectorType) override; + virtual cPieces GetStartingPieces(void) override; + virtual void PiecePlaced(const cPiece & a_Piece) override; + virtual void Reset(void) override; +} ; + + + + |