summaryrefslogtreecommitdiffstats
path: root/src/Generating/VillageGen.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-27 22:08:20 +0200
committermadmaxoft <github@xoft.cz>2014-05-27 22:08:20 +0200
commit6b41d1a4220aa032f53b67637bbc3276272e5047 (patch)
tree3d44a11e81992b9c122f0000f78d281b8119afc4 /src/Generating/VillageGen.cpp
parentFixed testing weights in PlainsVillages. (diff)
downloadcuberite-6b41d1a4220aa032f53b67637bbc3276272e5047.tar
cuberite-6b41d1a4220aa032f53b67637bbc3276272e5047.tar.gz
cuberite-6b41d1a4220aa032f53b67637bbc3276272e5047.tar.bz2
cuberite-6b41d1a4220aa032f53b67637bbc3276272e5047.tar.lz
cuberite-6b41d1a4220aa032f53b67637bbc3276272e5047.tar.xz
cuberite-6b41d1a4220aa032f53b67637bbc3276272e5047.tar.zst
cuberite-6b41d1a4220aa032f53b67637bbc3276272e5047.zip
Diffstat (limited to 'src/Generating/VillageGen.cpp')
-rw-r--r--src/Generating/VillageGen.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index cb1f4fe0d..dfcdf6ef7 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -5,6 +5,7 @@
#include "Globals.h"
#include "VillageGen.h"
+#include "Prefabs/AlchemistVillagePrefabs.h"
#include "Prefabs/JapaneseVillagePrefabs.h"
#include "Prefabs/PlainsVillagePrefabs.h"
#include "Prefabs/SandVillagePrefabs.h"
@@ -274,6 +275,12 @@ protected:
}
+ virtual int GetStartingPieceWeight(const cPiece & a_NewPiece) override
+ {
+ return m_Prefabs.GetStartingPieceWeight(a_NewPiece);
+ }
+
+
virtual void PiecePlaced(const cPiece & a_Piece) override
{
m_Prefabs.PiecePlaced(a_Piece);
@@ -311,18 +318,25 @@ protected:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cVillageGen:
-/** The prefabs for the sand village. */
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_AlchemistVillage(g_AlchemistVillagePrefabs, g_AlchemistVillagePrefabsCount, g_AlchemistVillageStartingPrefabs, g_AlchemistVillageStartingPrefabsCount);
static cVillagePiecePool g_PlainsVillage(g_PlainsVillagePrefabs, g_PlainsVillagePrefabsCount, g_PlainsVillageStartingPrefabs, g_PlainsVillageStartingPrefabsCount);
-
-/** The prefabs for the Japanese village. */
static cVillagePiecePool g_JapaneseVillage(g_JapaneseVillagePrefabs, g_JapaneseVillagePrefabsCount, g_JapaneseVillageStartingPrefabs, g_JapaneseVillageStartingPrefabsCount);
+static cVillagePiecePool * g_DesertVillagePools[] =
+{
+ &g_SandVillage,
+ &g_SandFlatRoofVillage,
+ &g_AlchemistVillage,
+} ;
+
+static cVillagePiecePool * g_PlainsVillagePools[] =
+{
+ &g_PlainsVillage,
+ &g_JapaneseVillage,
+} ;
+
@@ -356,8 +370,8 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_
cVillagePiecePool * VillagePrefabs = NULL;
BLOCKTYPE RoadBlock = E_BLOCK_GRAVEL;
int rnd = m_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) / 11;
- cVillagePiecePool * PlainsVillage = (rnd % 2 == 0) ? &g_PlainsVillage : &g_JapaneseVillage;
- cVillagePiecePool * DesertVillage = (rnd % 2 == 0) ? &g_SandVillage : &g_SandFlatRoofVillage;
+ cVillagePiecePool * PlainsVillage = g_PlainsVillagePools[rnd % ARRAYCOUNT(g_PlainsVillagePools)];
+ cVillagePiecePool * DesertVillage = g_DesertVillagePools[rnd % ARRAYCOUNT(g_DesertVillagePools)];
for (size_t i = 0; i < ARRAYCOUNT(Biomes); i++)
{
switch (Biomes[i])