From 25ec7750aac9800bec83a844020a6eeda5cd4d74 Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 31 Jan 2014 15:17:41 -0800 Subject: Changed signitures of Several BLockHandler Methods Changed the signitures of the following to use interfaces: GetPlacementBlockTypeMeta OnPlaced OnPlacedByPlayer OnDestroyed OnNeighbourChanged NeighbourChanged OnUse CanBeAt Check --- src/Blocks/BlockFluid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Blocks/BlockFluid.h') diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index bce5064bc..d57192d78 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -32,7 +32,7 @@ public: } - virtual void Check(int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override + virtual void Check(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override { switch (m_BlockType) { @@ -47,7 +47,7 @@ public: break; } } - super::Check(a_RelX, a_RelY, a_RelZ, a_Chunk); + super::Check(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk); } } ; -- cgit v1.2.3 From c6304b2b4faf31c2e4a91a07bcac298467898dba Mon Sep 17 00:00:00 2001 From: Tycho Date: Sat, 1 Feb 2014 05:06:32 -0800 Subject: Changed pointers to references --- src/Blocks/BlockFluid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Blocks/BlockFluid.h') diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index d57192d78..fbdbec26c 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -32,7 +32,7 @@ public: } - virtual void Check(cChunkInterface * a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override + virtual void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override { switch (m_BlockType) { -- cgit v1.2.3 From b82fc394dd2a40e12e3c13709fea26c2435792c9 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sun, 2 Feb 2014 06:49:37 -0800 Subject: Changed Signiture of OnUpdate --- src/Blocks/BlockFluid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Blocks/BlockFluid.h') diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index fbdbec26c..37885e4de 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -32,7 +32,7 @@ public: } - virtual void Check(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override + virtual void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override { switch (m_BlockType) { @@ -47,7 +47,7 @@ public: break; } } - super::Check(a_ChunkInterface, a_RelX, a_RelY, a_RelZ, a_Chunk); + super::Check(a_ChunkInterface, a_PluginInterface, a_RelX, a_RelY, a_RelZ, a_Chunk); } } ; @@ -68,7 +68,7 @@ public: /// Called to tick the block - virtual void OnUpdate(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { if (a_Chunk.GetWorld()->ShouldLavaSpawnFire()) { -- cgit v1.2.3 From 0836fe9a84e59b083db368205cbf6496355378bf Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 31 Mar 2014 20:33:33 +0100 Subject: Fixed a few Y too high/low asserts --- src/Blocks/BlockFluid.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Blocks/BlockFluid.h') diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 37885e4de..361b97c60 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -93,8 +93,8 @@ public: // Check if it's fuel: BLOCKTYPE BlockType; if ( - !a_Chunk.UnboundedRelGetBlockType(a_RelX + x, a_RelY + y, a_RelZ + z, BlockType) || - !cFireSimulator::IsFuel(BlockType) + ((a_RelY + y < 0) || (a_RelY + y > cChunkDef::Height)) || + (!a_Chunk.UnboundedRelGetBlockType(a_RelX + x, a_RelY + y, a_RelZ + z, BlockType) || !cFireSimulator::IsFuel(BlockType)) ) { return false; @@ -119,6 +119,7 @@ public: for (size_t i = 0; i < ARRAYCOUNT(CrossCoords); i++) { if ( + ((RelY + CrossCoords[i].y >= 0) && (RelY + CrossCoords[i].y <= cChunkDef::Height)) && a_Chunk.UnboundedRelGetBlockType(RelX + CrossCoords[i].x, RelY + CrossCoords[i].y, RelZ + CrossCoords[i].z, BlockType) && (BlockType == E_BLOCK_AIR) ) -- cgit v1.2.3 From fc940b6da4fd446e718879a19790af03dadfe2f4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 31 Mar 2014 21:36:19 +0100 Subject: Realised suggestions --- src/Blocks/BlockFluid.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Blocks/BlockFluid.h') diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 361b97c60..1200997ff 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -94,7 +94,10 @@ public: BLOCKTYPE BlockType; if ( ((a_RelY + y < 0) || (a_RelY + y > cChunkDef::Height)) || - (!a_Chunk.UnboundedRelGetBlockType(a_RelX + x, a_RelY + y, a_RelZ + z, BlockType) || !cFireSimulator::IsFuel(BlockType)) + ( + !a_Chunk.UnboundedRelGetBlockType(a_RelX + x, a_RelY + y, a_RelZ + z, BlockType) || + !cFireSimulator::IsFuel(BlockType) + ) ) { return false; -- cgit v1.2.3 From 43af11ee3808fa9836fc9467cacd73b78118c3c2 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 2 Apr 2014 20:03:42 +0100 Subject: Removed extra brackets --- src/Blocks/BlockFluid.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/Blocks/BlockFluid.h') diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 1200997ff..1f0c3833c 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -1,4 +1,3 @@ - #pragma once #include "BlockHandler.h" @@ -94,10 +93,8 @@ public: BLOCKTYPE BlockType; if ( ((a_RelY + y < 0) || (a_RelY + y > cChunkDef::Height)) || - ( - !a_Chunk.UnboundedRelGetBlockType(a_RelX + x, a_RelY + y, a_RelZ + z, BlockType) || - !cFireSimulator::IsFuel(BlockType) - ) + !a_Chunk.UnboundedRelGetBlockType(a_RelX + x, a_RelY + y, a_RelZ + z, BlockType) || + !cFireSimulator::IsFuel(BlockType) ) { return false; -- cgit v1.2.3 From da267649a183e84280da7eadcb391952fb6a0d1d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 2 Apr 2014 20:04:41 +0100 Subject: With eXtra line! --- src/Blocks/BlockFluid.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Blocks/BlockFluid.h') diff --git a/src/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 1f0c3833c..d486d642d 100644 --- a/src/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h @@ -1,3 +1,4 @@ + #pragma once #include "BlockHandler.h" -- cgit v1.2.3