summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-06-16 16:22:02 +0200
committerTycho <work.tycho+git@gmail.com>2014-06-16 16:22:02 +0200
commitd5c84b5fe6358c0763f2b5695914ff34c74dd912 (patch)
tree96b703b1a7e052f74a8d270fb0278e5acb70435a /src
parentMoved repeater handling to seperate pass (diff)
parentMerge branch 'master' of github.com:mc-server/MCServer (diff)
downloadcuberite-d5c84b5fe6358c0763f2b5695914ff34c74dd912.tar
cuberite-d5c84b5fe6358c0763f2b5695914ff34c74dd912.tar.gz
cuberite-d5c84b5fe6358c0763f2b5695914ff34c74dd912.tar.bz2
cuberite-d5c84b5fe6358c0763f2b5695914ff34c74dd912.tar.lz
cuberite-d5c84b5fe6358c0763f2b5695914ff34c74dd912.tar.xz
cuberite-d5c84b5fe6358c0763f2b5695914ff34c74dd912.tar.zst
cuberite-d5c84b5fe6358c0763f2b5695914ff34c74dd912.zip
Diffstat (limited to '')
-rw-r--r--src/AllocationPool.h109
-rw-r--r--src/Chunk.cpp4
-rw-r--r--src/Chunk.h3
-rw-r--r--src/ChunkData.cpp25
-rw-r--r--src/ChunkData.h54
-rw-r--r--src/ChunkMap.cpp20
-rw-r--r--src/ChunkMap.h27
-rw-r--r--src/Entities/Entity.cpp38
-rw-r--r--src/Entities/Entity.h35
-rw-r--r--src/Entities/Player.cpp30
-rw-r--r--src/Entities/Player.h11
-rw-r--r--src/Generating/Caves.cpp10
-rw-r--r--src/Generating/Caves.h4
-rw-r--r--src/Generating/ComposableGenerator.cpp36
-rw-r--r--src/Generating/GridStructGen.cpp31
-rw-r--r--src/Generating/GridStructGen.h33
-rw-r--r--src/Generating/MineShafts.cpp16
-rw-r--r--src/Generating/MineShafts.h4
-rw-r--r--src/Generating/NetherFortGen.cpp15
-rw-r--r--src/Generating/NetherFortGen.h4
-rw-r--r--src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp669
-rw-r--r--src/Generating/RainbowRoadsGen.cpp11
-rw-r--r--src/Generating/RainbowRoadsGen.h4
-rw-r--r--src/Generating/Ravines.cpp12
-rw-r--r--src/Generating/Ravines.h2
-rw-r--r--src/Generating/UnderwaterBaseGen.cpp11
-rw-r--r--src/Generating/UnderwaterBaseGen.h4
-rw-r--r--src/Generating/VillageGen.cpp11
-rw-r--r--src/Generating/VillageGen.h4
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp37
30 files changed, 819 insertions, 455 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
new file mode 100644
index 000000000..5d749a79e
--- /dev/null
+++ b/src/AllocationPool.h
@@ -0,0 +1,109 @@
+
+#pragma once
+
+#include <memory>
+
+template<class T>
+class cAllocationPool
+{
+public:
+ class cStarvationCallbacks
+ {
+ public:
+ virtual ~cStarvationCallbacks() {}
+
+ /** Is called when the reserve buffer starts to be used **/
+ virtual void OnStartUsingReserve() = 0;
+
+ /** Is called once the reserve buffer has returned to normal size **/
+ virtual void OnEndUsingReserve() = 0;
+
+ /** Is called when the allocation pool is unable to allocate memory. Will be repeatedly
+ called if it does not free sufficient memory **/
+ virtual void OnOutOfReserve() = 0;
+ };
+
+ virtual ~cAllocationPool() {}
+
+ /** Allocates a pointer to T **/
+ virtual T * Allocate() = 0;
+
+ /** Frees the pointer passed in a_ptr, invalidating it **/
+ virtual void Free(T * a_ptr) = 0;
+};
+
+/** Allocates memory storing unused elements in a linked list. Keeps at least NumElementsInReserve
+elements in the list unless malloc fails so that the program has a reserve to handle OOM.**/
+template<class T, size_t NumElementsInReserve>
+class cListAllocationPool : public cAllocationPool<T>
+{
+ public:
+
+ cListAllocationPool(std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> a_Callbacks) :
+ m_Callbacks(a_Callbacks)
+ {
+ for (size_t i = 0; i < NumElementsInReserve; i++)
+ {
+ void * space = malloc(sizeof(T));
+ if (space == NULL)
+ {
+ m_Callbacks->OnStartUsingReserve();
+ break;
+ }
+ m_FreeList.push_front(space);
+ }
+ }
+
+ virtual ~cListAllocationPool()
+ {
+ while (!m_FreeList.empty())
+ {
+ free (m_FreeList.front());
+ m_FreeList.pop_front();
+ }
+ }
+
+ virtual T * Allocate() override
+ {
+ if (m_FreeList.size() <= NumElementsInReserve)
+ {
+ void * space = malloc(sizeof(T));
+ if (space != NULL)
+ {
+ return new(space) T;
+ }
+ else if (m_FreeList.size() == NumElementsInReserve)
+ {
+ m_Callbacks->OnStartUsingReserve();
+ }
+ else if (m_FreeList.empty())
+ {
+ m_Callbacks->OnOutOfReserve();
+ // Try again until the memory is avalable
+ return Allocate();
+ }
+ }
+ // placement new, used to initalize the object
+ T * ret = new (m_FreeList.front()) T;
+ m_FreeList.pop_front();
+ return ret;
+ }
+ virtual void Free(T * a_ptr) override
+ {
+ if (a_ptr == NULL)
+ {
+ return;
+ }
+ // placement destruct.
+ a_ptr->~T();
+ m_FreeList.push_front(a_ptr);
+ if (m_FreeList.size() == NumElementsInReserve)
+ {
+ m_Callbacks->OnEndUsingReserve();
+ }
+ }
+
+ private:
+ std::list<void *> m_FreeList;
+ std::auto_ptr<typename cAllocationPool<T>::cStarvationCallbacks> m_Callbacks;
+};
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 44fcefbe1..4703e4536 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -64,7 +64,8 @@ sSetBlock::sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_Bloc
cChunk::cChunk(
int a_ChunkX, int a_ChunkY, int a_ChunkZ,
cChunkMap * a_ChunkMap, cWorld * a_World,
- cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP
+ cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP,
+ cAllocationPool<cChunkData::sChunkSection> & a_Pool
) :
m_IsValid(false),
m_IsLightValid(false),
@@ -77,6 +78,7 @@ cChunk::cChunk(
m_PosZ(a_ChunkZ),
m_World(a_World),
m_ChunkMap(a_ChunkMap),
+ m_ChunkData(a_Pool),
m_BlockTickX(0),
m_BlockTickY(0),
m_BlockTickZ(0),
diff --git a/src/Chunk.h b/src/Chunk.h
index dfdabea04..7664a7afd 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -65,7 +65,8 @@ public:
cChunk(
int a_ChunkX, int a_ChunkY, int a_ChunkZ, // Chunk coords
cChunkMap * a_ChunkMap, cWorld * a_World, // Parent objects
- cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP // Neighbor chunks
+ cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP, // Neighbor chunks
+ cAllocationPool<cChunkData::sChunkSection> & a_Pool
);
cChunk(cChunk & other);
~cChunk();
diff --git a/src/ChunkData.cpp b/src/ChunkData.cpp
index f2d220bd2..03b0224a6 100644
--- a/src/ChunkData.cpp
+++ b/src/ChunkData.cpp
@@ -27,11 +27,12 @@ template <typename T> inline bool IsAllValue(const T * a_Array, size_t a_NumElem
-cChunkData::cChunkData(void)
+cChunkData::cChunkData(cAllocationPool<cChunkData::sChunkSection> & a_Pool) :
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
- : m_IsOwner(true)
+ m_IsOwner(true),
#endif
+ m_Pool(a_Pool)
{
for (size_t i = 0; i < NumSections; i++)
{
@@ -66,7 +67,8 @@ cChunkData::~cChunkData()
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
cChunkData::cChunkData(const cChunkData & a_Other) :
- m_IsOwner(true)
+ m_IsOwner(true),
+ m_Pool(a_Other.m_Pool)
{
// Move contents and ownership from a_Other to this, pointer-wise:
for (size_t i = 0; i < NumSections; i++)
@@ -97,7 +99,7 @@ cChunkData::~cChunkData()
m_Sections[i] = NULL;
}
}
-
+
// Move contents and ownership from a_Other to this, pointer-wise:
m_IsOwner = true;
for (size_t i = 0; i < NumSections; i++)
@@ -105,13 +107,15 @@ cChunkData::~cChunkData()
m_Sections[i] = a_Other.m_Sections[i];
}
a_Other.m_IsOwner = false;
+ ASSERT(&m_Pool == &a_Other.m_Pool);
return *this;
}
#else
// unique_ptr style interface for memory management
- cChunkData::cChunkData(cChunkData && other)
+ cChunkData::cChunkData(cChunkData && other) :
+ m_Pool(other.m_Pool)
{
for (size_t i = 0; i < NumSections; i++)
{
@@ -128,6 +132,7 @@ cChunkData::~cChunkData()
{
if (&other != this)
{
+ ASSERT(&m_Pool == &other.m_Pool);
for (size_t i = 0; i < NumSections; i++)
{
Free(m_Sections[i]);
@@ -317,12 +322,12 @@ NIBBLETYPE cChunkData::GetSkyLight(int a_RelX, int a_RelY, int a_RelZ) const
cChunkData cChunkData::Copy(void) const
{
- cChunkData copy;
+ cChunkData copy(m_Pool);
for (size_t i = 0; i < NumSections; i++)
{
if (m_Sections[i] != NULL)
{
- copy.m_Sections[i] = Allocate();
+ copy.m_Sections[i] = copy.Allocate();
*copy.m_Sections[i] = *m_Sections[i];
}
}
@@ -561,8 +566,7 @@ void cChunkData::SetSkyLight(const NIBBLETYPE * a_Src)
cChunkData::sChunkSection * cChunkData::Allocate(void)
{
- // TODO: Use an allocation pool
- return new cChunkData::sChunkSection;
+ return m_Pool.Allocate();
}
@@ -571,8 +575,7 @@ cChunkData::sChunkSection * cChunkData::Allocate(void)
void cChunkData::Free(cChunkData::sChunkSection * a_Section)
{
- // TODO: Use an allocation pool
- delete a_Section;
+ m_Pool.Free(a_Section);
}
diff --git a/src/ChunkData.h b/src/ChunkData.h
index fef31b5ad..fe8b068a2 100644
--- a/src/ChunkData.h
+++ b/src/ChunkData.h
@@ -15,6 +15,7 @@
#include "ChunkDef.h"
+#include "AllocationPool.h"
@@ -26,9 +27,17 @@
class cChunkData
{
+private:
+
+ static const size_t SectionHeight = 16;
+ static const size_t NumSections = (cChunkDef::Height / SectionHeight);
+ static const size_t SectionBlockCount = SectionHeight * cChunkDef::Width * cChunkDef::Width;
+
public:
- cChunkData(void);
+ struct sChunkSection;
+
+ cChunkData(cAllocationPool<cChunkData::sChunkSection> & a_Pool);
~cChunkData();
#if __cplusplus < 201103L
@@ -53,17 +62,17 @@ public:
/** Creates a (deep) copy of self. */
cChunkData Copy(void) const;
-
+
/** Copies the blocktype data into the specified flat array.
Optionally, only a part of the data is copied, as specified by the a_Idx and a_Length parameters. */
void CopyBlockTypes(BLOCKTYPE * a_Dest, size_t a_Idx = 0, size_t a_Length = cChunkDef::NumBlocks) const;
-
+
/** Copies the metadata into the specified flat array. */
void CopyMetas(NIBBLETYPE * a_Dest) const;
-
+
/** Copies the block light data into the specified flat array. */
void CopyBlockLight(NIBBLETYPE * a_Dest) const;
-
+
/** Copies the skylight data into the specified flat array. */
void CopySkyLight (NIBBLETYPE * a_Dest) const;
@@ -71,12 +80,12 @@ public:
Allocates sections that are needed for the operation.
Requires that a_Src is a valid pointer. */
void SetBlockTypes(const BLOCKTYPE * a_Src);
-
+
/** Copies the metadata from the specified flat array into the internal representation.
Allocates sectios that are needed for the operation.
Requires that a_Src is a valid pointer. */
void SetMetas(const NIBBLETYPE * a_Src);
-
+
/** Copies the blocklight data from the specified flat array into the internal representation.
Allocates sectios that are needed for the operation.
Allows a_Src to be NULL, in which case it doesn't do anything. */
@@ -86,36 +95,35 @@ public:
Allocates sectios that are needed for the operation.
Allows a_Src to be NULL, in which case it doesn't do anything. */
void SetSkyLight(const NIBBLETYPE * a_Src);
+
+ struct sChunkSection
+ {
+ BLOCKTYPE m_BlockTypes [SectionHeight * 16 * 16] ;
+ NIBBLETYPE m_BlockMetas [SectionHeight * 16 * 16 / 2];
+ NIBBLETYPE m_BlockLight [SectionHeight * 16 * 16 / 2];
+ NIBBLETYPE m_BlockSkyLight[SectionHeight * 16 * 16 / 2];
+ };
private:
-
- static const size_t SectionHeight = 16;
- static const size_t NumSections = (cChunkDef::Height / SectionHeight);
- static const size_t SectionBlockCount = SectionHeight * cChunkDef::Width * cChunkDef::Width;
-
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
mutable bool m_IsOwner;
#endif
-
- struct sChunkSection {
- BLOCKTYPE m_BlockTypes [SectionBlockCount];
- NIBBLETYPE m_BlockMetas [SectionBlockCount / 2];
- NIBBLETYPE m_BlockLight [SectionBlockCount / 2];
- NIBBLETYPE m_BlockSkyLight[SectionBlockCount / 2];
- };
-
+
sChunkSection * m_Sections[NumSections];
+
+ cAllocationPool<cChunkData::sChunkSection> & m_Pool;
/** Allocates a new section. Entry-point to custom allocators. */
- static sChunkSection * Allocate(void);
-
+ sChunkSection * Allocate(void);
+
/** Frees the specified section, previously allocated using Allocate().
Note that a_Section may be NULL. */
- static void Free(sChunkSection * a_Section);
+ void Free(sChunkSection * a_Section);
/** Sets the data in the specified section to their default values. */
void ZeroSection(sChunkSection * a_Section) const;
+
};
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index dba6f3f41..d2ccca94e 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -34,8 +34,15 @@
// cChunkMap:
cChunkMap::cChunkMap(cWorld * a_World )
- : m_World( a_World )
+ : m_World( a_World ),
+ m_Pool(
+ new cListAllocationPool<cChunkData::sChunkSection, 1600>(
+ std::auto_ptr<cAllocationPool<cChunkData::sChunkSection>::cStarvationCallbacks>(
+ new cStarvationCallbacks())
+ )
+ )
{
+
}
@@ -78,7 +85,7 @@ cChunkMap::cChunkLayer * cChunkMap::GetLayer(int a_LayerX, int a_LayerZ)
}
// Not found, create new:
- cChunkLayer * Layer = new cChunkLayer(a_LayerX, a_LayerZ, this);
+ cChunkLayer * Layer = new cChunkLayer(a_LayerX, a_LayerZ, this, *m_Pool);
if (Layer == NULL)
{
LOGERROR("cChunkMap: Cannot create new layer, server out of memory?");
@@ -2670,11 +2677,16 @@ void cChunkMap::QueueTickBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
////////////////////////////////////////////////////////////////////////////////
// cChunkMap::cChunkLayer:
-cChunkMap::cChunkLayer::cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Parent)
+cChunkMap::cChunkLayer::cChunkLayer(
+ int a_LayerX, int a_LayerZ,
+ cChunkMap * a_Parent,
+ cAllocationPool<cChunkData::sChunkSection> & a_Pool
+)
: m_LayerX( a_LayerX )
, m_LayerZ( a_LayerZ )
, m_Parent( a_Parent )
, m_NumChunksLoaded( 0 )
+ , m_Pool(a_Pool)
{
memset(m_Chunks, 0, sizeof(m_Chunks));
}
@@ -2716,7 +2728,7 @@ cChunkPtr cChunkMap::cChunkLayer::GetChunk( int a_ChunkX, int a_ChunkY, int a_Ch
cChunk * neixp = (LocalX < LAYER_SIZE - 1) ? m_Chunks[Index + 1] : m_Parent->FindChunk(a_ChunkX + 1, a_ChunkZ);
cChunk * neizm = (LocalZ > 0) ? m_Chunks[Index - LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ - 1);
cChunk * neizp = (LocalZ < LAYER_SIZE - 1) ? m_Chunks[Index + LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ + 1);
- m_Chunks[Index] = new cChunk(a_ChunkX, 0, a_ChunkZ, m_Parent, m_Parent->GetWorld(), neixm, neixp, neizm, neizp);
+ m_Chunks[Index] = new cChunk(a_ChunkX, 0, a_ChunkZ, m_Parent, m_Parent->GetWorld(), neixm, neixp, neizm, neizp, m_Pool);
}
return m_Chunks[Index];
}
diff --git a/src/ChunkMap.h b/src/ChunkMap.h
index 7e85bb6f1..5aad0dd2a 100644
--- a/src/ChunkMap.h
+++ b/src/ChunkMap.h
@@ -351,7 +351,11 @@ private:
class cChunkLayer
{
public:
- cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Parent);
+ cChunkLayer(
+ int a_LayerX, int a_LayerZ,
+ cChunkMap * a_Parent,
+ cAllocationPool<cChunkData::sChunkSection> & a_Pool
+ );
~cChunkLayer();
/** Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check */
@@ -395,6 +399,25 @@ private:
int m_LayerZ;
cChunkMap * m_Parent;
int m_NumChunksLoaded;
+
+ cAllocationPool<cChunkData::sChunkSection> & m_Pool;
+ };
+
+ class cStarvationCallbacks
+ : public cAllocationPool<cChunkData::sChunkSection>::cStarvationCallbacks
+ {
+ virtual void OnStartUsingReserve() override
+ {
+ LOG("Using backup memory buffer");
+ }
+ virtual void OnEndUsingReserve() override
+ {
+ LOG("Stoped using backup memory buffer");
+ }
+ virtual void OnOutOfReserve() override
+ {
+ LOG("Out of Memory");
+ }
};
typedef std::list<cChunkLayer *> cChunkLayerList;
@@ -427,6 +450,8 @@ private:
/** The cChunkStay descendants that are currently enabled in this chunkmap */
cChunkStays m_ChunkStays;
+ std::auto_ptr<cAllocationPool<cChunkData::sChunkSection>> m_Pool;
+
cChunkPtr GetChunk (int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Also queues the chunk for loading / generating if not valid
cChunkPtr GetChunkNoGen (int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Also queues the chunk for loading if not valid; doesn't generate
cChunkPtr GetChunkNoLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Doesn't load, doesn't generate
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 8f736a269..ee7ce06ac 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -179,14 +179,9 @@ void cEntity::WrapRotation(void)
void cEntity::WrapSpeed(void)
{
- // There shoudn't be a need for flipping the flag on because this function is called
- // after any update, so the flag is already turned on
- if (m_Speed.x > 78.0f) m_Speed.x = 78.0f;
- else if (m_Speed.x < -78.0f) m_Speed.x = -78.0f;
- if (m_Speed.y > 78.0f) m_Speed.y = 78.0f;
- else if (m_Speed.y < -78.0f) m_Speed.y = -78.0f;
- if (m_Speed.z > 78.0f) m_Speed.z = 78.0f;
- else if (m_Speed.z < -78.0f) m_Speed.z = -78.0f;
+ m_Speed.x = Clamp(m_Speed.x, -78.0, 78.0);
+ m_Speed.y = Clamp(m_Speed.y, -78.0, 78.0);
+ m_Speed.z = Clamp(m_Speed.z, -78.0, 78.0);
}
@@ -1076,6 +1071,17 @@ void cEntity::SetSwimState(cChunk & a_Chunk)
+void cEntity::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
+{
+ m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ);
+
+ WrapSpeed();
+}
+
+
+
+
+
void cEntity::HandleAir(void)
{
// Ref.: http://www.minecraftwiki.net/wiki/Chunk_format
@@ -1428,9 +1434,7 @@ void cEntity::SetRoll(double a_Roll)
void cEntity::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
{
- m_Speed.Set(a_SpeedX, a_SpeedY, a_SpeedZ);
-
- WrapSpeed();
+ DoSetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ);
}
@@ -1438,9 +1442,7 @@ void cEntity::SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
void cEntity::SetSpeedX(double a_SpeedX)
{
- m_Speed.x = a_SpeedX;
-
- WrapSpeed();
+ SetSpeed(a_SpeedX, m_Speed.y, m_Speed.z);
}
@@ -1448,9 +1450,7 @@ void cEntity::SetSpeedX(double a_SpeedX)
void cEntity::SetSpeedY(double a_SpeedY)
{
- m_Speed.y = a_SpeedY;
-
- WrapSpeed();
+ SetSpeed(m_Speed.x, a_SpeedY, m_Speed.z);
}
@@ -1458,9 +1458,7 @@ void cEntity::SetSpeedY(double a_SpeedY)
void cEntity::SetSpeedZ(double a_SpeedZ)
{
- m_Speed.z = a_SpeedZ;
-
- WrapSpeed();
+ SetSpeed(m_Speed.x, m_Speed.y, a_SpeedZ);
}
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 85ad42d54..2df66e353 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -215,11 +215,22 @@ public:
void SetYaw (double a_Yaw); // In degrees, normalizes to [-180, +180)
void SetPitch (double a_Pitch); // In degrees, normalizes to [-180, +180)
void SetRoll (double a_Roll); // In degrees, normalizes to [-180, +180)
- void SetSpeed (double a_SpeedX, double a_SpeedY, double a_SpeedZ);
- void SetSpeed (const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); }
- void SetSpeedX (double a_SpeedX);
- void SetSpeedY (double a_SpeedY);
- void SetSpeedZ (double a_SpeedZ);
+
+ /** Sets the speed of the entity, measured in m / sec */
+ void SetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ);
+
+ /** Sets the speed of the entity, measured in m / sec */
+ void SetSpeed(const Vector3d & a_Speed) { SetSpeed(a_Speed.x, a_Speed.y, a_Speed.z); }
+
+ /** Sets the speed in the X axis, leaving the other speed components intact. Measured in m / sec. */
+ void SetSpeedX(double a_SpeedX);
+
+ /** Sets the speed in the Y axis, leaving the other speed components intact. Measured in m / sec. */
+ void SetSpeedY(double a_SpeedY);
+
+ /** Sets the speed in the Z axis, leaving the other speed components intact. Measured in m / sec. */
+ void SetSpeedZ(double a_SpeedZ);
+
void SetWidth (double a_Width);
void AddPosX (double a_AddPosX);
@@ -429,6 +440,9 @@ protected:
static cCriticalSection m_CSCount;
static int m_EntityCount;
+ /** Measured in meter/second (m/s) */
+ Vector3d m_Speed;
+
int m_UniqueID;
int m_Health;
@@ -486,11 +500,15 @@ protected:
/// Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void.
int m_TicksSinceLastVoidDamage;
-
+
+ /** Does the actual speed-setting. The default implementation just sets the member variable value;
+ overrides can provide further processing, such as forcing players to move at the given speed. */
+ virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ);
+
virtual void Destroyed(void) {} // Called after the entity has been destroyed
/** Called in each tick to handle air-related processing i.e. drowning */
- virtual void HandleAir();
+ virtual void HandleAir(void);
/** Called once per tick to set IsSwimming and IsSubmerged */
virtual void SetSwimState(cChunk & a_Chunk);
@@ -506,9 +524,6 @@ private:
/** Measured in degrees, [-180, +180) */
double m_HeadYaw;
- /** Measured in meter/second (m/s) */
- Vector3d m_Speed;
-
/** Measured in degrees, [-180, +180) */
Vector3d m_Rot;
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index feb09b5d2..fdc0bb390 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -22,6 +22,12 @@
#include "inifile/iniFile.h"
#include "json/json.h"
+// 6000 ticks or 5 minutes
+#define PLAYER_INVENTORY_SAVE_INTERVAL 6000
+
+// 1000 = once per second
+#define PLAYER_LIST_TIME_MS 1000
+
@@ -64,6 +70,7 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
, m_BowCharge(0)
, m_FloaterID(-1)
, m_Team(NULL)
+ , m_TicksUntilNextSave(PLAYER_INVENTORY_SAVE_INTERVAL)
{
LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d",
a_PlayerName.c_str(), a_Client->GetIPString().c_str(),
@@ -250,7 +257,7 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
// Send Player List (Once per m_LastPlayerListTime/1000 ms)
cTimer t1;
- if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime())
+ if (m_LastPlayerListTime + PLAYER_LIST_TIME_MS <= t1.GetNowTime())
{
m_World->SendPlayerList(this);
m_LastPlayerListTime = t1.GetNowTime();
@@ -260,6 +267,16 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
{
m_LastGroundHeight = (float)GetPosY();
}
+
+ if (m_TicksUntilNextSave == 0)
+ {
+ SaveToDisk();
+ m_TicksUntilNextSave = PLAYER_INVENTORY_SAVE_INTERVAL;
+ }
+ else
+ {
+ m_TicksUntilNextSave--;
+ }
}
@@ -1257,6 +1274,17 @@ Vector3d cPlayer::GetThrowSpeed(double a_SpeedCoeff) const
void cPlayer::ForceSetSpeed(const Vector3d & a_Speed)
{
SetSpeed(a_Speed);
+}
+
+
+
+
+
+void cPlayer::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ)
+{
+ super::DoSetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ);
+
+ // Send the speed to the client so he actualy moves
m_ClientHandle->SendEntityVelocity(*this);
}
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 83b9ad593..b2142a18b 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -194,7 +194,8 @@ public:
// Sets the current gamemode, doesn't check validity, doesn't send update packets to client
void LoginSetGameMode(eGameMode a_GameMode);
- /** Forces the player to move in the given direction. */
+ /** Forces the player to move in the given direction.
+ @deprecated Use SetSpeed instead. */
void ForceSetSpeed(const Vector3d & a_Speed); // tolua_export
/** Tries to move to a new position, with attachment-related checks (y == -999) */
@@ -461,7 +462,6 @@ protected:
cItem m_DraggingItem;
long long m_LastPlayerListTime;
- static const unsigned short PLAYER_LIST_TIME_MS = 1000; // 1000 = once per second
cClientHandle * m_ClientHandle;
@@ -512,6 +512,9 @@ protected:
+ /** Sets the speed and sends it to the client, so that they are forced to move so. */
+ virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override;
+
void ResolvePermissions(void);
void ResolveGroups(void);
@@ -539,6 +542,10 @@ protected:
Set by a right click on unoccupied bed, unset by a time fast forward or teleport */
bool m_bIsInBed;
+ /** How long till the player's inventory will be saved
+ Default save interval is #defined in PLAYER_INVENTORY_SAVE_INTERVAL */
+ unsigned int m_TicksUntilNextSave;
+
} ; // tolua_export
diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp
index 872e3341d..6aa7fd4cb 100644
--- a/src/Generating/Caves.cpp
+++ b/src/Generating/Caves.cpp
@@ -125,7 +125,7 @@ public:
int m_BlockX;
int m_BlockZ;
- cCaveSystem(int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise);
+ cCaveSystem(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise);
~cCaveSystem();
protected:
@@ -574,8 +574,8 @@ AString cCaveTunnel::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) cons
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cStructGenWormNestCaves::cCaveSystem:
-cStructGenWormNestCaves::cCaveSystem::cCaveSystem(int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise) :
- super(a_OriginX, a_OriginZ),
+cStructGenWormNestCaves::cCaveSystem::cCaveSystem(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise) :
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Size(a_Size)
{
int Num = 1 + a_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) % 3;
@@ -690,9 +690,9 @@ int cStructGenWormNestCaves::cCaveSystem::GetRadius(cNoise & a_Noise, int a_Orig
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cStructGenWormNestCaves:
-cGridStructGen::cStructurePtr cStructGenWormNestCaves::CreateStructure(int a_OriginX, int a_OriginZ)
+cGridStructGen::cStructurePtr cStructGenWormNestCaves::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
- return cStructurePtr(new cCaveSystem(a_OriginX, a_OriginZ, m_MaxOffset, m_Size, m_Noise));
+ return cStructurePtr(new cCaveSystem(a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxOffset, m_Size, m_Noise));
}
diff --git a/src/Generating/Caves.h b/src/Generating/Caves.h
index 254dcddbd..0e17acf9e 100644
--- a/src/Generating/Caves.h
+++ b/src/Generating/Caves.h
@@ -69,7 +69,7 @@ class cStructGenWormNestCaves :
typedef cGridStructGen super;
public:
cStructGenWormNestCaves(int a_Seed, int a_Size = 64, int a_Grid = 96, int a_MaxOffset = 128) :
- super(a_Seed, a_Grid, a_Grid, a_Size + a_MaxOffset, a_Size + a_MaxOffset, 100),
+ super(a_Seed, a_Grid, a_Grid, a_MaxOffset, a_MaxOffset, a_Size, a_Size, 100),
m_Noise(a_Seed),
m_Size(a_Size),
m_MaxOffset(a_MaxOffset),
@@ -86,7 +86,7 @@ protected:
int m_Grid; // average spacing of the nests
// cGridStructGen override:
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ;
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp
index 1801b7375..22941dcbe 100644
--- a/src/Generating/ComposableGenerator.cpp
+++ b/src/Generating/ComposableGenerator.cpp
@@ -357,12 +357,13 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
else if (NoCaseCompare(*itr, "MineShafts") == 0)
{
int GridSize = a_IniFile.GetValueSetI("Generator", "MineShaftsGridSize", 512);
+ int MaxOffset = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxOffset", 256);
int MaxSystemSize = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxSystemSize", 160);
int ChanceCorridor = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCorridor", 600);
int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200);
int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200);
m_FinishGens.push_back(new cStructGenMineShafts(
- Seed, GridSize, MaxSystemSize,
+ Seed, GridSize, MaxOffset, MaxSystemSize,
ChanceCorridor, ChanceCrossing, ChanceStaircase
));
}
@@ -376,9 +377,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(*itr, "NetherForts") == 0)
{
- int GridSize = a_IniFile.GetValueSetI("Generator", "NetherFortsGridSize", 512);
- int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12);
- m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxDepth));
+ int GridSize = a_IniFile.GetValueSetI("Generator", "NetherFortsGridSize", 512);
+ int MaxOffset = a_IniFile.GetValueSetI("Generator", "NetherFortMaxOffset", 128);
+ int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12);
+ m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxOffset, MaxDepth));
}
else if (NoCaseCompare(*itr, "OreNests") == 0)
{
@@ -394,10 +396,11 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(*itr, "RainbowRoads") == 0)
{
- int GridSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsGridSize", 512);
- int MaxDepth = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxDepth", 30);
- int MaxSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxSize", 260);
- m_FinishGens.push_back(new cRainbowRoadsGen(Seed, GridSize, MaxDepth, MaxSize));
+ int GridSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsGridSize", 512);
+ int MaxOffset = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxOffset", 128);
+ int MaxDepth = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxDepth", 30);
+ int MaxSize = a_IniFile.GetValueSetI("Generator", "RainbowRoadsMaxSize", 260);
+ m_FinishGens.push_back(new cRainbowRoadsGen(Seed, GridSize, MaxOffset, MaxDepth, MaxSize));
}
else if (NoCaseCompare(*itr, "Ravines") == 0)
{
@@ -417,19 +420,21 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(*itr, "UnderwaterBases") == 0)
{
- int GridSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseGridSize", 1024);
- int MaxDepth = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxDepth", 7);
- int MaxSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxSize", 128);
- m_FinishGens.push_back(new cUnderwaterBaseGen(Seed, GridSize, MaxDepth, MaxSize, *m_BiomeGen));
+ int GridSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseGridSize", 1024);
+ int MaxOffset = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxOffset", 128);
+ int MaxDepth = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxDepth", 7);
+ int MaxSize = a_IniFile.GetValueSetI("Generator", "UnderwaterBaseMaxSize", 128);
+ m_FinishGens.push_back(new cUnderwaterBaseGen(Seed, GridSize, MaxOffset, MaxDepth, MaxSize, *m_BiomeGen));
}
else if (NoCaseCompare(*itr, "Villages") == 0)
{
int GridSize = a_IniFile.GetValueSetI("Generator", "VillageGridSize", 384);
+ int MaxOffset = a_IniFile.GetValueSetI("Generator", "VillageMaxOffset", 128);
int MaxDepth = a_IniFile.GetValueSetI("Generator", "VillageMaxDepth", 2);
int MaxSize = a_IniFile.GetValueSetI("Generator", "VillageMaxSize", 128);
int MinDensity = a_IniFile.GetValueSetI("Generator", "VillageMinDensity", 50);
int MaxDensity = a_IniFile.GetValueSetI("Generator", "VillageMaxDensity", 80);
- m_FinishGens.push_back(new cVillageGen(Seed, GridSize, MaxDepth, MaxSize, MinDensity, MaxDensity, *m_BiomeGen, *m_HeightGen));
+ m_FinishGens.push_back(new cVillageGen(Seed, GridSize, MaxOffset, MaxDepth, MaxSize, MinDensity, MaxDensity, *m_BiomeGen, *m_HeightGen));
}
else if (NoCaseCompare(*itr, "WaterLakes") == 0)
{
@@ -442,7 +447,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(*itr, "WormNestCaves") == 0)
{
- m_FinishGens.push_back(new cStructGenWormNestCaves(Seed));
+ int Size = a_IniFile.GetValueSetI("Generator", "WormNestCavesSize", 64);
+ int Grid = a_IniFile.GetValueSetI("Generator", "WormNestCavesGrid", 96);
+ int MaxOffset = a_IniFile.GetValueSetI("Generator", "WormNestMaxOffset", 32);
+ m_FinishGens.push_back(new cStructGenWormNestCaves(Seed, Size, Grid, MaxOffset));
}
else
{
diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp
index 474242557..2931df3eb 100644
--- a/src/Generating/GridStructGen.cpp
+++ b/src/Generating/GridStructGen.cpp
@@ -21,8 +21,8 @@ class cEmptyStructure :
typedef cGridStructGen::cStructure super;
public:
- cEmptyStructure(int a_OriginX, int a_OriginZ) :
- super(a_OriginX, a_OriginZ)
+ cEmptyStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) :
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
{
}
@@ -40,17 +40,20 @@ protected:
cGridStructGen::cGridStructGen(
int a_Seed,
int a_GridSizeX, int a_GridSizeZ,
+ int a_MaxOffsetX, int a_MaxOffsetZ,
int a_MaxStructureSizeX, int a_MaxStructureSizeZ,
size_t a_MaxCacheSize
) :
- m_Seed(a_Seed),
+ m_Noise(a_Seed),
m_GridSizeX(a_GridSizeX),
m_GridSizeZ(a_GridSizeZ),
+ m_MaxOffsetX(a_MaxOffsetX),
+ m_MaxOffsetZ(a_MaxOffsetZ),
m_MaxStructureSizeX(a_MaxStructureSizeX),
m_MaxStructureSizeZ(a_MaxStructureSizeZ),
m_MaxCacheSize(a_MaxCacheSize)
{
- size_t NumStructuresPerQuery = (size_t)((m_MaxStructureSizeX / m_GridSizeX + 1) * (m_MaxStructureSizeZ / m_GridSizeZ + 1));
+ size_t NumStructuresPerQuery = (size_t)(((m_MaxStructureSizeX + m_MaxOffsetX) / m_GridSizeX + 1) * ((m_MaxStructureSizeZ + m_MaxOffsetZ) / m_GridSizeZ + 1));
if (NumStructuresPerQuery > m_MaxCacheSize)
{
m_MaxCacheSize = NumStructuresPerQuery * 4;
@@ -68,10 +71,10 @@ cGridStructGen::cGridStructGen(
void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructurePtrs & a_Structures)
{
// Calculate the min and max grid coords of the structures to be returned:
- int MinBlockX = a_ChunkX * cChunkDef::Width - m_MaxStructureSizeX;
- int MinBlockZ = a_ChunkZ * cChunkDef::Width - m_MaxStructureSizeZ;
- int MaxBlockX = a_ChunkX * cChunkDef::Width + m_MaxStructureSizeX + cChunkDef::Width - 1;
- int MaxBlockZ = a_ChunkZ * cChunkDef::Width + m_MaxStructureSizeZ + cChunkDef::Width - 1;
+ int MinBlockX = a_ChunkX * cChunkDef::Width - m_MaxStructureSizeX - m_MaxOffsetX;
+ int MinBlockZ = a_ChunkZ * cChunkDef::Width - m_MaxStructureSizeZ - m_MaxOffsetZ;
+ int MaxBlockX = a_ChunkX * cChunkDef::Width + m_MaxStructureSizeX + m_MaxOffsetX + cChunkDef::Width - 1;
+ int MaxBlockZ = a_ChunkZ * cChunkDef::Width + m_MaxStructureSizeZ + m_MaxOffsetZ + cChunkDef::Width - 1;
int MinGridX = MinBlockX / m_GridSizeX;
int MinGridZ = MinBlockZ / m_GridSizeZ;
int MaxGridX = (MaxBlockX + m_GridSizeX - 1) / m_GridSizeX;
@@ -103,14 +106,14 @@ void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructur
// Create those structures that haven't been in the cache:
for (int x = MinGridX; x < MaxGridX; x++)
{
- int OriginX = x * m_GridSizeX;
+ int GridX = x * m_GridSizeX;
for (int z = MinGridZ; z < MaxGridZ; z++)
{
- int OriginZ = z * m_GridSizeZ;
+ int GridZ = z * m_GridSizeZ;
bool Found = false;
for (cStructurePtrs::const_iterator itr = a_Structures.begin(), end = a_Structures.end(); itr != end; ++itr)
{
- if (((*itr)->m_OriginX == OriginX) && ((*itr)->m_OriginZ == OriginZ))
+ if (((*itr)->m_GridX == GridX) && ((*itr)->m_GridZ == GridZ))
{
Found = true;
break;
@@ -118,10 +121,12 @@ void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructur
} // for itr - a_Structures[]
if (!Found)
{
- cStructurePtr Structure = CreateStructure(OriginX, OriginZ);
+ int OriginX = GridX + ((m_Noise.IntNoise2DInt(GridX + 3, GridZ + 5) / 7) % (m_MaxOffsetX * 2)) - m_MaxOffsetX;
+ int OriginZ = GridZ + ((m_Noise.IntNoise2DInt(GridX + 5, GridZ + 3) / 7) % (m_MaxOffsetZ * 2)) - m_MaxOffsetZ;
+ cStructurePtr Structure = CreateStructure(GridX, GridZ, OriginX, OriginZ);
if (Structure.get() == NULL)
{
- Structure.reset(new cEmptyStructure(OriginX, OriginZ));
+ Structure.reset(new cEmptyStructure(GridX, GridZ, OriginX, OriginZ));
}
a_Structures.push_back(Structure);
}
diff --git a/src/Generating/GridStructGen.h b/src/Generating/GridStructGen.h
index 630a5e44e..03131fce9 100644
--- a/src/Generating/GridStructGen.h
+++ b/src/Generating/GridStructGen.h
@@ -10,6 +10,7 @@
#pragma once
#include "ComposableGenerator.h"
+#include "../Noise.h"
@@ -19,7 +20,12 @@
Defines a grid in the XZ space with predefined cell size in each direction. Each cell then receives exactly
one structure (provided by the descendant class). The structure is placed within the cell, but doesn't need
to be bounded by the cell, it can be well outside the cell; the generator uses the MaxStructureSize parameter
-to determine how far away from the cell the structure can be at most.
+to determine how far away from the cell the structure can be at most. Each structure has an offset from the
+grid's center point, the offset is generated randomly from a range given to this class as a parameter.
+
+Each structure thus contains the coords of its grid center (m_GridX, m_GridZ) and the actual origin from
+which it's built (m_OriginX, m_OriginZ).
+
This class provides a cache for the structures generated for successive chunks and manages that cache. It
also provides the cFinishGen override that uses the cache to actually generate the structure into chunk data.
@@ -43,12 +49,17 @@ public:
class cStructure
{
public:
- /** The origin (the coords of the gridpoint for which the structure is generated) */
+ /** The grid point for which the structure is generated. */
+ int m_GridX, m_GridZ;
+
+ /** The origin (the coords for which the structure is generated) */
int m_OriginX, m_OriginZ;
- /** Creates a structure that has its originset at the specified coords. */
- cStructure (int a_OriginX, int a_OriginZ) :
+ /** Creates a structure that has its origin set at the specified coords. */
+ cStructure (int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) :
+ m_GridX(a_GridX),
+ m_GridZ(a_GridZ),
m_OriginX(a_OriginX),
m_OriginZ(a_OriginZ)
{
@@ -70,20 +81,30 @@ public:
cGridStructGen(
int a_Seed,
int a_GridSizeX, int a_GridSizeZ,
+ int a_MaxOffsetX, int a_MaxOffsetZ,
int a_MaxStructureSizeX, int a_MaxStructureSizeZ,
size_t a_MaxCacheSize
);
protected:
- /** Seed for generating the semi-random grid. */
+ /** Seed for generating grid offsets and also available for descendants. */
int m_Seed;
+ /** The noise used for generating grid offsets. */
+ cNoise m_Noise;
+
/** The size of each grid's cell in the X axis */
int m_GridSizeX;
/** The size of each grid's cell in the Z axis */
int m_GridSizeZ;
+ /** The maximum offset of the structure's origin from the grid midpoint, in X coord. */
+ int m_MaxOffsetX;
+
+ /** The maximum offset of the structure's origin from the grid midpoint, in Z coord. */
+ int m_MaxOffsetZ;
+
/** Maximum theoretical size of the structure in the X axis.
This limits the structures considered for a single chunk, so the lesser the number, the better performance.
Structures large than this may get cropped. */
@@ -115,7 +136,7 @@ protected:
// Functions for the descendants to override:
/** Create a new structure at the specified gridpoint */
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) = 0;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) = 0;
} ;
diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp
index 81ae6481d..ab9b1aa29 100644
--- a/src/Generating/MineShafts.cpp
+++ b/src/Generating/MineShafts.cpp
@@ -248,7 +248,8 @@ public:
/** Creates and generates the entire system */
cMineShaftSystem(
- int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
+ int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ,
+ int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase
);
@@ -278,10 +279,11 @@ public:
// cStructGenMineShafts::cMineShaftSystem:
cStructGenMineShafts::cMineShaftSystem::cMineShaftSystem(
- int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
+ int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ,
+ int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase
) :
- super(a_OriginX, a_OriginZ),
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_GridSize(a_GridSize),
m_MaxRecursion(8), // TODO: settable
m_ProbLevelCorridor(a_ProbLevelCorridor),
@@ -1280,10 +1282,10 @@ void cMineShaftStaircase::ProcessChunk(cChunkDesc & a_ChunkDesc)
// cStructGenMineShafts:
cStructGenMineShafts::cStructGenMineShafts(
- int a_Seed, int a_GridSize, int a_MaxSystemSize,
+ int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxSystemSize,
int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase
) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxSystemSize, a_MaxSystemSize, 100),
+ super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSystemSize, a_MaxSystemSize, 100),
m_Noise(a_Seed),
m_GridSize(a_GridSize),
m_MaxSystemSize(a_MaxSystemSize),
@@ -1297,9 +1299,9 @@ cStructGenMineShafts::cStructGenMineShafts(
-cGridStructGen::cStructurePtr cStructGenMineShafts::CreateStructure(int a_OriginX, int a_OriginZ)
+cGridStructGen::cStructurePtr cStructGenMineShafts::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
- return cStructurePtr(new cMineShaftSystem(a_OriginX, a_OriginZ, m_GridSize, m_MaxSystemSize, m_Noise, m_ProbLevelCorridor, m_ProbLevelCrossing, m_ProbLevelStaircase));
+ return cStructurePtr(new cMineShaftSystem(a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_GridSize, m_MaxSystemSize, m_Noise, m_ProbLevelCorridor, m_ProbLevelCrossing, m_ProbLevelStaircase));
}
diff --git a/src/Generating/MineShafts.h b/src/Generating/MineShafts.h
index c29b6cdac..2850db571 100644
--- a/src/Generating/MineShafts.h
+++ b/src/Generating/MineShafts.h
@@ -23,7 +23,7 @@ class cStructGenMineShafts :
public:
cStructGenMineShafts(
- int a_Seed, int a_GridSize, int a_MaxSystemSize,
+ int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxSystemSize,
int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase
);
@@ -43,7 +43,7 @@ protected:
int m_ProbLevelStaircase; ///< Probability level of a branch object being the staircase, minus Crossing
// cGridStructGen overrides:
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ;
diff --git a/src/Generating/NetherFortGen.cpp b/src/Generating/NetherFortGen.cpp
index 3867ec80c..23fa56048 100644
--- a/src/Generating/NetherFortGen.cpp
+++ b/src/Generating/NetherFortGen.cpp
@@ -26,8 +26,8 @@ public:
cPlacedPieces m_Pieces;
- cNetherFort(cNetherFortGen & a_ParentGen, int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxDepth, int a_Seed) :
- super(a_OriginX, a_OriginZ),
+ cNetherFort(cNetherFortGen & a_ParentGen, int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_GridSize, int a_MaxDepth, int a_Seed) :
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_ParentGen(a_ParentGen),
m_GridSize(a_GridSize),
m_Seed(a_Seed)
@@ -108,8 +108,8 @@ cPrefabPiecePool cNetherFortGen::m_PiecePool(g_NetherFortPrefabs, g_NetherFortPr
-cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxDepth * 10, a_MaxDepth * 10, 200),
+cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth) :
+ super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxDepth * 10, a_MaxDepth * 10, 200),
m_MaxDepth(a_MaxDepth)
{
/*
@@ -124,8 +124,11 @@ cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth) :
-cGridStructGen::cStructurePtr cNetherFortGen::CreateStructure(int a_OriginX, int a_OriginZ)
+cGridStructGen::cStructurePtr cNetherFortGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
- return cStructurePtr(new cNetherFort(*this, a_OriginX, a_OriginZ, m_GridSizeX, m_MaxDepth, m_Seed));
+ return cStructurePtr(new cNetherFort(*this, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_GridSizeX, m_MaxDepth, m_Seed));
}
+
+
+
diff --git a/src/Generating/NetherFortGen.h b/src/Generating/NetherFortGen.h
index f35801a3c..9b31aa0e2 100644
--- a/src/Generating/NetherFortGen.h
+++ b/src/Generating/NetherFortGen.h
@@ -23,7 +23,7 @@ class cNetherFortGen :
typedef cGridStructGen super;
public:
- cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth);
+ cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth);
protected:
friend class cNetherFortPerfTest; // fwd: NetherFortGen.cpp
@@ -37,7 +37,7 @@ protected:
// cGridStructGen overrides:
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ;
diff --git a/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp b/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp
index 4f0efdcc6..eb01cf59e 100644
--- a/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp
+++ b/src/Generating/Prefabs/SandFlatRoofVillagePrefabs.cpp
@@ -20,18 +20,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 32, ID 173, created by Aloe_vera
{
// Size:
- 12, 5, 10, // SizeX = 12, SizeY = 5, SizeZ = 10
+ 12, 6, 10, // SizeX = 12, SizeY = 6, SizeZ = 10
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 11, 4, 9, // MaxX, MaxY, MaxZ
+ 11, 5, 9, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 2\n" /* sandstonestairs */
- "b:128: 1\n" /* sandstonestairs */
- "c:128: 0\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e:128: 3\n" /* sandstonestairs */
"f:171:15\n" /* carpet */
"g: 64: 6\n" /* wooddoorblock */
@@ -54,35 +54,49 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Level 0
/* z\x* 11 */
/* * 012345678901 */
- /* 0 */ "aaaaaab....."
- /* 1 */ "cdddddddddd."
- /* 2 */ "cdddddddddd."
- /* 3 */ "cdddddddddd."
- /* 4 */ "cdddddddddd."
- /* 5 */ "edddddddddd."
- /* 6 */ ".dddddddddd."
- /* 7 */ ".dddddddddd."
- /* 8 */ ".dddddddddd."
- /* 9 */ "............"
+ /* 0 */ "aaaaaaammmmm"
+ /* 1 */ "aaaaaaaaaaam"
+ /* 2 */ "aaaaaaaaaaam"
+ /* 3 */ "aaaaaaaaaaam"
+ /* 4 */ "aaaaaaaaaaam"
+ /* 5 */ "aaaaaaaaaaam"
+ /* 6 */ "maaaaaaaaaam"
+ /* 7 */ "maaaaaaaaaam"
+ /* 8 */ "maaaaaaaaaam"
+ /* 9 */ "mmmmmmmmmmmm"
// Level 1
/* z\x* 11 */
/* * 012345678901 */
- /* 0 */ "............"
- /* 1 */ ".d....ddddd."
- /* 2 */ "......dfffd."
- /* 3 */ "......ghfhd."
- /* 4 */ "......diiid."
- /* 5 */ ".d....dhfhd."
- /* 6 */ ".djddjdfffd."
- /* 7 */ ".ddkkddl..d."
- /* 8 */ ".dddddddddd."
+ /* 0 */ "bcccccd....."
+ /* 1 */ "baaaaaaaaaa."
+ /* 2 */ "baaaaaaaaaa."
+ /* 3 */ "baaaaaaaaaa."
+ /* 4 */ "baaaaaaaaaa."
+ /* 5 */ "eaaaaaaaaaa."
+ /* 6 */ ".aaaaaaaaaa."
+ /* 7 */ ".aaaaaaaaaa."
+ /* 8 */ ".aaaaaaaaaa."
/* 9 */ "............"
// Level 2
/* z\x* 11 */
/* * 012345678901 */
/* 0 */ "............"
+ /* 1 */ ".a....aaaaa."
+ /* 2 */ "......afffa."
+ /* 3 */ "......ghfha."
+ /* 4 */ "......aiiia."
+ /* 5 */ ".a....ahfha."
+ /* 6 */ ".ajaajafffa."
+ /* 7 */ ".aakkaal..a."
+ /* 8 */ ".aaaaaaaaaa."
+ /* 9 */ "............"
+
+ // Level 3
+ /* z\x* 11 */
+ /* * 012345678901 */
+ /* 0 */ "............"
/* 1 */ ".n....nn.nn."
/* 2 */ "......n...n."
/* 3 */ "......o...n."
@@ -93,36 +107,36 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
/* 8 */ ".nnn.nnn.nn."
/* 9 */ "............"
- // Level 3
+ // Level 4
/* z\x* 11 */
/* * 012345678901 */
/* 0 */ "............"
- /* 1 */ ".d....ddddd."
- /* 2 */ "......d...d."
- /* 3 */ "......d...d."
- /* 4 */ "......dp..d."
- /* 5 */ ".d....d...d."
- /* 6 */ ".dqqqqd...d."
- /* 7 */ ".d....d...d."
- /* 8 */ ".dddddddddd."
+ /* 1 */ ".a....aaaaa."
+ /* 2 */ "......a...a."
+ /* 3 */ "......a...a."
+ /* 4 */ "......ap..a."
+ /* 5 */ ".a....a...a."
+ /* 6 */ ".aqqqqa...a."
+ /* 7 */ ".a....a...a."
+ /* 8 */ ".aaaaaaaaaa."
/* 9 */ "............"
- // Level 4
+ // Level 5
/* z\x* 11 */
/* * 012345678901 */
/* 0 */ "rsssssssssss"
- /* 1 */ "rddddddddddt"
- /* 2 */ "rddddddddddt"
- /* 3 */ "rddddddddddt"
- /* 4 */ "rddddddddddt"
- /* 5 */ "rddddddddddt"
- /* 6 */ "rddddddddddt"
- /* 7 */ "rddddddddddt"
- /* 8 */ "rddddddddddt"
+ /* 1 */ "raaaaaaaaaat"
+ /* 2 */ "raaaaaaaaaat"
+ /* 3 */ "raaaaaaaaaat"
+ /* 4 */ "raaaaaaaaaat"
+ /* 5 */ "raaaaaaaaaat"
+ /* 6 */ "raaaaaaaaaat"
+ /* 7 */ "raaaaaaaaaat"
+ /* 8 */ "raaaaaaaaaat"
/* 9 */ "uuuuuuuuuuut",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -153,18 +167,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 31, ID 172, created by Aloe_vera
{
// Size:
- 13, 5, 9, // SizeX = 13, SizeY = 5, SizeZ = 9
+ 13, 6, 9, // SizeX = 13, SizeY = 6, SizeZ = 9
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 12, 4, 8, // MaxX, MaxY, MaxZ
+ 12, 5, 8, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 0\n" /* sandstonestairs */
- "b:128: 2\n" /* sandstonestairs */
- "c:128: 1\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e: 64: 7\n" /* wooddoorblock */
"f:171: 0\n" /* carpet */
"g:171:15\n" /* carpet */
@@ -185,33 +199,46 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Level 0
/* z\x* 111 */
/* * 0123456789012 */
- /* 0 */ "..abc........"
- /* 1 */ ".ddddddddddd."
- /* 2 */ ".ddddddddddd."
- /* 3 */ ".ddddddddddd."
- /* 4 */ ".ddddddddddd."
- /* 5 */ ".ddddddddddd."
- /* 6 */ ".ddddddddddd."
- /* 7 */ ".ddddddddddd."
- /* 8 */ "............."
+ /* 0 */ "mmaaammmmmmmm"
+ /* 1 */ "maaaaaaaaaaam"
+ /* 2 */ "maaaaaaaaaaam"
+ /* 3 */ "maaaaaaaaaaam"
+ /* 4 */ "maaaaaaaaaaam"
+ /* 5 */ "maaaaaaaaaaam"
+ /* 6 */ "maaaaaaaaaaam"
+ /* 7 */ "maaaaaaaaaaam"
+ /* 8 */ "mmmmmmmmmmmmm"
// Level 1
/* z\x* 111 */
/* * 0123456789012 */
- /* 0 */ "............."
- /* 1 */ ".ddedddddddd."
- /* 2 */ ".dffgggggffd."
- /* 3 */ ".dfghhhhhgfd."
- /* 4 */ ".dfghfffhgfd."
- /* 5 */ ".dfghhhhhgfd."
- /* 6 */ ".dffgggggffd."
- /* 7 */ ".ddddddddddd."
+ /* 0 */ "..bcd........"
+ /* 1 */ ".aaaaaaaaaaa."
+ /* 2 */ ".aaaaaaaaaaa."
+ /* 3 */ ".aaaaaaaaaaa."
+ /* 4 */ ".aaaaaaaaaaa."
+ /* 5 */ ".aaaaaaaaaaa."
+ /* 6 */ ".aaaaaaaaaaa."
+ /* 7 */ ".aaaaaaaaaaa."
/* 8 */ "............."
// Level 2
/* z\x* 111 */
/* * 0123456789012 */
/* 0 */ "............."
+ /* 1 */ ".aaeaaaaaaaa."
+ /* 2 */ ".affgggggffa."
+ /* 3 */ ".afghhhhhgfa."
+ /* 4 */ ".afghfffhgfa."
+ /* 5 */ ".afghhhhhgfa."
+ /* 6 */ ".affgggggffa."
+ /* 7 */ ".aaaaaaaaaaa."
+ /* 8 */ "............."
+
+ // Level 3
+ /* z\x* 111 */
+ /* * 0123456789012 */
+ /* 0 */ "............."
/* 1 */ ".iiji.iii.ii."
/* 2 */ ".i.........i."
/* 3 */ ".i.........i."
@@ -221,34 +248,34 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
/* 7 */ ".ii.ii.ii.ii."
/* 8 */ "............."
- // Level 3
+ // Level 4
/* z\x* 111 */
/* * 0123456789012 */
/* 0 */ "............."
- /* 1 */ ".ddddddddddd."
- /* 2 */ ".d..k..k...d."
- /* 3 */ ".d.........d."
- /* 4 */ ".dl.......nd."
- /* 5 */ ".d.........d."
- /* 6 */ ".d....o....d."
- /* 7 */ ".ddddddddddd."
+ /* 1 */ ".aaaaaaaaaaa."
+ /* 2 */ ".a..k..k...a."
+ /* 3 */ ".a.........a."
+ /* 4 */ ".al.......na."
+ /* 5 */ ".a.........a."
+ /* 6 */ ".a....o....a."
+ /* 7 */ ".aaaaaaaaaaa."
/* 8 */ "............."
- // Level 4
+ // Level 5
/* z\x* 111 */
/* * 0123456789012 */
/* 0 */ "pqqqqqqqqqqqq"
- /* 1 */ "pdddddddddddr"
- /* 2 */ "pdddddddddddr"
- /* 3 */ "pdddddddddddr"
- /* 4 */ "pdddddddddddr"
- /* 5 */ "pdddddddddddr"
- /* 6 */ "pdddddddddddr"
- /* 7 */ "pdddddddddddr"
+ /* 1 */ "paaaaaaaaaaar"
+ /* 2 */ "paaaaaaaaaaar"
+ /* 3 */ "paaaaaaaaaaar"
+ /* 4 */ "paaaaaaaaaaar"
+ /* 5 */ "paaaaaaaaaaar"
+ /* 6 */ "paaaaaaaaaaar"
+ /* 7 */ "paaaaaaaaaaar"
/* 8 */ "ssssssssssssr",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -279,18 +306,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 25, ID 166, created by Aloe_vera
{
// Size:
- 7, 5, 6, // SizeX = 7, SizeY = 5, SizeZ = 6
+ 7, 6, 6, // SizeX = 7, SizeY = 6, SizeZ = 6
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 6, 4, 5, // MaxX, MaxY, MaxZ
+ 6, 5, 5, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 0\n" /* sandstonestairs */
- "b:128: 2\n" /* sandstonestairs */
- "c:128: 1\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e: 64: 7\n" /* wooddoorblock */
"f:171: 0\n" /* carpet */
"g:171:14\n" /* carpet */
@@ -306,51 +333,60 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Block data:
// Level 0
/* z\x* 0123456 */
- /* 0 */ "..abc.."
- /* 1 */ ".ddddd."
- /* 2 */ ".ddddd."
- /* 3 */ ".ddddd."
- /* 4 */ ".ddddd."
- /* 5 */ "......."
+ /* 0 */ "mmaaamm"
+ /* 1 */ "maaaaam"
+ /* 2 */ "maaaaam"
+ /* 3 */ "maaaaam"
+ /* 4 */ "maaaaam"
+ /* 5 */ "mmmmmmm"
// Level 1
/* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".ddedd."
- /* 2 */ ".dfgfd."
- /* 3 */ ".dfgfd."
- /* 4 */ ".ddddd."
+ /* 0 */ "..bcd.."
+ /* 1 */ ".aaaaa."
+ /* 2 */ ".aaaaa."
+ /* 3 */ ".aaaaa."
+ /* 4 */ ".aaaaa."
/* 5 */ "......."
// Level 2
/* z\x* 0123456 */
/* 0 */ "......."
+ /* 1 */ ".aaeaa."
+ /* 2 */ ".afgfa."
+ /* 3 */ ".afgfa."
+ /* 4 */ ".aaaaa."
+ /* 5 */ "......."
+
+ // Level 3
+ /* z\x* 0123456 */
+ /* 0 */ "......."
/* 1 */ ".hhihh."
/* 2 */ ".h...h."
/* 3 */ ".h...h."
/* 4 */ ".hh.hh."
/* 5 */ "......."
- // Level 3
+ // Level 4
/* z\x* 0123456 */
/* 0 */ "......."
- /* 1 */ ".ddddd."
- /* 2 */ ".dj.jd."
- /* 3 */ ".d...d."
- /* 4 */ ".ddddd."
+ /* 1 */ ".aaaaa."
+ /* 2 */ ".aj.ja."
+ /* 3 */ ".a...a."
+ /* 4 */ ".aaaaa."
/* 5 */ "......."
- // Level 4
+ // Level 5
/* z\x* 0123456 */
/* 0 */ "kllllln"
- /* 1 */ "kdddddn"
- /* 2 */ "kdddddn"
- /* 3 */ "kdddddn"
- /* 4 */ "kdddddn"
+ /* 1 */ "kaaaaan"
+ /* 2 */ "kaaaaan"
+ /* 3 */ "kaaaaan"
+ /* 4 */ "kaaaaan"
/* 5 */ "oooooon",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -381,18 +417,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 26, ID 167, created by Aloe_vera
{
// Size:
- 7, 5, 7, // SizeX = 7, SizeY = 5, SizeZ = 7
+ 7, 6, 7, // SizeX = 7, SizeY = 6, SizeZ = 7
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 6, 4, 6, // MaxX, MaxY, MaxZ
+ 6, 5, 6, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 0\n" /* sandstonestairs */
- "b:128: 2\n" /* sandstonestairs */
- "c:128: 1\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e: 64: 7\n" /* wooddoorblock */
"f:171: 0\n" /* carpet */
"g:171:15\n" /* carpet */
@@ -409,27 +445,37 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Block data:
// Level 0
/* z\x* 0123456 */
- /* 0 */ "..abc.."
- /* 1 */ ".ddddd."
- /* 2 */ ".ddddd."
- /* 3 */ ".ddddd."
- /* 4 */ ".ddddd."
- /* 5 */ ".ddddd."
- /* 6 */ "......."
+ /* 0 */ "mmaaamm"
+ /* 1 */ "maaaaam"
+ /* 2 */ "maaaaam"
+ /* 3 */ "maaaaam"
+ /* 4 */ "maaaaam"
+ /* 5 */ "maaaaam"
+ /* 6 */ "mmmmmmm"
// Level 1
/* z\x* 0123456 */
- /* 0 */ "......."
- /* 1 */ ".ddedd."
- /* 2 */ ".dfffd."
- /* 3 */ ".dghgd."
- /* 4 */ ".dfffd."
- /* 5 */ ".ddddd."
+ /* 0 */ "..bcd.."
+ /* 1 */ ".aaaaa."
+ /* 2 */ ".aaaaa."
+ /* 3 */ ".aaaaa."
+ /* 4 */ ".aaaaa."
+ /* 5 */ ".aaaaa."
/* 6 */ "......."
// Level 2
/* z\x* 0123456 */
/* 0 */ "......."
+ /* 1 */ ".aaeaa."
+ /* 2 */ ".afffa."
+ /* 3 */ ".aghga."
+ /* 4 */ ".afffa."
+ /* 5 */ ".aaaaa."
+ /* 6 */ "......."
+
+ // Level 3
+ /* z\x* 0123456 */
+ /* 0 */ "......."
/* 1 */ ".iijii."
/* 2 */ ".i...i."
/* 3 */ "......."
@@ -437,28 +483,28 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
/* 5 */ ".ii.ii."
/* 6 */ "......."
- // Level 3
+ // Level 4
/* z\x* 0123456 */
/* 0 */ "......."
- /* 1 */ ".ddddd."
- /* 2 */ ".dk.kd."
- /* 3 */ ".d...d."
- /* 4 */ ".d...d."
- /* 5 */ ".ddddd."
+ /* 1 */ ".aaaaa."
+ /* 2 */ ".ak.ka."
+ /* 3 */ ".a...a."
+ /* 4 */ ".a...a."
+ /* 5 */ ".aaaaa."
/* 6 */ "......."
- // Level 4
+ // Level 5
/* z\x* 0123456 */
/* 0 */ "lnnnnno"
- /* 1 */ "ldddddo"
- /* 2 */ "ldddddo"
- /* 3 */ "ldddddo"
- /* 4 */ "ldddddo"
- /* 5 */ "ldddddo"
+ /* 1 */ "laaaaao"
+ /* 2 */ "laaaaao"
+ /* 3 */ "laaaaao"
+ /* 4 */ "laaaaao"
+ /* 5 */ "laaaaao"
/* 6 */ "ppppppo",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -489,18 +535,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 27, ID 168, created by Aloe_vera
{
// Size:
- 9, 5, 7, // SizeX = 9, SizeY = 5, SizeZ = 7
+ 9, 6, 7, // SizeX = 9, SizeY = 6, SizeZ = 7
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 8, 4, 6, // MaxX, MaxY, MaxZ
+ 8, 5, 6, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 0\n" /* sandstonestairs */
- "b:128: 2\n" /* sandstonestairs */
- "c:128: 1\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e: 64: 7\n" /* wooddoorblock */
"f:171:14\n" /* carpet */
"g:171: 0\n" /* carpet */
@@ -517,27 +563,37 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Block data:
// Level 0
/* z\x* 012345678 */
- /* 0 */ "..abc...."
- /* 1 */ ".ddddddd."
- /* 2 */ ".ddddddd."
- /* 3 */ ".ddddddd."
- /* 4 */ ".ddddddd."
- /* 5 */ ".ddddddd."
- /* 6 */ "........."
+ /* 0 */ "mmaaammmm"
+ /* 1 */ "maaaaaaam"
+ /* 2 */ "maaaaaaam"
+ /* 3 */ "maaaaaaam"
+ /* 4 */ "maaaaaaam"
+ /* 5 */ "maaaaaaam"
+ /* 6 */ "mmmmmmmmm"
// Level 1
/* z\x* 012345678 */
- /* 0 */ "........."
- /* 1 */ ".ddedddd."
- /* 2 */ ".dfffffd."
- /* 3 */ ".dghhhgd."
- /* 4 */ ".dfffffd."
- /* 5 */ ".ddddddd."
+ /* 0 */ "..bcd...."
+ /* 1 */ ".aaaaaaa."
+ /* 2 */ ".aaaaaaa."
+ /* 3 */ ".aaaaaaa."
+ /* 4 */ ".aaaaaaa."
+ /* 5 */ ".aaaaaaa."
/* 6 */ "........."
// Level 2
/* z\x* 012345678 */
/* 0 */ "........."
+ /* 1 */ ".aaeaaaa."
+ /* 2 */ ".afffffa."
+ /* 3 */ ".aghhhga."
+ /* 4 */ ".afffffa."
+ /* 5 */ ".aaaaaaa."
+ /* 6 */ "........."
+
+ // Level 3
+ /* z\x* 012345678 */
+ /* 0 */ "........."
/* 1 */ ".iiji.ii."
/* 2 */ ".i.....i."
/* 3 */ "........."
@@ -545,28 +601,28 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
/* 5 */ ".iii.iii."
/* 6 */ "........."
- // Level 3
+ // Level 4
/* z\x* 012345678 */
/* 0 */ "........."
- /* 1 */ ".ddddddd."
- /* 2 */ ".dk.k..d."
- /* 3 */ ".d.....d."
- /* 4 */ ".d.....d."
- /* 5 */ ".ddddddd."
+ /* 1 */ ".aaaaaaa."
+ /* 2 */ ".ak.k..a."
+ /* 3 */ ".a.....a."
+ /* 4 */ ".a.....a."
+ /* 5 */ ".aaaaaaa."
/* 6 */ "........."
- // Level 4
+ // Level 5
/* z\x* 012345678 */
/* 0 */ "lnnnnnnnn"
- /* 1 */ "ldddddddo"
- /* 2 */ "ldddddddo"
- /* 3 */ "ldddddddo"
- /* 4 */ "ldddddddo"
- /* 5 */ "ldddddddo"
+ /* 1 */ "laaaaaaao"
+ /* 2 */ "laaaaaaao"
+ /* 3 */ "laaaaaaao"
+ /* 4 */ "laaaaaaao"
+ /* 5 */ "laaaaaaao"
/* 6 */ "ppppppppo",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -597,18 +653,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 28, ID 169, created by Aloe_vera
{
// Size:
- 10, 5, 7, // SizeX = 10, SizeY = 5, SizeZ = 7
+ 10, 6, 7, // SizeX = 10, SizeY = 6, SizeZ = 7
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 9, 4, 6, // MaxX, MaxY, MaxZ
+ 9, 5, 6, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 0\n" /* sandstonestairs */
- "b:128: 2\n" /* sandstonestairs */
- "c:128: 1\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e: 64: 7\n" /* wooddoorblock */
"f:171: 0\n" /* carpet */
"g:171:14\n" /* carpet */
@@ -626,29 +682,40 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Level 0
/* z\x* */
/* * 0123456789 */
- /* 0 */ "..abc....."
- /* 1 */ ".dddddddd."
- /* 2 */ ".dddddddd."
- /* 3 */ ".dddddddd."
- /* 4 */ ".dddddddd."
- /* 5 */ ".dddddddd."
- /* 6 */ ".........."
+ /* 0 */ "mmaaammmmm"
+ /* 1 */ "maaaaaaaam"
+ /* 2 */ "maaaaaaaam"
+ /* 3 */ "maaaaaaaam"
+ /* 4 */ "maaaaaaaam"
+ /* 5 */ "maaaaaaaam"
+ /* 6 */ "mmmmmmmmmm"
// Level 1
/* z\x* */
/* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".ddeddddd."
- /* 2 */ ".dfghhgfd."
- /* 3 */ ".dfhffhfd."
- /* 4 */ ".dfghhgfd."
- /* 5 */ ".dddddddd."
+ /* 0 */ "..bcd....."
+ /* 1 */ ".aaaaaaaa."
+ /* 2 */ ".aaaaaaaa."
+ /* 3 */ ".aaaaaaaa."
+ /* 4 */ ".aaaaaaaa."
+ /* 5 */ ".aaaaaaaa."
/* 6 */ ".........."
// Level 2
/* z\x* */
/* * 0123456789 */
/* 0 */ ".........."
+ /* 1 */ ".aaeaaaaa."
+ /* 2 */ ".afghhgfa."
+ /* 3 */ ".afhffhfa."
+ /* 4 */ ".afghhgfa."
+ /* 5 */ ".aaaaaaaa."
+ /* 6 */ ".........."
+
+ // Level 3
+ /* z\x* */
+ /* * 0123456789 */
+ /* 0 */ ".........."
/* 1 */ ".iijii.ii."
/* 2 */ ".i......i."
/* 3 */ ".........."
@@ -656,30 +723,30 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
/* 5 */ ".ii.ii.ii."
/* 6 */ ".........."
- // Level 3
+ // Level 4
/* z\x* */
/* * 0123456789 */
/* 0 */ ".........."
- /* 1 */ ".dddddddd."
- /* 2 */ ".dk.k...d."
- /* 3 */ ".d......d."
- /* 4 */ ".d......d."
- /* 5 */ ".dddddddd."
+ /* 1 */ ".aaaaaaaa."
+ /* 2 */ ".ak.k...a."
+ /* 3 */ ".a......a."
+ /* 4 */ ".a......a."
+ /* 5 */ ".aaaaaaaa."
/* 6 */ ".........."
- // Level 4
+ // Level 5
/* z\x* */
/* * 0123456789 */
/* 0 */ "lnnnnnnnnn"
- /* 1 */ "lddddddddo"
- /* 2 */ "lddddddddo"
- /* 3 */ "lddddddddo"
- /* 4 */ "lddddddddo"
- /* 5 */ "lddddddddo"
+ /* 1 */ "laaaaaaaao"
+ /* 2 */ "laaaaaaaao"
+ /* 3 */ "laaaaaaaao"
+ /* 4 */ "laaaaaaaao"
+ /* 5 */ "laaaaaaaao"
/* 6 */ "pppppppppo",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -710,18 +777,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 29, ID 170, created by Aloe_vera
{
// Size:
- 10, 5, 9, // SizeX = 10, SizeY = 5, SizeZ = 9
+ 10, 6, 9, // SizeX = 10, SizeY = 6, SizeZ = 9
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 9, 4, 8, // MaxX, MaxY, MaxZ
+ 9, 5, 8, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 0\n" /* sandstonestairs */
- "b:128: 2\n" /* sandstonestairs */
- "c:128: 1\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e: 64: 7\n" /* wooddoorblock */
"f:171: 0\n" /* carpet */
"g:171:14\n" /* carpet */
@@ -741,33 +808,46 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Level 0
/* z\x* */
/* * 0123456789 */
- /* 0 */ "..abc....."
- /* 1 */ ".dddddddd."
- /* 2 */ ".dddddddd."
- /* 3 */ ".dddddddd."
- /* 4 */ ".dddddddd."
- /* 5 */ ".dddddddd."
- /* 6 */ ".dddddddd."
- /* 7 */ ".dddddddd."
- /* 8 */ ".........."
+ /* 0 */ "mmaaammmmm"
+ /* 1 */ "maaaaaaaam"
+ /* 2 */ "maaaaaaaam"
+ /* 3 */ "maaaaaaaam"
+ /* 4 */ "maaaaaaaam"
+ /* 5 */ "maaaaaaaam"
+ /* 6 */ "maaaaaaaam"
+ /* 7 */ "maaaaaaaam"
+ /* 8 */ "mmmmmmmmmm"
// Level 1
/* z\x* */
/* * 0123456789 */
- /* 0 */ ".........."
- /* 1 */ ".ddeddddd."
- /* 2 */ ".dfghhgfd."
- /* 3 */ ".dfhffhfd."
- /* 4 */ ".dfhgghfd."
- /* 5 */ ".dfhffhfd."
- /* 6 */ ".dfghhgfd."
- /* 7 */ ".dddddddd."
+ /* 0 */ "..bcd....."
+ /* 1 */ ".aaaaaaaa."
+ /* 2 */ ".aaaaaaaa."
+ /* 3 */ ".aaaaaaaa."
+ /* 4 */ ".aaaaaaaa."
+ /* 5 */ ".aaaaaaaa."
+ /* 6 */ ".aaaaaaaa."
+ /* 7 */ ".aaaaaaaa."
/* 8 */ ".........."
// Level 2
/* z\x* */
/* * 0123456789 */
/* 0 */ ".........."
+ /* 1 */ ".aaeaaaaa."
+ /* 2 */ ".afghhgfa."
+ /* 3 */ ".afhffhfa."
+ /* 4 */ ".afhgghfa."
+ /* 5 */ ".afhffhfa."
+ /* 6 */ ".afghhgfa."
+ /* 7 */ ".aaaaaaaa."
+ /* 8 */ ".........."
+
+ // Level 3
+ /* z\x* */
+ /* * 0123456789 */
+ /* 0 */ ".........."
/* 1 */ ".iijii.ii."
/* 2 */ ".i......i."
/* 3 */ ".i......i."
@@ -777,34 +857,34 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
/* 7 */ ".ii.ii.ii."
/* 8 */ ".........."
- // Level 3
+ // Level 4
/* z\x* */
/* * 0123456789 */
/* 0 */ ".........."
- /* 1 */ ".dddddddd."
- /* 2 */ ".d..k...d."
- /* 3 */ ".d......d."
- /* 4 */ ".dl....nd."
- /* 5 */ ".d......d."
- /* 6 */ ".d......d."
- /* 7 */ ".dddddddd."
+ /* 1 */ ".aaaaaaaa."
+ /* 2 */ ".a..k...a."
+ /* 3 */ ".a......a."
+ /* 4 */ ".al....na."
+ /* 5 */ ".a......a."
+ /* 6 */ ".a......a."
+ /* 7 */ ".aaaaaaaa."
/* 8 */ ".........."
- // Level 4
+ // Level 5
/* z\x* */
/* * 0123456789 */
/* 0 */ "oppppppppp"
- /* 1 */ "oddddddddq"
- /* 2 */ "oddddddddq"
- /* 3 */ "oddddddddq"
- /* 4 */ "oddddddddq"
- /* 5 */ "oddddddddq"
- /* 6 */ "oddddddddq"
- /* 7 */ "oddddddddq"
+ /* 1 */ "oaaaaaaaaq"
+ /* 2 */ "oaaaaaaaaq"
+ /* 3 */ "oaaaaaaaaq"
+ /* 4 */ "oaaaaaaaaq"
+ /* 5 */ "oaaaaaaaaq"
+ /* 6 */ "oaaaaaaaaq"
+ /* 7 */ "oaaaaaaaaq"
/* 8 */ "rrrrrrrrrq",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
@@ -835,18 +915,18 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// The data has been exported from the gallery Desert, area index 30, ID 171, created by Aloe_vera
{
// Size:
- 11, 5, 9, // SizeX = 11, SizeY = 5, SizeZ = 9
+ 11, 6, 9, // SizeX = 11, SizeY = 6, SizeZ = 9
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
- 10, 4, 8, // MaxX, MaxY, MaxZ
+ 10, 5, 8, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
- "a:128: 0\n" /* sandstonestairs */
- "b:128: 2\n" /* sandstonestairs */
- "c:128: 1\n" /* sandstonestairs */
- "d: 24: 0\n" /* sandstone */
+ "a: 24: 0\n" /* sandstone */
+ "b:128: 0\n" /* sandstonestairs */
+ "c:128: 2\n" /* sandstonestairs */
+ "d:128: 1\n" /* sandstonestairs */
"e: 64: 7\n" /* wooddoorblock */
"f:171: 0\n" /* carpet */
"g:171:15\n" /* carpet */
@@ -867,33 +947,46 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
// Level 0
/* z\x* 1 */
/* * 01234567890 */
- /* 0 */ "..abc......"
- /* 1 */ ".ddddddddd."
- /* 2 */ ".ddddddddd."
- /* 3 */ ".ddddddddd."
- /* 4 */ ".ddddddddd."
- /* 5 */ ".ddddddddd."
- /* 6 */ ".ddddddddd."
- /* 7 */ ".ddddddddd."
- /* 8 */ "..........."
+ /* 0 */ "mmaaammmmmm"
+ /* 1 */ "maaaaaaaaam"
+ /* 2 */ "maaaaaaaaam"
+ /* 3 */ "maaaaaaaaam"
+ /* 4 */ "maaaaaaaaam"
+ /* 5 */ "maaaaaaaaam"
+ /* 6 */ "maaaaaaaaam"
+ /* 7 */ "maaaaaaaaam"
+ /* 8 */ "mmmmmmmmmmm"
// Level 1
/* z\x* 1 */
/* * 01234567890 */
- /* 0 */ "..........."
- /* 1 */ ".ddedddddd."
- /* 2 */ ".dffgggffd."
- /* 3 */ ".dfghhhgfd."
- /* 4 */ ".dfghfhgfd."
- /* 5 */ ".dfghhhgfd."
- /* 6 */ ".dffgggffd."
- /* 7 */ ".ddddddddd."
+ /* 0 */ "..bcd......"
+ /* 1 */ ".aaaaaaaaa."
+ /* 2 */ ".aaaaaaaaa."
+ /* 3 */ ".aaaaaaaaa."
+ /* 4 */ ".aaaaaaaaa."
+ /* 5 */ ".aaaaaaaaa."
+ /* 6 */ ".aaaaaaaaa."
+ /* 7 */ ".aaaaaaaaa."
/* 8 */ "..........."
// Level 2
/* z\x* 1 */
/* * 01234567890 */
/* 0 */ "..........."
+ /* 1 */ ".aaeaaaaaa."
+ /* 2 */ ".affgggffa."
+ /* 3 */ ".afghhhgfa."
+ /* 4 */ ".afghfhgfa."
+ /* 5 */ ".afghhhgfa."
+ /* 6 */ ".affgggffa."
+ /* 7 */ ".aaaaaaaaa."
+ /* 8 */ "..........."
+
+ // Level 3
+ /* z\x* 1 */
+ /* * 01234567890 */
+ /* 0 */ "..........."
/* 1 */ ".iijii.iii."
/* 2 */ ".i.......i."
/* 3 */ ".i.......i."
@@ -903,34 +996,34 @@ const cPrefab::sDef g_SandFlatRoofVillagePrefabs[] =
/* 7 */ ".ii.iii.ii."
/* 8 */ "..........."
- // Level 3
+ // Level 4
/* z\x* 1 */
/* * 01234567890 */
/* 0 */ "..........."
- /* 1 */ ".ddddddddd."
- /* 2 */ ".d..k....d."
- /* 3 */ ".d.......d."
- /* 4 */ ".dl.....nd."
- /* 5 */ ".d.......d."
- /* 6 */ ".d...o...d."
- /* 7 */ ".ddddddddd."
+ /* 1 */ ".aaaaaaaaa."
+ /* 2 */ ".a..k....a."
+ /* 3 */ ".a.......a."
+ /* 4 */ ".al.....na."
+ /* 5 */ ".a.......a."
+ /* 6 */ ".a...o...a."
+ /* 7 */ ".aaaaaaaaa."
/* 8 */ "..........."
- // Level 4
+ // Level 5
/* z\x* 1 */
/* * 01234567890 */
/* 0 */ "pqqqqqqqqqq"
- /* 1 */ "pdddddddddr"
- /* 2 */ "pdddddddddr"
- /* 3 */ "pdddddddddr"
- /* 4 */ "pdddddddddr"
- /* 5 */ "pdddddddddr"
- /* 6 */ "pdddddddddr"
- /* 7 */ "pdddddddddr"
+ /* 1 */ "paaaaaaaaar"
+ /* 2 */ "paaaaaaaaar"
+ /* 3 */ "paaaaaaaaar"
+ /* 4 */ "paaaaaaaaar"
+ /* 5 */ "paaaaaaaaar"
+ /* 6 */ "paaaaaaaaar"
+ /* 7 */ "paaaaaaaaar"
/* 8 */ "ssssssssssr",
// Connectors:
- "-1: 3, 0, 0: 2\n" /* Type -1, direction Z- */,
+ "-1: 3, 1, 0: 2\n" /* Type -1, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
diff --git a/src/Generating/RainbowRoadsGen.cpp b/src/Generating/RainbowRoadsGen.cpp
index d1e1f4bda..3b0ff7df8 100644
--- a/src/Generating/RainbowRoadsGen.cpp
+++ b/src/Generating/RainbowRoadsGen.cpp
@@ -29,11 +29,12 @@ class cRainbowRoadsGen::cRainbowRoads :
public:
cRainbowRoads(
int a_Seed,
+ int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ,
int a_MaxDepth,
int a_MaxSize
) :
- super(a_OriginX, a_OriginZ),
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed),
m_Noise(a_Seed),
m_MaxSize(a_MaxSize),
@@ -92,8 +93,8 @@ protected:
-cRainbowRoadsGen::cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 100),
+cRainbowRoadsGen::cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize) :
+ super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_Noise(a_Seed + 9000),
m_MaxDepth(a_MaxDepth),
m_MaxSize(a_MaxSize)
@@ -104,10 +105,10 @@ cRainbowRoadsGen::cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxDepth, i
-cGridStructGen::cStructurePtr cRainbowRoadsGen::CreateStructure(int a_OriginX, int a_OriginZ)
+cGridStructGen::cStructurePtr cRainbowRoadsGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
// Create a base based on the chosen prefabs:
- return cStructurePtr(new cRainbowRoads(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize));
+ return cStructurePtr(new cRainbowRoads(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize));
}
diff --git a/src/Generating/RainbowRoadsGen.h b/src/Generating/RainbowRoadsGen.h
index acbd5abf9..5813e1d14 100644
--- a/src/Generating/RainbowRoadsGen.h
+++ b/src/Generating/RainbowRoadsGen.h
@@ -22,7 +22,7 @@ class cRainbowRoadsGen :
typedef cGridStructGen super;
public:
- cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize);
+ cRainbowRoadsGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize);
protected:
class cRainbowRoads; // fwd: RainbowRoadsGen.cpp
@@ -39,7 +39,7 @@ protected:
// cGridStructGen overrides:
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ;
diff --git a/src/Generating/Ravines.cpp b/src/Generating/Ravines.cpp
index 2722e4ca3..24f2cc3ab 100644
--- a/src/Generating/Ravines.cpp
+++ b/src/Generating/Ravines.cpp
@@ -61,7 +61,7 @@ class cStructGenRavines::cRavine :
public:
- cRavine(int a_BlockX, int a_BlockZ, int a_Size, cNoise & a_Noise);
+ cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise);
#ifdef _DEBUG
/// Exports itself as a SVG line definition
@@ -81,7 +81,7 @@ protected:
// cStructGenRavines:
cStructGenRavines::cStructGenRavines(int a_Seed, int a_Size) :
- super(a_Seed, a_Size, a_Size, a_Size * 2, a_Size * 2, 100),
+ super(a_Seed, a_Size, a_Size, a_Size, a_Size, a_Size * 2, a_Size * 2, 100),
m_Noise(a_Seed),
m_Size(a_Size)
{
@@ -91,9 +91,9 @@ cStructGenRavines::cStructGenRavines(int a_Seed, int a_Size) :
-cGridStructGen::cStructurePtr cStructGenRavines::CreateStructure(int a_OriginX, int a_OriginZ)
+cGridStructGen::cStructurePtr cStructGenRavines::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
- return cStructurePtr(new cRavine(a_OriginX, a_OriginZ, m_Size, m_Noise));
+ return cStructurePtr(new cRavine(a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_Size, m_Noise));
}
@@ -104,8 +104,8 @@ cGridStructGen::cStructurePtr cStructGenRavines::CreateStructure(int a_OriginX,
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cStructGenRavines::cRavine
-cStructGenRavines::cRavine::cRavine(int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise) :
- super(a_OriginX, a_OriginZ)
+cStructGenRavines::cRavine::cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise) :
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
{
// Calculate the ravine shape-defining points:
GenerateBaseDefPoints(a_OriginX, a_OriginZ, a_Size, a_Noise);
diff --git a/src/Generating/Ravines.h b/src/Generating/Ravines.h
index 30b47e9ec..3e41c5ce6 100644
--- a/src/Generating/Ravines.h
+++ b/src/Generating/Ravines.h
@@ -32,7 +32,7 @@ protected:
// cGridStructGen overrides:
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ;
diff --git a/src/Generating/UnderwaterBaseGen.cpp b/src/Generating/UnderwaterBaseGen.cpp
index ff6f17dde..d3abae9b7 100644
--- a/src/Generating/UnderwaterBaseGen.cpp
+++ b/src/Generating/UnderwaterBaseGen.cpp
@@ -29,11 +29,12 @@ class cUnderwaterBaseGen::cUnderwaterBase :
public:
cUnderwaterBase(
int a_Seed,
+ int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ,
int a_MaxDepth,
int a_MaxSize
) :
- super(a_OriginX, a_OriginZ),
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed),
m_Noise(a_Seed),
m_MaxSize(a_MaxSize),
@@ -92,8 +93,8 @@ protected:
-cUnderwaterBaseGen::cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 100),
+cUnderwaterBaseGen::cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen) :
+ super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_Noise(a_Seed + 1000),
m_MaxDepth(a_MaxDepth),
m_MaxSize(a_MaxSize),
@@ -105,7 +106,7 @@ cUnderwaterBaseGen::cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxDept
-cGridStructGen::cStructurePtr cUnderwaterBaseGen::CreateStructure(int a_OriginX, int a_OriginZ)
+cGridStructGen::cStructurePtr cUnderwaterBaseGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
// Generate the biomes for the chunk surrounding the origin:
int ChunkX, ChunkZ;
@@ -134,7 +135,7 @@ cGridStructGen::cStructurePtr cUnderwaterBaseGen::CreateStructure(int a_OriginX,
} // for i - Biomes[]
// Create a base based on the chosen prefabs:
- return cStructurePtr(new cUnderwaterBase(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize));
+ return cStructurePtr(new cUnderwaterBase(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize));
}
diff --git a/src/Generating/UnderwaterBaseGen.h b/src/Generating/UnderwaterBaseGen.h
index 0aefbb4c7..d6267b602 100644
--- a/src/Generating/UnderwaterBaseGen.h
+++ b/src/Generating/UnderwaterBaseGen.h
@@ -22,7 +22,7 @@ class cUnderwaterBaseGen :
typedef cGridStructGen super;
public:
- cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen);
+ cUnderwaterBaseGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, cBiomeGen & a_BiomeGen);
protected:
class cUnderwaterBase; // fwd: UnderwaterBaseGen.cpp
@@ -42,7 +42,7 @@ protected:
// cGridStructGen overrides:
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ;
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index 9917141ed..2b7ecc837 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -110,6 +110,7 @@ class cVillageGen::cVillage :
public:
cVillage(
int a_Seed,
+ int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ,
int a_MaxRoadDepth,
int a_MaxSize,
@@ -119,7 +120,7 @@ public:
BLOCKTYPE a_RoadBlock,
BLOCKTYPE a_WaterRoadBlock
) :
- super(a_OriginX, a_OriginZ),
+ super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed),
m_Noise(a_Seed),
m_MaxSize(a_MaxSize),
@@ -358,8 +359,8 @@ static cVillagePiecePool * g_PlainsVillagePools[] =
-cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 100),
+cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen) :
+ super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_Noise(a_Seed + 1000),
m_MaxDepth(a_MaxDepth),
m_MaxSize(a_MaxSize),
@@ -374,7 +375,7 @@ cVillageGen::cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSi
-cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_OriginZ)
+cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ)
{
// Generate the biomes for the chunk surrounding the origin:
int ChunkX, ChunkZ;
@@ -435,7 +436,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_
{
return cStructurePtr();
}
- return cStructurePtr(new cVillage(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *VillagePrefabs, m_HeightGen, RoadBlock, WaterRoadBlock));
+ return cStructurePtr(new cVillage(m_Seed, a_GridX, a_GridZ, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *VillagePrefabs, m_HeightGen, RoadBlock, WaterRoadBlock));
}
diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h
index 5faaae8a6..694ea2358 100644
--- a/src/Generating/VillageGen.h
+++ b/src/Generating/VillageGen.h
@@ -21,7 +21,7 @@ class cVillageGen :
{
typedef cGridStructGen super;
public:
- cVillageGen(int a_Seed, int a_GridSize, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen);
+ cVillageGen(int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen);
protected:
class cVillage; // fwd: VillageGen.cpp
@@ -49,7 +49,7 @@ protected:
// cGridStructGen overrides:
- virtual cStructurePtr CreateStructure(int a_OriginX, int a_OriginZ) override;
+ virtual cStructurePtr CreateStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) override;
} ;
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index 61258cd45..2e73195f1 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -1,8 +1,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-#include <algorithm>
-
#include "IncrementalRedstoneSimulator.h"
#include "../BlockEntities/DropSpenserEntity.h"
#include "../BlockEntities/NoteEntity.h"
@@ -61,19 +59,21 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
int RelZ = 0;
BLOCKTYPE Block;
NIBBLETYPE Meta;
+ cChunk * Chunk;
if (a_OtherChunk != NULL)
{
RelX = a_BlockX - a_OtherChunk->GetPosX() * cChunkDef::Width;
RelZ = a_BlockZ - a_OtherChunk->GetPosZ() * cChunkDef::Width;
a_OtherChunk->GetBlockTypeMeta(RelX, a_BlockY, RelZ, Block, Meta);
- a_OtherChunk->SetIsRedstoneDirty(true);
+ Chunk = a_OtherChunk;
}
else
{
RelX = a_BlockX - a_Chunk->GetPosX() * cChunkDef::Width;
RelZ = a_BlockZ - a_Chunk->GetPosZ() * cChunkDef::Width;
a_Chunk->GetBlockTypeMeta(RelX, a_BlockY, RelZ, Block, Meta);
+ Chunk = a_Chunk;
}
// Every time a block is changed (AddBlock called), we want to go through all lists and check to see if the coordiantes stored within are still valid
@@ -92,7 +92,7 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
{
LOGD("cIncrementalRedstoneSimulator: Erased block @ {%i, %i, %i} from powered blocks list as it no longer connected to a source", itr->a_BlockPos.x, itr->a_BlockPos.y, itr->a_BlockPos.z);
itr = PoweredBlocks->erase(itr);
- a_Chunk->SetIsRedstoneDirty(true);
+ Chunk->SetIsRedstoneDirty(true);
continue;
}
else if (
@@ -107,9 +107,25 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
{
LOGD("cIncrementalRedstoneSimulator: Erased block @ {%i, %i, %i} from powered blocks list due to present/past metadata mismatch", itr->a_BlockPos.x, itr->a_BlockPos.y, itr->a_BlockPos.z);
itr = PoweredBlocks->erase(itr);
- a_Chunk->SetIsRedstoneDirty(true);
+ Chunk->SetIsRedstoneDirty(true);
continue;
}
+ else if (Block == E_BLOCK_DAYLIGHT_SENSOR)
+ {
+ if (!m_World.IsChunkLighted(Chunk->GetPosX(), Chunk->GetPosZ()))
+ {
+ m_World.QueueLightChunk(Chunk->GetPosX(), Chunk->GetPosZ());
+ }
+ else
+ {
+ if (Chunk->GetTimeAlteredLight(Chunk->GetSkyLight(RelX, a_BlockY + 1, RelZ)) <= 7)
+ {
+ itr = PoweredBlocks->erase(itr);
+ Chunk->SetIsRedstoneDirty(true);
+ continue;
+ }
+ }
+ }
++itr;
}
@@ -123,7 +139,7 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
{
LOGD("cIncrementalRedstoneSimulator: Erased block @ {%i, %i, %i} from linked powered blocks list as it is no longer connected to a source", itr->a_BlockPos.x, itr->a_BlockPos.y, itr->a_BlockPos.z);
itr = LinkedPoweredBlocks->erase(itr);
- a_Chunk->SetIsRedstoneDirty(true);
+ Chunk->SetIsRedstoneDirty(true);
continue;
}
else if (
@@ -137,7 +153,7 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
{
LOGD("cIncrementalRedstoneSimulator: Erased block @ {%i, %i, %i} from linked powered blocks list due to present/past metadata mismatch", itr->a_BlockPos.x, itr->a_BlockPos.y, itr->a_BlockPos.z);
itr = LinkedPoweredBlocks->erase(itr);
- a_Chunk->SetIsRedstoneDirty(true);
+ Chunk->SetIsRedstoneDirty(true);
continue;
}
}
@@ -147,7 +163,7 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
{
LOGD("cIncrementalRedstoneSimulator: Erased block @ {%i, %i, %i} from linked powered blocks list as it is no longer powered through a valid middle block", itr->a_BlockPos.x, itr->a_BlockPos.y, itr->a_BlockPos.z);
itr = LinkedPoweredBlocks->erase(itr);
- a_Chunk->SetIsRedstoneDirty(true);
+ Chunk->SetIsRedstoneDirty(true);
continue;
}
}
@@ -783,6 +799,7 @@ void cIncrementalRedstoneSimulator::HandleRedstoneRepeaterDelays()
{
for (RepeatersDelayList::iterator itr = m_RepeatersDelayList->begin(); itr != m_RepeatersDelayList->end(); itr++)
{
+
if (itr->a_ElapsedTicks >= itr->a_DelayTicks) // Has the elapsed ticks reached the target ticks?
{
int RelBlockX = itr->a_RelBlockPos.x;
@@ -1110,6 +1127,10 @@ void cIncrementalRedstoneSimulator::HandleDaylightSensor(int a_RelBlockX, int a_
{
SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
}
+ else
+ {
+ WakeUp(BlockX, a_RelBlockY, BlockZ, m_Chunk);
+ }
}
}