summaryrefslogtreecommitdiffstats
path: root/src/Generating/VillageGen.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-21 23:16:43 +0200
committermadmaxoft <github@xoft.cz>2014-05-21 23:16:43 +0200
commitefcae77828d52680f9521793520ffc4325b465b8 (patch)
treea617fe871f9ee9348be96059f2dadd42f9520bb1 /src/Generating/VillageGen.cpp
parentMerged branch 'master' into VillageGen. (diff)
downloadcuberite-efcae77828d52680f9521793520ffc4325b465b8.tar
cuberite-efcae77828d52680f9521793520ffc4325b465b8.tar.gz
cuberite-efcae77828d52680f9521793520ffc4325b465b8.tar.bz2
cuberite-efcae77828d52680f9521793520ffc4325b465b8.tar.lz
cuberite-efcae77828d52680f9521793520ffc4325b465b8.tar.xz
cuberite-efcae77828d52680f9521793520ffc4325b465b8.tar.zst
cuberite-efcae77828d52680f9521793520ffc4325b465b8.zip
Diffstat (limited to 'src/Generating/VillageGen.cpp')
-rw-r--r--src/Generating/VillageGen.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index 520d63029..862aa966f 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -7,6 +7,7 @@
#include "VillageGen.h"
#include "Prefabs/PlainsVillagePrefabs.h"
#include "Prefabs/SandVillagePrefabs.h"
+#include "Prefabs/SandFlatRoofVillagePrefabs.h"
#include "PieceGenerator.h"
@@ -25,8 +26,8 @@ the roads and houses are then used as the following pieces. Only the houses are
though, the roads are generated by code and their content is ignored. A special subclass of the cPiecePool
class is used, so that the roads connect to each other and to the well only in predefined manners.
-The well has connectors of type "1". The houses have connectors of type "-1". The roads have connectors of
-both types, type "-1" at the far ends and type "1" on the long edges.
+The well has connectors of type "2". The houses have connectors of type "-1". The roads have connectors of
+both types' opposites, type "-2" at the far ends and type "1" on the long edges.
When the village is about to be drawn into a chunk, it queries the heights for each piece intersecting the
chunk. The pieces are shifted so that their pivot points lie on the surface, and the roads are drawn
@@ -220,7 +221,10 @@ protected:
// cVillageGen:
/** The prefabs for the sand village. */
-static cVillagePiecePool g_SandVillage (g_SandVillagePrefabs, g_SandVillagePrefabsCount, g_SandVillageStartingPrefabs, g_SandVillageStartingPrefabsCount);
+static cVillagePiecePool g_SandVillage(g_SandVillagePrefabs, g_SandVillagePrefabsCount, g_SandVillageStartingPrefabs, g_SandVillageStartingPrefabsCount);
+
+/** The prefabs for the flat-roofed sand village. */
+static cVillagePiecePool g_SandFlatRoofVillage(g_SandFlatRoofVillagePrefabs, g_SandFlatRoofVillagePrefabsCount, g_SandFlatRoofVillageStartingPrefabs, g_SandFlatRoofVillageStartingPrefabsCount);
/** The prefabs for the plains village. */
static cVillagePiecePool g_PlainsVillage(g_PlainsVillagePrefabs, g_PlainsVillagePrefabsCount, g_PlainsVillageStartingPrefabs, g_PlainsVillageStartingPrefabsCount);
@@ -254,6 +258,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_
// If just one is not, no village is created, because it's likely that an unfriendly biome is too close
cVillagePiecePool * VillagePrefabs = NULL;
BLOCKTYPE RoadBlock = E_BLOCK_GRAVEL;
+ int rnd = (a_OriginX + 21 * a_OriginZ + 985) / 11;
for (size_t i = 0; i < ARRAYCOUNT(Biomes); i++)
{
switch (Biomes[i])
@@ -262,7 +267,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_
case biDesertM:
{
// These biomes allow sand villages
- VillagePrefabs = &g_SandVillage;
+ VillagePrefabs = (rnd % 2 == 0) ? &g_SandVillage : &g_SandFlatRoofVillage;
RoadBlock = E_BLOCK_SANDSTONE;
break;
}