1
0

Added AlchemistVillage prefabs (Thanks, KingsCraftAu).

This commit is contained in:
madmaxoft 2014-05-27 22:08:20 +02:00
parent 71256c98ed
commit 6b41d1a422
3 changed files with 3007 additions and 9 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
// AlchemistVillagePrefabs.h
// Declares the prefabs in the group AlchemistVillage
#include "../Prefab.h"
extern const cPrefab::sDef g_AlchemistVillagePrefabs[];
extern const cPrefab::sDef g_AlchemistVillageStartingPrefabs[];
extern const size_t g_AlchemistVillagePrefabsCount;
extern const size_t g_AlchemistVillageStartingPrefabsCount;

View File

@ -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])