From 65bc09f8e803904560f56b1cfeaabfc8620d33b0 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 18 Nov 2012 21:50:05 +0000 Subject: Fixed wrong c++ standard assumptions about bools. Should fix FS #265. http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1053 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockID.cpp | 14 ++++++++++++-- source/ClientHandle.cpp | 6 ++++-- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/BlockID.cpp b/source/BlockID.cpp index faa19cfe9..d8e750f46 100644 --- a/source/BlockID.cpp +++ b/source/BlockID.cpp @@ -331,9 +331,19 @@ public: memset(g_BlockTransparent, 0x00, sizeof(g_BlockTransparent)); memset(g_BlockOneHitDig, 0x00, sizeof(g_BlockOneHitDig)); memset(g_BlockPistonBreakable, 0x00, sizeof(g_BlockPistonBreakable)); - memset(g_BlockIsSnowable, 0xff, sizeof(g_BlockIsSnowable)); // Set all blocks' snowable to true + + // Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415 + for (int i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++) + { + g_BlockIsSnowable[i] = true; + } memset(g_BlockRequiresSpecialTool, 0x00, sizeof(g_BlockRequiresSpecialTool)); // Set all blocks to false - memset(g_BlockIsSolid, 0xff, sizeof(g_BlockIsSolid)); // Set all blocks to true + + // Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415 + for (int i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++) + { + g_BlockIsSolid[i] = true; + } // Emissive blocks g_BlockLightValue[E_BLOCK_FIRE] = 15; diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index c25a482ca..ba1c8db35 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -614,12 +614,13 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha void cClientHandle::HandleBlockPlace(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, const cItem & a_HeldItem) { - LOGD("HandleBlockPlace: {%d, %d, %d}, face %d, itemtype: %d", - a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_HeldItem.m_ItemType + LOGD("HandleBlockPlace: {%d, %d, %d}, face %d, HeldItem: %s", + a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, ItemToFullString(a_HeldItem).c_str() ); if (!CheckBlockInteractionsRate()) { + LOGD("Too many block interactions, aborting placement"); return; } @@ -722,6 +723,7 @@ void cClientHandle::HandleBlockPlace(int a_BlockX, int a_BlockY, int a_BlockZ, c } else { + LOGD("Block refused placement here, aborting"); World->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, m_Player); // Send the old block back to the player return; } -- cgit v1.2.3