Added second kind of desert village (FlatRoof).
This commit is contained in:
parent
e69a11012f
commit
efcae77828
1511
src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp
Normal file
1511
src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp
Normal file
File diff suppressed because it is too large
Load Diff
15
src/Generating/Prefabs/SandFlatRoofVillagePrefabs.h
Normal file
15
src/Generating/Prefabs/SandFlatRoofVillagePrefabs.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
// SandFlatRoofVillagePrefabs.h
|
||||||
|
|
||||||
|
// Declares the prefabs in the group SandFlatRoofVillage
|
||||||
|
|
||||||
|
#include "../Prefab.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern const cPrefab::sDef g_SandFlatRoofVillagePrefabs[];
|
||||||
|
extern const cPrefab::sDef g_SandFlatRoofVillageStartingPrefabs[];
|
||||||
|
extern const size_t g_SandFlatRoofVillagePrefabsCount;
|
||||||
|
extern const size_t g_SandFlatRoofVillageStartingPrefabsCount;
|
@ -7,6 +7,7 @@
|
|||||||
#include "VillageGen.h"
|
#include "VillageGen.h"
|
||||||
#include "Prefabs/PlainsVillagePrefabs.h"
|
#include "Prefabs/PlainsVillagePrefabs.h"
|
||||||
#include "Prefabs/SandVillagePrefabs.h"
|
#include "Prefabs/SandVillagePrefabs.h"
|
||||||
|
#include "Prefabs/SandFlatRoofVillagePrefabs.h"
|
||||||
#include "PieceGenerator.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
|
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.
|
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
|
The well has connectors of type "2". 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.
|
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
|
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
|
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:
|
// cVillageGen:
|
||||||
|
|
||||||
/** The prefabs for the sand village. */
|
/** 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. */
|
/** The prefabs for the plains village. */
|
||||||
static cVillagePiecePool g_PlainsVillage(g_PlainsVillagePrefabs, g_PlainsVillagePrefabsCount, g_PlainsVillageStartingPrefabs, g_PlainsVillageStartingPrefabsCount);
|
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
|
// If just one is not, no village is created, because it's likely that an unfriendly biome is too close
|
||||||
cVillagePiecePool * VillagePrefabs = NULL;
|
cVillagePiecePool * VillagePrefabs = NULL;
|
||||||
BLOCKTYPE RoadBlock = E_BLOCK_GRAVEL;
|
BLOCKTYPE RoadBlock = E_BLOCK_GRAVEL;
|
||||||
|
int rnd = (a_OriginX + 21 * a_OriginZ + 985) / 11;
|
||||||
for (size_t i = 0; i < ARRAYCOUNT(Biomes); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(Biomes); i++)
|
||||||
{
|
{
|
||||||
switch (Biomes[i])
|
switch (Biomes[i])
|
||||||
@ -262,7 +267,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_
|
|||||||
case biDesertM:
|
case biDesertM:
|
||||||
{
|
{
|
||||||
// These biomes allow sand villages
|
// These biomes allow sand villages
|
||||||
VillagePrefabs = &g_SandVillage;
|
VillagePrefabs = (rnd % 2 == 0) ? &g_SandVillage : &g_SandFlatRoofVillage;
|
||||||
RoadBlock = E_BLOCK_SANDSTONE;
|
RoadBlock = E_BLOCK_SANDSTONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user