summaryrefslogtreecommitdiffstats
path: root/src/Generating/MineShafts.h
blob: c53d3bc532221cf17e6b151994a27486c65d86c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

// MineShafts.h

// Declares the cStructGenMineShafts class representing the structure generator for abandoned mineshafts





#pragma once

#include "ComposableGenerator.h"
#include "../Noise.h"





class cStructGenMineShafts :
	public cStructureGen
{
public:
	cStructGenMineShafts(
		int a_Seed, int a_GridSize, int a_MaxSystemSize,
		int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase
	);
	
	virtual ~cStructGenMineShafts();
	
protected:
	friend class cMineShaft;
	friend class cMineShaftDirtRoom;
	friend class cMineShaftCorridor;
	friend class cMineShaftCrossing;
	friend class cMineShaftStaircase;
	class cMineShaftSystem;  // fwd: MineShafts.cpp
	typedef std::list<cMineShaftSystem *> cMineShaftSystems;
	
	cNoise            m_Noise;
	int               m_GridSize;            ///< Average spacing of the systems
	int               m_MaxSystemSize;       ///< Maximum blcok size of a mineshaft system
	int               m_ProbLevelCorridor;   ///< Probability level of a branch object being the corridor
	int               m_ProbLevelCrossing;   ///< Probability level of a branch object being the crossing, minus Corridor
	int               m_ProbLevelStaircase;  ///< Probability level of a branch object being the staircase, minus Crossing
	cMineShaftSystems m_Cache;               ///< Cache of the most recently used systems. MoveToFront used.
	
	/// Clears everything from the cache
	void ClearCache(void);
	
	/** Returns all systems that *may* intersect the given chunk.
	All the systems are valid until the next call to this function (which may delete some of the pointers).
	*/
	void GetMineShaftSystemsForChunk(int a_ChunkX, int a_ChunkZ, cMineShaftSystems & a_MineShaftSystems);

	// cStructureGen overrides:
	virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
} ;