From ba048e2101d42af53f2ac7a9a3ed04c194918136 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Fri, 3 Apr 2020 20:24:49 +0000 Subject: New hotfix to prevent calling OnBroken (#4600) * Fix stack overflow in breaking ice. Stupid fix, but it does work and is used in other places too... * Replace hotfix for pistons with better one * Fix comments in BlockBed handler --- src/Blocks/BlockBed.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Blocks/BlockBed.cpp') diff --git a/src/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp index e6193682a..8b349ef5e 100644 --- a/src/Blocks/BlockBed.cpp +++ b/src/Blocks/BlockBed.cpp @@ -21,27 +21,27 @@ void cBlockBedHandler::OnBroken(cChunkInterface & a_ChunkInterface, cWorldInterf if ((a_OldBlockMeta & 0x08) != 0) { // Was pillow - if (a_ChunkInterface.GetBlock(a_BlockPos - Direction) == E_BLOCK_BED) + Vector3i FootPos(a_BlockPos - Direction); + if (a_ChunkInterface.GetBlock(FootPos) == E_BLOCK_BED) { // First replace the bed with air - a_ChunkInterface.FastSetBlock(a_BlockPos - Direction, E_BLOCK_AIR, 0); + a_ChunkInterface.FastSetBlock(FootPos, E_BLOCK_AIR, 0); // Then destroy the bed entity - Vector3i PillowPos(a_BlockPos - Direction); - a_ChunkInterface.SetBlock(PillowPos, E_BLOCK_AIR, 0); + a_ChunkInterface.SetBlock(FootPos, E_BLOCK_AIR, 0); } } else { // Was foot end - if (a_ChunkInterface.GetBlock(a_BlockPos + Direction) == E_BLOCK_BED) + Vector3i PillowPos(a_BlockPos + Direction); + if (a_ChunkInterface.GetBlock(PillowPos) == E_BLOCK_BED) { // First replace the bed with air - a_ChunkInterface.FastSetBlock(a_BlockPos + Direction, E_BLOCK_AIR, 0); + a_ChunkInterface.FastSetBlock(PillowPos, E_BLOCK_AIR, 0); // Then destroy the bed entity - Vector3i FootPos(a_BlockPos + Direction); - a_ChunkInterface.SetBlock(FootPos, E_BLOCK_AIR, 0); + a_ChunkInterface.SetBlock(PillowPos, E_BLOCK_AIR, 0); } } } -- cgit v1.2.3