summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-15 10:43:54 +0200
committermadmaxoft <github@xoft.cz>2014-05-15 10:43:54 +0200
commit34e5f0c16422f93d3f8f0f802522fa113fa9aa20 (patch)
tree82066f8347f9dc4d349b0213487e0ae2f326d6f5
parentVillageGen rewritten using BFSPieceGenerator. (diff)
downloadcuberite-34e5f0c16422f93d3f8f0f802522fa113fa9aa20.tar
cuberite-34e5f0c16422f93d3f8f0f802522fa113fa9aa20.tar.gz
cuberite-34e5f0c16422f93d3f8f0f802522fa113fa9aa20.tar.bz2
cuberite-34e5f0c16422f93d3f8f0f802522fa113fa9aa20.tar.lz
cuberite-34e5f0c16422f93d3f8f0f802522fa113fa9aa20.tar.xz
cuberite-34e5f0c16422f93d3f8f0f802522fa113fa9aa20.tar.zst
cuberite-34e5f0c16422f93d3f8f0f802522fa113fa9aa20.zip
-rw-r--r--src/Generating/Prefabs/PlainsVillagePrefabs.cpp8
-rw-r--r--src/Generating/Prefabs/SandVillagePrefabs.cpp8
-rw-r--r--src/Generating/VillageGen.cpp61
3 files changed, 38 insertions, 39 deletions
diff --git a/src/Generating/Prefabs/PlainsVillagePrefabs.cpp b/src/Generating/Prefabs/PlainsVillagePrefabs.cpp
index 508f0d3b6..06b1395c5 100644
--- a/src/Generating/Prefabs/PlainsVillagePrefabs.cpp
+++ b/src/Generating/Prefabs/PlainsVillagePrefabs.cpp
@@ -3691,10 +3691,10 @@ const cPrefab::sDef g_PlainsVillageStartingPrefabs[] =
/* 3 */ "bbbb",
// Connectors:
- "1: 1, 9, 3: 3\n" /* Type 1, direction Z+ */
- "1: 2, 9, 0: 2\n" /* Type 1, direction Z- */
- "1: 0, 9, 1: 4\n" /* Type 1, direction X- */
- "1: 3, 9, 2: 5\n" /* Type 1, direction X+ */,
+ "2: 1, 9, 3: 3\n" /* Type 2, direction Z+ */
+ "2: 2, 9, 0: 2\n" /* Type 2, direction Z- */
+ "2: 0, 9, 1: 4\n" /* Type 2, direction X- */
+ "2: 3, 9, 2: 5\n" /* Type 2, direction X+ */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
diff --git a/src/Generating/Prefabs/SandVillagePrefabs.cpp b/src/Generating/Prefabs/SandVillagePrefabs.cpp
index 51411dea2..8460ee5f7 100644
--- a/src/Generating/Prefabs/SandVillagePrefabs.cpp
+++ b/src/Generating/Prefabs/SandVillagePrefabs.cpp
@@ -1853,10 +1853,10 @@ const cPrefab::sDef g_SandVillageStartingPrefabs[] =
/* 3 */ "bbbb",
// Connectors:
- "1: 2, 8, 0: 2\n" /* Type 1, direction Z- */
- "1: 0, 8, 1: 4\n" /* Type 1, direction X- */
- "1: 1, 8, 3: 3\n" /* Type 1, direction Z+ */
- "1: 3, 8, 2: 5\n" /* Type 1, direction X+ */,
+ "2: 2, 8, 0: 2\n" /* Type 2, direction Z- */
+ "2: 0, 8, 1: 4\n" /* Type 2, direction X- */
+ "2: 1, 8, 3: 3\n" /* Type 2, direction Z+ */
+ "2: 3, 8, 2: 5\n" /* Type 2, direction X+ */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index 3358bc531..b514a90cd 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -44,43 +44,42 @@ public:
) :
super(a_PieceDefs, a_NumPieceDefs, a_StartingPieceDefs, a_NumStartingPieceDefs)
{
- // Add the road piece:
- cBlockArea BA;
- BA.Create(5, 1, 3, cBlockArea::baTypes | cBlockArea::baMetas);
- BA.Fill(cBlockArea::baTypes | cBlockArea::baMetas, E_BLOCK_GRAVEL, 0);
- cPrefab * RoadPiece = new cPrefab(BA, 7);
- RoadPiece->AddConnector(0, 0, 1, BLOCK_FACE_XM, -1);
- RoadPiece->AddConnector(4, 0, 1, BLOCK_FACE_XP, -1);
- RoadPiece->AddConnector(4, 0, 1, BLOCK_FACE_XP, 1);
- RoadPiece->AddConnector(1, 0, 0, BLOCK_FACE_ZM, 1);
- RoadPiece->AddConnector(3, 0, 0, BLOCK_FACE_ZM, 1);
- RoadPiece->AddConnector(1, 0, 2, BLOCK_FACE_ZP, 1);
- RoadPiece->AddConnector(3, 0, 2, BLOCK_FACE_ZP, 1);
- RoadPiece->SetAddWeightIfSame(10000);
- m_AllPieces.push_back(RoadPiece);
- m_PiecesByConnector[-1].push_back(RoadPiece);
- m_PiecesByConnector[1].push_back(RoadPiece);
+ // Add the road pieces:
+ for (int len = 19; len < 60; len += 8)
+ {
+ cBlockArea BA;
+ BA.Create(len, 1, 3, cBlockArea::baTypes | cBlockArea::baMetas);
+ BA.Fill(cBlockArea::baTypes | cBlockArea::baMetas, E_BLOCK_GRAVEL, 0);
+ cPrefab * RoadPiece = new cPrefab(BA, 1);
+ RoadPiece->AddConnector(0, 0, 1, BLOCK_FACE_XM, -2);
+ RoadPiece->AddConnector(len - 1, 0, 1, BLOCK_FACE_XP, -2);
+
+ // Add the road connectors:
+ for (int x = 1; x < len; x += 8)
+ {
+ RoadPiece->AddConnector(x, 0, 0, BLOCK_FACE_ZM, 2);
+ RoadPiece->AddConnector(x, 0, 2, BLOCK_FACE_ZP, 2);
+ }
+
+ // Add the buildings connectors:
+ for (int x = 5; x < len; x += 8)
+ {
+ RoadPiece->AddConnector(x, 0, 0, BLOCK_FACE_ZM, 1);
+ RoadPiece->AddConnector(x, 0, 2, BLOCK_FACE_ZP, 1);
+ }
+ m_AllPieces.push_back(RoadPiece);
+ m_PiecesByConnector[-2].push_back(RoadPiece);
+ m_PiecesByConnector[1].push_back(RoadPiece);
+ m_PiecesByConnector[2].push_back(RoadPiece);
+ } // for len - roads of varying length
}
// cPrefabPiecePool overrides:
virtual int GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) override
{
- // Only roads are allowed to connect to the well:
- if ((a_PlacedPiece.GetDepth() == 0) && (a_NewPiece.GetSize().y != 1))
- {
- return 0;
- }
-
- // Roads cannot branch T-wise:
- if (
- (a_PlacedPiece.GetPiece().GetSize().y == 1) && // Connecting to a road
- (
- (a_ExistingConnector.m_Direction == BLOCK_FACE_ZP) ||
- (a_ExistingConnector.m_Direction == BLOCK_FACE_ZM)
- ) && // Through the long-edge connector
- (a_NewPiece.GetSize().y == 1) // And the new piece is a road
- )
+ // Roads cannot branch T-wise (appending -2 connector to a +2 connector):
+ if ((a_ExistingConnector.m_Type == 2) && (a_PlacedPiece.GetDepth() > 0))
{
return 0;
}