From efcae77828d52680f9521793520ffc4325b465b8 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 21 May 2014 23:16:43 +0200 Subject: Added second kind of desert village (FlatRoof). --- src/Generating/VillageGen.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/Generating/VillageGen.cpp') 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; } -- cgit v1.2.3