13 #include "../Noise/Noise.h"
60 cStructure (
int a_GridX,
int a_GridZ,
int a_OriginX,
int a_OriginZ) :
83 int a_GridSizeX,
int a_GridSizeZ,
84 int a_MaxOffsetX,
int a_MaxOffsetZ,
85 int a_MaxStructureSizeX,
int a_MaxStructureSizeZ,
std::map< AString, AString > AStringMap
A string dictionary, used for key-value pairs.
The interface that a finisher must implement Finisher implements changes to the chunk after the rough...
Generates structures in a semi-random grid.
int m_MaxStructureSizeZ
Maximum theoretical size of the structure in the Z axis.
std::shared_ptr< cStructure > cStructurePtr
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
cGridStructGen(int a_Seed, int a_GridSizeX, int a_GridSizeZ, int a_MaxOffsetX, int a_MaxOffsetZ, int a_MaxStructureSizeX, int a_MaxStructureSizeZ, size_t a_MaxCacheSize)
int m_MaxOffsetX
The maximum offset of the structure's origin from the grid midpoint, in X coord.
int m_GridSizeX
The size of each grid's cell in the X axis.
int m_Seed
Seed for generating grid offsets and also available for descendants.
virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)=0
Create a new structure at the specified gridpoint.
int m_MaxOffsetZ
The maximum offset of the structure's origin from the grid midpoint, in Z coord.
void GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructurePtrs &a_Structures)
Returns all structures that may intersect the given chunk.
int m_MaxStructureSizeX
Maximum theoretical size of the structure in the X axis.
void ClearCache(void)
Clears everything from the cache.
void SetGeneratorParams(const AStringMap &a_GeneratorParams)
Sets the generator params based on the dictionary passed in.
std::list< cStructurePtr > cStructurePtrs
cStructurePtrs m_Cache
Cache for the most recently generated structures, ordered by the recentness.
cNoise m_Noise
The noise used for generating grid offsets.
int m_GridSizeZ
The size of each grid's cell in the Z axis.
size_t m_MaxCacheSize
Maximum allowed sum of costs for items in the cache.
int m_BaseSeed
Base seed of the world for which the generator generates chunk.
Represents a single structure that occupies the grid point.
virtual void DrawIntoChunk(cChunkDesc &a_ChunkDesc)=0
Draws self into the specified chunk.
virtual size_t GetCacheCost(void) const
Returns the cost of keeping this structure in the cache.
int m_GridX
The grid point for which the structure is generated.
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.
int m_OriginX
The origin (the coords for which the structure is generated)