summaryrefslogtreecommitdiffstats
path: root/src/Generating/PrefabStructure.h
blob: 1b781c4e10586069aa8cf45d1984e2807171c32b (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

// PrefabStructure.h

// Declares the cPrefabStructure class representing a cGridStructGen::cStructure descendant based on placed cPrefab
// instances





#pragma once

#include "GridStructGen.h"
#include "PiecePool.h"





class cPrefabStructure : public cGridStructGen::cStructure
{
	using Super = cGridStructGen::cStructure;

  public:
	cPrefabStructure(
		int a_GridX,
		int a_GridZ,
		int a_OriginX,
		int a_OriginZ,
		cPlacedPieces && a_Pieces,
		cTerrainHeightGen & a_HeightGen
	);

  protected:
	/** The pieces placed by the generator. */
	cPlacedPieces m_Pieces;

	/** The height generator used when adjusting pieces onto the ground. */
	cTerrainHeightGen & m_HeightGen;


	// cGridStructGen::cStructure overrides:
	virtual void DrawIntoChunk(cChunkDesc & a_Chunk) override;

	/**  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. */
	void PlacePieceOnGround(cPlacedPiece & a_Piece);
};