From 373d9f92a4000d3243fc94d8b5cfb1b64961525d Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Wed, 6 Apr 2016 16:16:16 +0300 Subject: Updated cChunk::SetMeta, fixed grass growth, reduced markDirty/setMeta usage --- src/Chunk.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/Chunk.h') diff --git a/src/Chunk.h b/src/Chunk.h index 557fe332a..9b9a26f03 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -392,15 +392,24 @@ public: { return m_ChunkData.GetMeta(a_RelX, a_RelY, a_RelZ); } - inline void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta) + + /** Set a meta value, with the option of not informing the client and / or not marking dirty. + Used for setting metas that are of little value for saving to disk and / or for sending to the client, + such as leaf decay flags. */ + inline void SetMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Meta, bool a_ShouldMarkDirty = true, bool a_ShouldInformClient = true) { bool hasChanged = m_ChunkData.SetMeta(a_RelX, a_RelY, a_RelZ, a_Meta); if (hasChanged) { - MarkDirty(); m_IsRedstoneDirty = true; - - m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(a_RelX, a_RelY, a_RelZ), a_Meta)); + if (a_ShouldMarkDirty) + { + MarkDirty(); + } + if (a_ShouldInformClient) + { + m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(a_RelX, a_RelY, a_RelZ), a_Meta)); + } } } -- cgit v1.2.3