From 0f8c24e04d60aa1642a5fe7346941ccd7697977e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 17 Jul 2014 22:26:53 +0100 Subject: Fixed issues relating to saplings and leaves - Removed cBlockInfo::RequiresSpecialTool * Fixes #1195 * Fixes #1201 --- src/Bindings/DeprecatedBindings.cpp | 27 ---------------------- src/BlockInfo.cpp | 46 ------------------------------------- src/BlockInfo.h | 4 ---- src/Blocks/BlockBigFlower.h | 6 ++--- src/Blocks/BlockHandler.cpp | 46 +++++++++---------------------------- src/Blocks/BlockHandler.h | 10 ++++---- src/Blocks/BlockLeaves.h | 10 ++++++-- src/Blocks/BlockSapling.h | 4 ++-- src/Defines.h | 9 -------- src/Items/ItemHandler.cpp | 9 +++----- 10 files changed, 32 insertions(+), 139 deletions(-) diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp index d51ba2da3..5bba1ea7a 100644 --- a/src/Bindings/DeprecatedBindings.cpp +++ b/src/Bindings/DeprecatedBindings.cpp @@ -175,32 +175,6 @@ static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S) -/* get function: g_BlockRequiresSpecialTool */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockRequiresSpecialTool -static int tolua_get_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S) -{ - int BlockType; - #ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } - #endif - BlockType = (int)tolua_tonumber(tolua_S, 2, 0); - if ((BlockType < 0) || (BlockType > E_BLOCK_MAX_TYPE_ID)) - { - tolua_error(tolua_S, "array indexing out of range.", NULL); - } - tolua_pushboolean(tolua_S, cBlockInfo::RequiresSpecialTool((BLOCKTYPE)BlockType)); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - - - - - /* get function: g_BlockIsSolid */ #ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSolid static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S) @@ -263,7 +237,6 @@ void DeprecatedBindings::Bind(lua_State * tolua_S) tolua_array(tolua_S, "g_BlockOneHitDig", tolua_get_AllToLua_g_BlockOneHitDig, NULL); tolua_array(tolua_S, "g_BlockPistonBreakable", tolua_get_AllToLua_g_BlockPistonBreakable, NULL); tolua_array(tolua_S, "g_BlockIsSnowable", tolua_get_AllToLua_g_BlockIsSnowable, NULL); - tolua_array(tolua_S, "g_BlockRequiresSpecialTool", tolua_get_AllToLua_g_BlockRequiresSpecialTool, NULL); tolua_array(tolua_S, "g_BlockIsSolid", tolua_get_AllToLua_g_BlockIsSolid, NULL); tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, NULL); diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index b4b98a2f0..524d39b67 100644 --- a/src/BlockInfo.cpp +++ b/src/BlockInfo.cpp @@ -15,7 +15,6 @@ cBlockInfo::cBlockInfo() , m_OneHitDig(false) , m_PistonBreakable(false) , m_IsSnowable(false) - , m_RequiresSpecialTool(false) , m_IsSolid(true) , m_FullyOccupiesVoxel(false) , m_Handler(NULL) @@ -440,51 +439,6 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_TNT ].m_IsSnowable = true; a_Info[E_BLOCK_WOOL ].m_IsSnowable = true; - - // Blocks that don't drop without a special tool: - a_Info[E_BLOCK_BRICK ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_CAULDRON ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_COAL_ORE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_COBBLESTONE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_COBBLESTONE_WALL ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_COBBLESTONE_STAIRS ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_COBWEB ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_DIAMOND_BLOCK ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_DIAMOND_ORE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_DOUBLE_STONE_SLAB ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_EMERALD_ORE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_END_STONE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_GOLD_BLOCK ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_GOLD_ORE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_IRON_BLOCK ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_IRON_ORE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_LAPIS_BLOCK ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_LAPIS_ORE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_LEAVES ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_MOSSY_COBBLESTONE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_NETHERRACK ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_NETHER_BRICK ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_NETHER_BRICK_STAIRS ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_OBSIDIAN ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_REDSTONE_ORE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_REDSTONE_ORE_GLOWING].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_SANDSTONE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_SANDSTONE_STAIRS ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_SNOW ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_STONE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_STONE_BRICKS ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_STONE_BRICK_STAIRS ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_STONE_PRESSURE_PLATE].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_STONE_SLAB ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_VINES ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_FURNACE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_LIT_FURNACE ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_ANVIL ].m_RequiresSpecialTool = true; - a_Info[E_BLOCK_ENCHANTMENT_TABLE ].m_RequiresSpecialTool = true; - - // Nonsolid blocks: a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_IsSolid = false; a_Info[E_BLOCK_AIR ].m_IsSolid = false; diff --git a/src/BlockInfo.h b/src/BlockInfo.h index d6d4e7430..e10ca9e68 100644 --- a/src/BlockInfo.h +++ b/src/BlockInfo.h @@ -39,9 +39,6 @@ public: /** Can this block hold snow atop? */ bool m_IsSnowable; - /** Does this block require a tool to drop? */ - bool m_RequiresSpecialTool; - /** Is this block solid (player cannot walk through)? */ bool m_IsSolid; @@ -61,7 +58,6 @@ public: inline static bool IsOneHitDig (BLOCKTYPE a_Type) { return Get(a_Type).m_OneHitDig; } inline static bool IsPistonBreakable (BLOCKTYPE a_Type) { return Get(a_Type).m_PistonBreakable; } inline static bool IsSnowable (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSnowable; } - inline static bool RequiresSpecialTool (BLOCKTYPE a_Type) { return Get(a_Type).m_RequiresSpecialTool; } inline static bool IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; } inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; } diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index 39fd3cac8..0ba997a68 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -19,16 +19,16 @@ public: } - virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_DropVerbatim) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); if (Meta & 0x8) { - super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ); + super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ, a_DropVerbatim); } else { - super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ); + super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_DropVerbatim); } } diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index cef1f5f09..233070b14 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -407,39 +407,6 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_Bl - -void cBlockHandler::OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) -{ -} - - - - - -void cBlockHandler::OnDigging(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) -{ -} - - - - - -void cBlockHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) -{ -} - - - - - -void cBlockHandler::OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) -{ -} - - - - - void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) { // Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to override this. @@ -450,11 +417,20 @@ void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) -void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ) +void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_DropVerbatim) { cItems Pickups; NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - ConvertToPickups(Pickups, Meta); + + if (!a_DropVerbatim) + { + ConvertToPickups(Pickups, Meta); + } + else + { + // TODO: Add a proper overridable function for this + Pickups.Add(m_BlockType, 1, Meta); + } // Allow plugins to modify the pickups: a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups); diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index fb6cae729..ee4d4a6fe 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -60,25 +60,25 @@ public: virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ); /// Called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position) - virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ); + virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) {}; /// Notifies all neighbors of the given block about a change static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ); /// Called while the player diggs the block. - virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ); + virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {}; /// Called if the user right clicks the block and the block is useable - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ); + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) {}; /** Called when a Right Click to this Block is cancelled */ - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace); + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) {}; /// Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta); /// Handles the dropping of a block based on what ConvertToDrops() returns. This will not destroy the block. a_Digger is the entity causing the drop; it may be NULL - virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ); + virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_DropVerbatim = false); /// Returns step sound name of block virtual const char * GetStepSound(void); diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 495e849fa..67c4535b8 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -43,11 +43,17 @@ public: // Only the first 2 bits contain the display information, the others are for growing if (rand.NextInt(6) == 0) { - a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 3)); + a_Pickups.push_back( + cItem( + E_BLOCK_SAPLING, + 1, + (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01)) // Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand + ) + ); } // 1 % chance of dropping an apple, if the leaves' type is Apple Leaves - if ((a_BlockMeta & 3) == E_META_LEAVES_APPLE) + if ((m_BlockType == E_BLOCK_LEAVES) && ((a_BlockMeta & 0x03) == E_META_LEAVES_APPLE)) { if (rand.NextInt(101) == 0) { diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h index 3d925029a..e965809a3 100644 --- a/src/Blocks/BlockSapling.h +++ b/src/Blocks/BlockSapling.h @@ -20,8 +20,8 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - // Only the first 2 bits contain the display information, the others are for growing - a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 3)); + // Only the first 5 bits contain the display information, 8th bit for growth indicator (but we use 0x07 for forward compatibility) + a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x07)); } diff --git a/src/Defines.h b/src/Defines.h index ee91ee596..4fde6800a 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -727,14 +727,5 @@ namespace ItemCategory // tolua_end -inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType) -{ - if(!IsValidBlock(a_BlockType)) return false; - return cBlockInfo::RequiresSpecialTool(a_BlockType); -} - - - - diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 85406c826..604cce729 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -328,12 +328,9 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const if (a_Player->IsGameModeSurvival()) { - if (!BlockRequiresSpecialTool(Block) || CanHarvestBlock(Block)) - { - cChunkInterface ChunkInterface(a_World->GetChunkMap()); - cBlockInServerPluginInterface PluginInterface(*a_World); - Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ); - } + cChunkInterface ChunkInterface(a_World->GetChunkMap()); + cBlockInServerPluginInterface PluginInterface(*a_World); + Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block)); } a_Player->UseEquippedItem(); -- cgit v1.2.3 From 9c32e31edf7c283d939910f23b9f59edba0d2db6 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 18 Jul 2014 01:02:25 +0200 Subject: Items should first added to the first slot, not the latest. --- src/ItemGrid.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp index cd36b1f2a..395547545 100644 --- a/src/ItemGrid.cpp +++ b/src/ItemGrid.cpp @@ -269,7 +269,7 @@ int cItemGrid::AddItemToSlot(const cItem & a_ItemStack, int a_Slot, int a_Num, i int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_PrioritarySlot) { int NumLeft = a_ItemStack.m_ItemCount; - int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize(); + int MaxStack = a_ItemStack.GetMaxStackSize(); // Try prioritarySlot first: if ( @@ -284,7 +284,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit } // Scan existing stacks: - for (int i = m_NumSlots - 1; i >= 0; i--) + for (int i = 0; i < m_NumSlots; i++) { if (m_Slots[i].IsEqual(a_ItemStack)) { @@ -302,7 +302,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit return (a_ItemStack.m_ItemCount - NumLeft); } - for (int i = m_NumSlots - 1; i >= 0; i--) + for (int i = 0; i < m_NumSlots; i++) { if (m_Slots[i].IsEmpty()) { -- cgit v1.2.3 From 2e9aed793a5d4cde9fc93913ca0769fb1a913346 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 18 Jul 2014 01:16:49 +0200 Subject: Fixed the armor slot in creative mode. Also removed that armor get directly to the armor slot. It is extremely buggy and unnecessary. --- src/Inventory.cpp | 9 --------- src/UI/SlotArea.cpp | 13 +++++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Inventory.cpp b/src/Inventory.cpp index 38d3c886d..18154bafd 100644 --- a/src/Inventory.cpp +++ b/src/Inventory.cpp @@ -102,15 +102,6 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT { cItem ToAdd(a_Item); int res = 0; - if (ItemCategory::IsArmor(a_Item.m_ItemType)) - { - res = m_ArmorSlots.AddItem(ToAdd, a_AllowNewStacks); - ToAdd.m_ItemCount -= res; - if (ToAdd.m_ItemCount == 0) - { - return res; - } - } res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1); ToAdd.m_ItemCount = a_Item.m_ItemCount - res; diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 21b6ed0c8..f331c2fc2 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1866,6 +1866,19 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C { ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots())); + if (a_Player.IsGameModeCreative() && (m_ParentWindow.GetWindowType() == cWindow::wtInventory)) + { + if ((a_ClickAction == caDropKey) || (a_ClickAction == caCtrlDropKey)) + { + DropClicked(a_Player, a_SlotNum, (a_ClickAction == caCtrlDropKey)); + return; + } + + // Creative inventory must treat a_ClickedItem as a DraggedItem instead, replacing the inventory slot with it + SetSlot(a_SlotNum, a_Player, a_ClickedItem); + return; + } + bool bAsync = false; if (GetSlot(a_SlotNum, a_Player) == NULL) { -- cgit v1.2.3 From e32b0ce4fa1e81c48a5036bc4c43112fda7ffada Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 18 Jul 2014 16:38:59 +0200 Subject: Moved comment. --- src/UI/SlotArea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index f331c2fc2..6f4f65ca3 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1866,6 +1866,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C { ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots())); + // Creative inventory must treat a_ClickedItem as a DraggedItem instead, replacing the inventory slot with it if (a_Player.IsGameModeCreative() && (m_ParentWindow.GetWindowType() == cWindow::wtInventory)) { if ((a_ClickAction == caDropKey) || (a_ClickAction == caCtrlDropKey)) @@ -1874,7 +1875,6 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C return; } - // Creative inventory must treat a_ClickedItem as a DraggedItem instead, replacing the inventory slot with it SetSlot(a_SlotNum, a_Player, a_ClickedItem); return; } -- cgit v1.2.3 From 897d68dc35620f0e6c33fe4a6083a76ab43a9a57 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 20 Jul 2014 01:22:58 +0200 Subject: Add armor items directly to the armor slots. --- src/Inventory.cpp | 13 +++++++++++++ src/UI/SlotArea.cpp | 4 ++-- src/UI/SlotArea.h | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Inventory.cpp b/src/Inventory.cpp index 18154bafd..fff6e4a4e 100644 --- a/src/Inventory.cpp +++ b/src/Inventory.cpp @@ -103,6 +103,19 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT cItem ToAdd(a_Item); int res = 0; + // When the item is a armor, try to set it directly to the armor slot. + if (ItemCategory::IsArmor(a_Item.m_ItemType)) + { + for (size_t i = 0; i < (size_t)m_ArmorSlots.GetNumSlots(); i++) + { + if (m_ArmorSlots.GetSlot(i).IsEmpty() && cSlotAreaArmor::CanPlaceArmorInSlot(i, a_Item)) + { + m_ArmorSlots.SetSlot(i, a_Item); + return a_Item.m_ItemCount; + } + } + } + res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1); ToAdd.m_ItemCount = a_Item.m_ItemCount - res; if (ToAdd.m_ItemCount == 0) diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 6f4f65ca3..e9b1ef8e0 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1926,7 +1926,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C return; } - if (DraggingItem.IsEmpty() || CanPlaceInSlot(a_SlotNum, DraggingItem)) + if (DraggingItem.IsEmpty() || CanPlaceArmorInSlot(a_SlotNum, DraggingItem)) { // Swap contents cItem tmp(DraggingItem); @@ -1945,7 +1945,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C -bool cSlotAreaArmor::CanPlaceInSlot(int a_SlotNum, const cItem & a_Item) +bool cSlotAreaArmor::CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item) { switch (a_SlotNum) { diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h index 7f37159b7..fa842bb81 100644 --- a/src/UI/SlotArea.h +++ b/src/UI/SlotArea.h @@ -161,7 +161,7 @@ public: /** Called when a player clicks in the window. Parameters taken from the click packet. */ virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override; - bool CanPlaceInSlot(int a_SlotNum, const cItem & a_Item); + static bool CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item); } ; -- cgit v1.2.3 From f68b04e0294e5bc854fa6daad061e0280e5bb4f6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 20 Jul 2014 12:00:20 +0100 Subject: Proper comment for DropBlock() --- src/Blocks/BlockHandler.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index ee4d4a6fe..a6810933c 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -71,13 +71,16 @@ public: /// Called if the user right clicks the block and the block is useable virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) {}; - /** Called when a Right Click to this Block is cancelled */ + /** Called when a right click to this block is cancelled */ virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) {}; /// Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta); - /// Handles the dropping of a block based on what ConvertToDrops() returns. This will not destroy the block. a_Digger is the entity causing the drop; it may be NULL + /** Handles the dropping, but not destruction, of a block based on what ConvertTo(Verbatim)Pickups() returns, including the spawning of pickups and alertion of plugins + @param a_Digger The entity causing the drop; it may be NULL + @param a_DropVerbatim Calls ConvertToVerbatimPickups() instead of its counterpart, meaning the block itself is dropped by default (due to a speical tool or enchantment) + */ virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_DropVerbatim = false); /// Returns step sound name of block -- cgit v1.2.3 From bea574bf5425215bbed49ad4b3814804fd8757fc Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Mon, 21 Jul 2014 18:53:56 +0200 Subject: ExtremeHillsPlus and ExtremeHills spawn with grass only Turns out only the M variants have stone and gravel in them. --- src/Generating/DistortedHeightmap.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp index b46850a81..74d30c327 100644 --- a/src/Generating/DistortedHeightmap.cpp +++ b/src/Generating/DistortedHeightmap.cpp @@ -675,6 +675,8 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in case biForestHills: case biTaigaHills: case biExtremeHillsEdge: + case biExtremeHillsPlus: + case biExtremeHills: case biJungle: case biJungleHills: case biJungleEdge: @@ -750,18 +752,6 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in return; } - case biExtremeHillsPlus: - case biExtremeHills: - { - // Select the pattern to use - stone or grass: - NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + a_RelX)) / FrequencyX; - NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + a_RelZ)) / FrequencyZ; - NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY); - const sBlockInfo * Pattern = (Val < -0.1) ? patStone.Get() : patGrass.Get(); - FillColumnPattern(a_ChunkDesc, a_RelX, a_RelZ, Pattern); - return; - } - case biExtremeHillsPlusM: case biExtremeHillsM: { -- cgit v1.2.3 From 5b148c30f71874d62b55a5134fd4c7897ebe106a Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 22 Jul 2014 14:44:26 +0200 Subject: Extreme Hills M variant only spawn with grass and stone Removed gravel. --- src/Generating/DistortedHeightmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp index 74d30c327..1337896ab 100644 --- a/src/Generating/DistortedHeightmap.cpp +++ b/src/Generating/DistortedHeightmap.cpp @@ -759,7 +759,7 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + a_RelX)) / FrequencyX; NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + a_RelZ)) / FrequencyZ; NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY); - const sBlockInfo * Pattern = (Val < -0.9) ? patStone.Get() : ((Val > 0) ? patGravel.Get() : patGrass.Get()); + const sBlockInfo * Pattern = (Val < 0.0) ? patStone.Get() : patGrass.Get(); FillColumnPattern(a_ChunkDesc, a_RelX, a_RelZ, Pattern); return; } -- cgit v1.2.3 From 9045246e74e70ae711c85a88df63f007029e2849 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Jul 2014 13:02:28 -0700 Subject: Export BroadcastEntityAnimation with ToLua Fixes #752 --- src/World.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/World.h b/src/World.h index c78bc8c8c..2346ac523 100644 --- a/src/World.h +++ b/src/World.h @@ -217,7 +217,7 @@ public: void BroadcastEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL); void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL); void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); - virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override; + virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override; // tolua_export void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export void BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude = NULL); void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL); -- cgit v1.2.3 From bc5db3274fe101afcd9081857bd9b66c12e19906 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 22 Jul 2014 21:09:37 +0100 Subject: Fix misguided comment on bits... ...obviously written by someone very confused, also known as me --- src/Blocks/BlockSapling.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h index e965809a3..de28273d5 100644 --- a/src/Blocks/BlockSapling.h +++ b/src/Blocks/BlockSapling.h @@ -20,7 +20,7 @@ public: virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { - // Only the first 5 bits contain the display information, 8th bit for growth indicator (but we use 0x07 for forward compatibility) + // Only the first 2 bits contain the display information and the 4th bit is for the growth indicator, but, we use 0x07 for forward compatibility a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x07)); } -- cgit v1.2.3 From 4044d0a6e6c586aa483ae19d986c8f12c474d057 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Jul 2014 13:10:12 -0700 Subject: Export SendEntityAnimation to ToLua --- src/ClientHandle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 538ecdad7..c1c4cdff9 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -151,7 +151,7 @@ public: void SendMapInfo (int a_ID, unsigned int a_Scale); void SendPaintingSpawn (const cPainting & a_Painting); void SendPickupSpawn (const cPickup & a_Pickup); - void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); + void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); // tolua_export void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount); void SendPlayerAbilities (void); void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline); -- cgit v1.2.3 From e171285408028e858ec3a921bbfd97e8a5dcf6ca Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 22 Jul 2014 23:29:04 +0200 Subject: Fixed Bindings generation in MSVC. The bindings weren't regenerated because of the typo in the dependencies cmake variable. --- src/Bindings/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt index 95b858f5d..2ea2fa8c0 100644 --- a/src/Bindings/CMakeLists.txt +++ b/src/Bindings/CMakeLists.txt @@ -39,7 +39,7 @@ set (BINDING_OUTPUTS ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Call.inc ) -set(BINDING_DEPENDECIES +set(BINDING_DEPENDENCIES tolua ../Bindings/virtual_method_hooks.lua ../Bindings/AllToLua.pkg @@ -122,7 +122,7 @@ if (NOT MSVC) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} # add any new generation dependencies here - DEPENDS ${BINDING_DEPENDECIES} + DEPENDS ${BINDING_DEPENDENCIES} ) endif () set_source_files_properties(Bindings/Bindings.cpp PROPERTIES GENERATED TRUE) -- cgit v1.2.3 From ba8cb3b0a69be8db848e1feac4b05edb7953b1c6 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 22 Jul 2014 23:33:08 +0200 Subject: Fixed MSVC bindings regeneration. Still one typo had been left in the cmake file. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f494b52e5..b8780e8a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -265,7 +265,7 @@ if (MSVC) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ # add any new generation dependencies here - DEPENDS ${BINDING_DEPENDECIES} + DEPENDS ${BINDING_DEPENDENCIES} ) endif() -- cgit v1.2.3 From dfadcf745384f574e751e78bc3e2ddb262fe1fdf Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 23 Jul 2014 09:11:42 +0200 Subject: BlockLeaves: Fixed comment style. --- src/Blocks/BlockLeaves.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 1635eba08..e426c89e0 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -40,14 +40,14 @@ public: { cFastRandom rand; - // Only the first 2 bits contain the display information, the others are for growing + // Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand if (rand.NextInt(6) == 0) { a_Pickups.push_back( cItem( E_BLOCK_SAPLING, 1, - (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01)) // Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand + (m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01)) ) ); } -- cgit v1.2.3 From 9080f14dc2a1010d4169ba690c4bda8da1188ae9 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 23 Jul 2014 11:02:42 +0200 Subject: Fixed possible crash in the NetherClumpFoliage finisher. --- src/Generating/FinishGen.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 444af5022..c67cc574e 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -125,6 +125,11 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a float zz = (float) a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z; for (int y = a_RelY - 2; y < a_RelY + 2; y++) { + if ((y < 1) || (y > cChunkDef::Height)) + { + continue; + } + if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) // Don't replace non air blocks. { continue; -- cgit v1.2.3 From 7e38c123fcce1956f04aec2a57ee86c882e7840a Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Wed, 23 Jul 2014 11:23:35 +0200 Subject: TallGrass: Less grass on mountains. --- src/Generating/FinishGen.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h index a8a0e1e3b..810bb4a91 100644 --- a/src/Generating/FinishGen.h +++ b/src/Generating/FinishGen.h @@ -94,6 +94,17 @@ protected: { return 70; } + + case biExtremeHillsEdge: + case biExtremeHillsPlus: + case biExtremeHills: + case biExtremeHillsPlusM: + case biExtremeHillsM: + case biIceMountains: + { + return 3; + } + default: { return 20; -- cgit v1.2.3 From 396739cc0faf01a099acbe669c5a9def98d3aaae Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 23 Jul 2014 16:32:09 +0200 Subject: Fix item durability. Fixes #1181 --- src/BlockInfo.cpp | 1 + src/Blocks/BlockLeaves.h | 16 ---------------- src/Blocks/BlockTallGrass.h | 3 ++- src/Blocks/BlockVine.h | 7 +++++++ src/Entities/Entity.cpp | 13 ++++++++----- src/Entities/Player.cpp | 4 ++-- src/Entities/Player.h | 2 +- src/FastRandom.h | 3 +++ src/Inventory.cpp | 16 ++++++++++------ src/Item.cpp | 46 ++++++++++++++++++++++----------------------- src/Items/ItemHandler.cpp | 32 +++++++++++++++++++++++++++++-- src/Items/ItemHandler.h | 17 +++++++++++++++-- src/Items/ItemHoe.h | 10 +++++++--- src/Items/ItemShears.h | 25 +++++++++++++++++++++++- src/Items/ItemSword.h | 17 +++++++++++++++-- src/Mobs/Sheep.cpp | 6 +----- 16 files changed, 149 insertions(+), 69 deletions(-) diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index 97e89359f..c4510fe6d 100644 --- a/src/BlockInfo.cpp +++ b/src/BlockInfo.cpp @@ -454,6 +454,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_DOUBLE_STONE_SLAB ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_EMERALD_ORE ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_END_STONE ].m_RequiresSpecialTool = true; + a_Info[E_BLOCK_VINES ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_GOLD_BLOCK ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_GOLD_ORE ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE].m_RequiresSpecialTool = true; diff --git a/src/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 797824506..18f336225 100644 --- a/src/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h @@ -55,22 +55,6 @@ public: } } } - - - void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override - { - cBlockHandler::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ); - - // 0.5% chance of dropping an apple, if the leaves' type is Apple Leaves: - NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - cFastRandom rand; - if (((Meta & 3) == E_META_LEAVES_APPLE) && (rand.NextInt(201) == 100)) - { - cItems Drops; - Drops.push_back(cItem(E_ITEM_RED_APPLE, 1, 0)); - a_WorldInterface.SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ); - } - } virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override diff --git a/src/Blocks/BlockTallGrass.h b/src/Blocks/BlockTallGrass.h index ba1f2e0f6..9c008f793 100644 --- a/src/Blocks/BlockTallGrass.h +++ b/src/Blocks/BlockTallGrass.h @@ -43,8 +43,9 @@ public: cItems Pickups; Pickups.Add(E_BLOCK_TALL_GRASS, 1, Meta); a_WorldInterface.SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ); + + a_Player->UseEquippedItem(); } - a_Player->UseEquippedItem(); } diff --git a/src/Blocks/BlockVine.h b/src/Blocks/BlockVine.h index 61092af3e..1e1f6d8d2 100644 --- a/src/Blocks/BlockVine.h +++ b/src/Blocks/BlockVine.h @@ -44,6 +44,13 @@ public: } + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // Reset meta to 0 + a_Pickups.push_back(cItem(E_BLOCK_VINES, 1, 0)); + } + + static NIBBLETYPE DirectionToMetaData(char a_BlockFace) { switch (a_BlockFace) diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index db0fd0fd6..6c3d7b40c 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -12,6 +12,7 @@ #include "../Bindings/PluginManager.h" #include "../Tracer.h" #include "Player.h" +#include "Items/ItemHandler.h" @@ -289,11 +290,6 @@ void cEntity::SetPitchFromSpeed(void) bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) { - if (cRoot::Get()->GetPluginManager()->CallHookTakeDamage(*this, a_TDI)) - { - return false; - } - if (m_Health <= 0) { // Can't take damage if already dead @@ -306,10 +302,17 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) return false; } + if (cRoot::Get()->GetPluginManager()->CallHookTakeDamage(*this, a_TDI)) + { + return false; + } + if ((a_TDI.Attacker != NULL) && (a_TDI.Attacker->IsPlayer())) { cPlayer * Player = (cPlayer *)a_TDI.Attacker; + Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this); + // IsOnGround() only is false if the player is moving downwards // TODO: Better damage increase, and check for enchantments (and use magic critical instead of plain) if (!Player->IsOnGround()) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index fcc8eb9a0..afe5965aa 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1929,14 +1929,14 @@ cPlayer::StringList cPlayer::GetResolvedPermissions() -void cPlayer::UseEquippedItem(void) +void cPlayer::UseEquippedItem(int a_Amount) { if (IsGameModeCreative()) // No damage in creative { return; } - if (GetInventory().DamageEquippedItem()) + if (GetInventory().DamageEquippedItem(a_Amount)) { m_World->BroadcastSoundEffect("random.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); } diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 26db2050b..e89d9f48f 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -349,7 +349,7 @@ public: const AString & GetLoadedWorldName() { return m_LoadedWorldName; } - void UseEquippedItem(void); + void UseEquippedItem(int a_Amount = 1); void SendHealth(void); diff --git a/src/FastRandom.h b/src/FastRandom.h index 567198a31..2061a3958 100644 --- a/src/FastRandom.h +++ b/src/FastRandom.h @@ -44,6 +44,9 @@ public: /// Returns a random float in the range [0 .. a_Range]; a_Range must be less than 1M; a_Salt is additional source of randomness float NextFloat(float a_Range, int a_Salt); + /** Returns a random float between 0 and 1. */ + float NextFloat(void) { return NextFloat(1); }; + /** Returns a random int in the range [a_Begin .. a_End] */ int GenerateRandomInteger(int a_Begin, int a_End); diff --git a/src/Inventory.cpp b/src/Inventory.cpp index 0f9716d89..a34d51993 100644 --- a/src/Inventory.cpp +++ b/src/Inventory.cpp @@ -222,12 +222,6 @@ void cInventory::SetSlot(int a_SlotNum, const cItem & a_Item) return; } Grid->SetSlot(GridSlotNum, a_Item); - - // Broadcast the Equipped Item, if the Slot is changed. - if ((Grid == &m_HotbarSlots) && (m_EquippedSlotNum == (a_SlotNum - invHotbarOffset))) - { - m_Owner.GetWorld()->BroadcastEntityEquipment(m_Owner, 0, a_Item, m_Owner.GetClientHandle()); - } } @@ -393,6 +387,10 @@ bool cInventory::DamageItem(int a_SlotNum, short a_Amount) LOGWARNING("%s: requesting an invalid slot index: %d out of %d", __FUNCTION__, a_SlotNum, invNumSlots - 1); return false; } + if (a_Amount <= 0) + { + return false; + } int GridSlotNum = 0; cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); @@ -713,6 +711,12 @@ void cInventory::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) m_ArmorSlots.GetSlot(a_SlotNum), m_Owner.GetClientHandle() ); } + + // Broadcast the Equipped Item, if the Slot is changed. + if ((a_ItemGrid == &m_HotbarSlots) && (m_EquippedSlotNum == a_SlotNum)) + { + m_Owner.GetWorld()->BroadcastEntityEquipment(m_Owner, 0, GetEquippedItem(), m_Owner.GetClientHandle()); + } // Convert the grid-local a_SlotNum to our global SlotNum: int Base = 0; diff --git a/src/Item.cpp b/src/Item.cpp index b44472e38..2c5deaddf 100644 --- a/src/Item.cpp +++ b/src/Item.cpp @@ -41,33 +41,33 @@ short cItem::GetMaxDamage(void) const switch (m_ItemType) { case E_ITEM_BOW: return 384; - case E_ITEM_DIAMOND_AXE: return 1563; - case E_ITEM_DIAMOND_HOE: return 1563; - case E_ITEM_DIAMOND_PICKAXE: return 1563; - case E_ITEM_DIAMOND_SHOVEL: return 1563; - case E_ITEM_DIAMOND_SWORD: return 1563; - case E_ITEM_FLINT_AND_STEEL: return 65; + case E_ITEM_DIAMOND_AXE: return 1561; + case E_ITEM_DIAMOND_HOE: return 1561; + case E_ITEM_DIAMOND_PICKAXE: return 1561; + case E_ITEM_DIAMOND_SHOVEL: return 1561; + case E_ITEM_DIAMOND_SWORD: return 1561; + case E_ITEM_FLINT_AND_STEEL: return 64; case E_ITEM_GOLD_AXE: return 32; case E_ITEM_GOLD_HOE: return 32; case E_ITEM_GOLD_PICKAXE: return 32; case E_ITEM_GOLD_SHOVEL: return 32; case E_ITEM_GOLD_SWORD: return 32; - case E_ITEM_IRON_AXE: return 251; - case E_ITEM_IRON_HOE: return 251; - case E_ITEM_IRON_PICKAXE: return 251; - case E_ITEM_IRON_SHOVEL: return 251; - case E_ITEM_IRON_SWORD: return 251; - case E_ITEM_SHEARS: return 251; - case E_ITEM_STONE_AXE: return 132; - case E_ITEM_STONE_HOE: return 132; - case E_ITEM_STONE_PICKAXE: return 132; - case E_ITEM_STONE_SHOVEL: return 132; - case E_ITEM_STONE_SWORD: return 132; - case E_ITEM_WOODEN_AXE: return 60; - case E_ITEM_WOODEN_HOE: return 60; - case E_ITEM_WOODEN_PICKAXE: return 60; - case E_ITEM_WOODEN_SHOVEL: return 60; - case E_ITEM_WOODEN_SWORD: return 60; + case E_ITEM_IRON_AXE: return 250; + case E_ITEM_IRON_HOE: return 250; + case E_ITEM_IRON_PICKAXE: return 250; + case E_ITEM_IRON_SHOVEL: return 250; + case E_ITEM_IRON_SWORD: return 250; + case E_ITEM_SHEARS: return 250; + case E_ITEM_STONE_AXE: return 131; + case E_ITEM_STONE_HOE: return 131; + case E_ITEM_STONE_PICKAXE: return 131; + case E_ITEM_STONE_SHOVEL: return 131; + case E_ITEM_STONE_SWORD: return 131; + case E_ITEM_WOODEN_AXE: return 59; + case E_ITEM_WOODEN_HOE: return 59; + case E_ITEM_WOODEN_PICKAXE: return 59; + case E_ITEM_WOODEN_SHOVEL: return 59; + case E_ITEM_WOODEN_SWORD: return 59; } return 0; } @@ -86,7 +86,7 @@ bool cItem::DamageItem(short a_Amount) } m_ItemDamage += a_Amount; - return (m_ItemDamage >= MaxDamage); + return (m_ItemDamage > MaxDamage); } diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index bf1d4e4cb..f0a91214d 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -335,8 +335,21 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ); } } - - a_Player->UseEquippedItem(); + + if (!cBlockInfo::IsOneHitDig(Block)) + { + a_Player->UseEquippedItem(GetDurabilityLostWithThatAction(dlaBreakBlock)); + } +} + + + + + +void cItemHandler::OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity) +{ + UNUSED(a_AttackedEntity); + a_Attacker->UseEquippedItem(GetDurabilityLostWithThatAction(dlaAttackEntity)); } @@ -354,6 +367,20 @@ void cItemHandler::OnFoodEaten(cWorld * a_World, cPlayer * a_Player, cItem * a_I +short cItemHandler::GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) +{ + switch (a_Action) + { + case dlaAttackEntity: return 2; + case dlaBreakBlock: return 1; + } + return 0; +} + + + + + char cItemHandler::GetMaxStackSize(void) { if (m_ItemType < 256) @@ -505,6 +532,7 @@ bool cItemHandler::IsPlaceable(void) bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType) { + UNUSED(a_ItemType); return false; } diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h index c7362c5f4..28b1dd13b 100644 --- a/src/Items/ItemHandler.h +++ b/src/Items/ItemHandler.h @@ -19,6 +19,13 @@ class cPlayer; class cItemHandler { public: + + enum eDurabilityLostAction + { + dlaBreakBlock, + dlaAttackEntity, + }; + cItemHandler(int a_ItemType); /** Force virtual destructor */ @@ -48,11 +55,17 @@ public: virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace); /** Called when the player destroys a block using this item. This also calls the drop function for the destroyed block */ - virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_X, int a_Y, int a_Z); + virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ); + + /** Called when a player attacks a other entity. */ + virtual void OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity); /** Called after the player has eaten this item. */ virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item); - + + /** Get the durability lost which the item will get, when a specified action was performed. */ + virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action); + /** Returns the maximum stack size for a given item */ virtual char GetMaxStackSize(void); diff --git a/src/Items/ItemHoe.h b/src/Items/ItemHoe.h index 29f7c83d5..6523b36d9 100644 --- a/src/Items/ItemHoe.h +++ b/src/Items/ItemHoe.h @@ -16,7 +16,6 @@ public: cItemHoeHandler(int a_ItemType) : cItemHandler(a_ItemType) { - } virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override @@ -26,13 +25,18 @@ public: if ((Block == E_BLOCK_DIRT) || (Block == E_BLOCK_GRASS)) { a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FARMLAND, 0); - a_Player->UseEquippedItem(); return true; - } + return false; } + + + virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + { + return 0; + } } ; diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h index 39d2776fa..f1b6cafc3 100644 --- a/src/Items/ItemShears.h +++ b/src/Items/ItemShears.h @@ -12,6 +12,7 @@ class cItemShearsHandler : public cItemHandler { + typedef cItemHandler super; public: cItemShearsHandler(int a_ItemType) : cItemHandler(a_ItemType) @@ -30,8 +31,12 @@ public: BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); if ((Block == E_BLOCK_LEAVES) || (Block == E_BLOCK_NEW_LEAVES)) { + NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); + cBlockHandler * Handler = cBlockInfo::GetHandler(Block); + cItems Drops; - Drops.push_back(cItem(Block, 1, a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x03)); + Handler->ConvertToPickups(Drops, Meta); + Drops.push_back(cItem(Block, 1, Meta & 3)); a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ); a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); @@ -56,6 +61,24 @@ public: } // switch (a_BlockType) return false; } + + + virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + { + return 0; + } + + + virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ) override + { + super::OnBlockDestroyed(a_World, a_Player, a_Item, a_BlockX, a_BlockY, a_BlockZ); + + BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); + if ((Block == E_BLOCK_TRIPWIRE) || (Block == E_BLOCK_VINES)) + { + a_Player->UseEquippedItem(); + } + } } ; diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 44feb2d83..8fd70bd7b 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -12,18 +12,20 @@ class cItemSwordHandler : public cItemHandler { + typedef cItemHandler super; public: cItemSwordHandler(int a_ItemType) : cItemHandler(a_ItemType) { - } - + + virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override { return (a_BlockType == E_BLOCK_COBWEB); } + virtual bool CanRepairWithRawMaterial(short a_ItemType) override { switch (m_ItemType) @@ -36,6 +38,17 @@ public: } return false; } + + + virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + { + switch (a_Action) + { + case dlaAttackEntity: return 1; + case dlaBreakBlock: return 2; + } + return 0; + } } ; diff --git a/src/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index 7335848b7..9fb47201d 100644 --- a/src/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp @@ -52,11 +52,7 @@ void cSheep::OnRightClicked(cPlayer & a_Player) { m_IsSheared = true; m_World->BroadcastEntityMetadata(*this); - - if (!a_Player.IsGameModeCreative()) - { - a_Player.UseEquippedItem(); - } + a_Player.UseEquippedItem(); cItems Drops; int NumDrops = m_World->GetTickRandomNumber(2) + 1; -- cgit v1.2.3 From 997a643977ea901a3cd3a3d1d7171d65b82a828c Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Wed, 23 Jul 2014 20:28:56 +0200 Subject: Moar view distance! Let's blow up our computers! :D --- src/ClientHandle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ClientHandle.h b/src/ClientHandle.h index c1c4cdff9..50ed596d5 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -56,8 +56,8 @@ public: #else static const int DEFAULT_VIEW_DISTANCE = 10; #endif - static const int MAX_VIEW_DISTANCE = 15; - static const int MIN_VIEW_DISTANCE = 3; + static const int MAX_VIEW_DISTANCE = 32; + static const int MIN_VIEW_DISTANCE = 1; cClientHandle(const cSocket * a_Socket, int a_ViewDistance); virtual ~cClientHandle(); -- cgit v1.2.3 From 9678341a11caa08a40c3ddb562d893fc0cd2ba73 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Thu, 24 Jul 2014 12:15:48 +0200 Subject: Made the cWorld::SpawnMobFinalize function more readable. --- src/World.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/World.cpp b/src/World.cpp index 4ddd11f59..104805209 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2975,21 +2975,31 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eTyp int cWorld::SpawnMobFinalize(cMonster * a_Monster) { + // Invalid cMonster object. Bail out. if (!a_Monster) + { return -1; + } + + // Give the mob full health. a_Monster->SetHealth(a_Monster->GetMaxHealth()); + + // A plugin doesn't agree with the spawn. bail out. if (cPluginManager::Get()->CallHookSpawningMonster(*this, *a_Monster)) { delete a_Monster; a_Monster = NULL; return -1; } + + // Initialize the monster into the current world. if (!a_Monster->Initialize(*this)) { delete a_Monster; a_Monster = NULL; return -1; } + BroadcastSpawnEntity(*a_Monster); cPluginManager::Get()->CallHookSpawnedMonster(*this, *a_Monster); -- cgit v1.2.3 From c0b62ef139a65ca648135fb6999e6623438fdd71 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 24 Jul 2014 18:32:05 +0200 Subject: Added a queue for setting chunk data. Fixes #1196. --- src/CMakeLists.txt | 2 + src/Chunk.cpp | 40 ++++++-------- src/Chunk.h | 14 ++--- src/ChunkMap.cpp | 25 +++------ src/ChunkMap.h | 20 ++----- src/SetChunkData.cpp | 115 ++++++++++++++++++++++++++++++++++++++ src/SetChunkData.h | 120 ++++++++++++++++++++++++++++++++++++++++ src/World.cpp | 85 +++++++++++++++++----------- src/World.h | 36 ++++++------ src/WorldStorage/WSSAnvil.cpp | 5 +- src/WorldStorage/WSSCompact.cpp | 5 +- 11 files changed, 349 insertions(+), 118 deletions(-) create mode 100644 src/SetChunkData.cpp create mode 100644 src/SetChunkData.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b8780e8a6..29337cb2e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,6 +56,7 @@ SET (SRCS Root.cpp Scoreboard.cpp Server.cpp + SetChunkData.cpp Statistics.cpp StringCompression.cpp StringUtils.cpp @@ -124,6 +125,7 @@ SET (HDRS Root.h Scoreboard.h Server.h + SetChunkData.h StackWalker.h Statistics.h StringCompression.h diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 60987b070..10bc2ff23 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -34,6 +34,7 @@ #include "MobCensus.h" #include "MobSpawner.h" #include "BlockInServerPluginInterface.h" +#include "SetChunkData.h" #include "json/json.h" @@ -265,41 +266,34 @@ void cChunk::GetAllData(cChunkDataCallback & a_Callback) -void cChunk::SetAllData( - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const HeightMap * a_HeightMap, - const BiomeMap & a_BiomeMap, - cBlockEntityList & a_BlockEntities -) +void cChunk::SetAllData(cSetChunkData & a_SetChunkData) { - memcpy(m_BiomeMap, a_BiomeMap, sizeof(m_BiomeMap)); + ASSERT(a_SetChunkData.IsHeightMapValid()); + ASSERT(a_SetChunkData.AreBiomesValid()); + + memcpy(m_BiomeMap, a_SetChunkData.GetBiomes(), sizeof(m_BiomeMap)); + memcpy(m_HeightMap, a_SetChunkData.GetHeightMap(), sizeof(m_HeightMap)); - if (a_HeightMap != NULL) + m_ChunkData.SetBlockTypes(a_SetChunkData.GetBlockTypes()); + m_ChunkData.SetMetas(a_SetChunkData.GetBlockMetas()); + if (a_SetChunkData.IsLightValid()) { - memcpy(m_HeightMap, a_HeightMap, sizeof(m_HeightMap)); + m_ChunkData.SetBlockLight(a_SetChunkData.GetBlockLight()); + m_ChunkData.SetSkyLight(a_SetChunkData.GetSkyLight()); + m_IsLightValid = true; } - - if (a_HeightMap == NULL) + else { - CalculateHeightmap(a_BlockTypes); + m_IsLightValid = false; } - m_ChunkData.SetBlockTypes(a_BlockTypes); - m_ChunkData.SetMetas(a_BlockMeta); - m_ChunkData.SetBlockLight(a_BlockLight); - m_ChunkData.SetSkyLight(a_BlockSkyLight); - - m_IsLightValid = (a_BlockLight != NULL) && (a_BlockSkyLight != NULL); - // Clear the block entities present - either the loader / saver has better, or we'll create empty ones: for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) { delete *itr; } - std::swap(a_BlockEntities, m_BlockEntities); + m_BlockEntities.clear(); + std::swap(a_SetChunkData.GetBlockEntities(), m_BlockEntities); // Set all block entities' World variable: for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) diff --git a/src/Chunk.h b/src/Chunk.h index 9ab39a0a2..5d50f9717 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -95,16 +95,10 @@ public: /** Gets all chunk data, calls the a_Callback's methods for each data type */ void GetAllData(cChunkDataCallback & a_Callback); - /** Sets all chunk data */ - void SetAllData( - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap & a_BiomeMap, - cBlockEntityList & a_BlockEntities - ); + /** Sets all chunk data as either loaded from the storage or generated. + BlockLight and BlockSkyLight are optional, if not present, chunk will be marked as unlighted. + Modifies the BlockEntity list in a_SetChunkData - moves the block entities into the chunk. */ + void SetAllData(cSetChunkData & a_SetChunkData); void SetLight( const cChunkDef::BlockNibbles & a_BlockLight, diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 3ef981e94..05d219918 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -16,6 +16,7 @@ #include "MobCensus.h" #include "MobSpawner.h" #include "BoundingBox.h" +#include "SetChunkData.h" #include "Entities/Pickup.h" @@ -912,28 +913,20 @@ void cChunkMap::MarkChunkSaved (int a_ChunkX, int a_ChunkZ) -void cChunkMap::SetChunkData( - int a_ChunkX, int a_ChunkZ, - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap & a_BiomeMap, - cBlockEntityList & a_BlockEntities, - bool a_MarkDirty -) +void cChunkMap::SetChunkData(cSetChunkData & a_SetChunkData) { + int ChunkX = a_SetChunkData.GetChunkX(); + int ChunkZ = a_SetChunkData.GetChunkZ(); { cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); if (Chunk == NULL) { return; } - Chunk->SetAllData(a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, a_HeightMap, a_BiomeMap, a_BlockEntities); + Chunk->SetAllData(a_SetChunkData); - if (a_MarkDirty) + if (a_SetChunkData.ShouldMarkDirty()) { Chunk->MarkDirty(); } @@ -942,7 +935,7 @@ void cChunkMap::SetChunkData( cChunkStays ToBeDisabled; for (cChunkStays::iterator itr = m_ChunkStays.begin(), end = m_ChunkStays.end(); itr != end; ++itr) { - if ((*itr)->ChunkAvailable(a_ChunkX, a_ChunkZ)) + if ((*itr)->ChunkAvailable(ChunkX, ChunkZ)) { // The chunkstay wants to be disabled, add it to a list of to-be-disabled chunkstays for later processing: ToBeDisabled.push_back(*itr); @@ -957,7 +950,7 @@ void cChunkMap::SetChunkData( } // Notify plugins of the chunk becoming available - cPluginManager::Get()->CallHookChunkAvailable(m_World, a_ChunkX, a_ChunkZ); + cPluginManager::Get()->CallHookChunkAvailable(m_World, ChunkX, ChunkZ); } diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 4be1a4752..e33d9f894 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -34,6 +34,7 @@ class cChunkDataSerializer; class cBlockArea; class cMobCensus; class cMobSpawner; +class cSetChunkData; typedef std::list cClientHandleList; typedef cChunk * cChunkPtr; @@ -112,22 +113,11 @@ public: void MarkChunkSaved (int a_ChunkX, int a_ChunkZ); /** Sets the chunk data as either loaded from the storage or generated. - a_BlockLight and a_BlockSkyLight are optional, if not present, chunk will be marked as unlighted. - a_BiomeMap is optional, if not present, biomes will be calculated by the generator - a_HeightMap is optional, if not present, will be calculated. - If a_MarkDirty is set, the chunk is set as dirty (used after generating) + BlockLight and BlockSkyLight are optional, if not present, chunk will be marked as unlighted. + If MarkDirty is set, the chunk is set as dirty (used after generating) + Modifies the BlockEntity list in a_SetChunkData - moves the block entities into the chunk. */ - void SetChunkData( - int a_ChunkX, int a_ChunkZ, - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap & a_BiomeMap, - cBlockEntityList & a_BlockEntities, - bool a_MarkDirty - ); + void SetChunkData(cSetChunkData & a_SetChunkData); void ChunkLighted( int a_ChunkX, int a_ChunkZ, diff --git a/src/SetChunkData.cpp b/src/SetChunkData.cpp new file mode 100644 index 000000000..6e0c2733e --- /dev/null +++ b/src/SetChunkData.cpp @@ -0,0 +1,115 @@ + +// SetChunkData.cpp + +// Implements the cSetChunkData class used for sending loaded / generated chunk + +#include "Globals.h" +#include "SetChunkData.h" + + + + + +cSetChunkData::cSetChunkData(int a_ChunkX, int a_ChunkZ, bool a_ShouldMarkDirty) : + m_ChunkX(a_ChunkX), + m_ChunkZ(a_ChunkZ), + m_ShouldMarkDirty(a_ShouldMarkDirty) +{ +} + + + + + +cSetChunkData::cSetChunkData( + int a_ChunkX, int a_ChunkZ, + const BLOCKTYPE * a_BlockTypes, + const NIBBLETYPE * a_BlockMetas, + const NIBBLETYPE * a_BlockLight, + const NIBBLETYPE * a_SkyLight, + const cChunkDef::HeightMap * a_HeightMap, + const cChunkDef::BiomeMap * a_Biomes, + cEntityList & a_Entities, + cBlockEntityList & a_BlockEntities, + bool a_ShouldMarkDirty +) : + m_ChunkX(a_ChunkX), + m_ChunkZ(a_ChunkZ), + m_ShouldMarkDirty(a_ShouldMarkDirty) +{ + // Check the params' validity: + ASSERT(a_BlockTypes != NULL); + ASSERT(a_BlockMetas != NULL); + ASSERT(a_Biomes != NULL); + + // Copy block types and metas: + memcpy(m_BlockTypes, a_BlockTypes, sizeof(cChunkDef::BlockTypes)); + memcpy(m_BlockMetas, a_BlockMetas, sizeof(cChunkDef::BlockNibbles)); + + // Copy lights, if both given: + if ((a_BlockLight != NULL) && (a_SkyLight != NULL)) + { + memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight)); + memcpy(m_SkyLight, a_SkyLight, sizeof(m_SkyLight)); + m_IsLightValid = true; + } + else + { + m_IsLightValid = false; + } + + // Copy the heightmap, if available: + if (a_HeightMap != NULL) + { + memcpy(m_HeightMap, a_HeightMap, sizeof(m_HeightMap)); + m_IsHeightMapValid = true; + } + else + { + m_IsHeightMapValid = false; + } + + // Copy biomes, if available: + if (a_Biomes != NULL) + { + memcpy(m_Biomes, a_Biomes, sizeof(m_Biomes)); + m_AreBiomesValid = true; + } + else + { + m_AreBiomesValid = false; + } + + // Move entities and blockentities: + std::swap(m_Entities, a_Entities); + std::swap(m_BlockEntities, a_BlockEntities); +} + + + + + +void cSetChunkData::CalculateHeightMap(void) +{ + for (int x = 0; x < cChunkDef::Width; x++) + { + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int y = cChunkDef::Height - 1; y > -1; y--) + { + int index = cChunkDef::MakeIndexNoCheck(x, y, z); + if (m_BlockTypes[index] != E_BLOCK_AIR) + { + m_HeightMap[x + z * cChunkDef::Width] = (HEIGHTTYPE)y; + break; + } + } // for y + } // for z + } // for x + m_IsHeightMapValid = true; +} + + + + + diff --git a/src/SetChunkData.h b/src/SetChunkData.h new file mode 100644 index 000000000..a2f776f6b --- /dev/null +++ b/src/SetChunkData.h @@ -0,0 +1,120 @@ + +// SetChunkData.h + +// Declares the cSetChunkData class used for sending loaded / generated chunk data into cWorld + + + + + +#pragma once + + + + + +class cSetChunkData +{ +public: + /** Constructs a new instance with empty data. + Allocates new buffers for the block data. + Prefer to use this constructor, then fill the object with data and then send it to cWorld, as this will + reduce the copying required to queue the set operation. */ + cSetChunkData(int a_ChunkX, int a_ChunkZ, bool a_ShouldMarkDirty); + + /** Constructs a new instance based on data existing elsewhere, will copy all the memory. Prefer to use the + other constructor as much as possible. + Will move the entity and blockentity lists into the internal storage, and empty the a_Entities and + a_BlockEntities lists. + a_BlockTypes and a_BlockMetas must always be valid. + If either of the light arrays are NULL, the chunk data will be marked as not having any light at all and + will be scheduled for re-lighting once it is set into the chunkmap. + If a_Biomes is not valid, the internal flag is set and the world will calculate the biomes using the chunk + generator when setting the chunk data. + If a_HeightMap is not assigned, the world will calculate the heightmap based on the blocktypes when setting + the chunk data. */ + cSetChunkData( + int a_ChunkX, int a_ChunkZ, + const BLOCKTYPE * a_BlockTypes, + const NIBBLETYPE * a_BlockMetas, + const NIBBLETYPE * a_BlockLight, + const NIBBLETYPE * a_SkyLight, + const cChunkDef::HeightMap * a_HeightMap, + const cChunkDef::BiomeMap * a_Biomes, + cEntityList & a_Entities, + cBlockEntityList & a_BlockEntities, + bool a_ShouldMarkDirty + ); + + int GetChunkX(void) const { return m_ChunkX; } + int GetChunkZ(void) const { return m_ChunkZ; } + + /** Returns the internal storage of the block types, read-only. */ + const cChunkDef::BlockTypes & GetBlockTypes(void) const { return m_BlockTypes; } + + /** Returns the internal storage of the block types, read-only. */ + const cChunkDef::BlockNibbles & GetBlockMetas(void) const { return m_BlockMetas; } + + /** Returns the internal storage of the block light, read-only. */ + const cChunkDef::BlockNibbles & GetBlockLight(void) const { return m_BlockLight; } + + /** Returns the internal storage of the block types, read-only. */ + const cChunkDef::BlockNibbles & GetSkyLight(void) const { return m_SkyLight; } + + /** Returns the internal storage for heightmap, read-only. */ + const cChunkDef::HeightMap & GetHeightMap(void) const { return m_HeightMap; } + + /** Returns the internal storage for biomes, read-write. */ + cChunkDef::BiomeMap & GetBiomes(void) { return m_Biomes; } + + /** Returns the internal storage for entities, read-write. */ + cEntityList & GetEntities(void) { return m_Entities; } + + /** Returns the internal storage for block entities, read-write. */ + cBlockEntityList & GetBlockEntities(void) { return m_BlockEntities; } + + /** Returns whether both light arrays stored in this object are valid. */ + bool IsLightValid(void) const { return m_IsLightValid; } + + /** Returns whether the heightmap stored in this object is valid. */ + bool IsHeightMapValid(void) const { return m_IsHeightMapValid; } + + /** Returns whether the biomes stored in this object are valid. */ + bool AreBiomesValid(void) const { return m_AreBiomesValid; } + + /** Returns whether the chunk should be marked as dirty after its data is set. + Used by the generator to save chunks after generating. */ + bool ShouldMarkDirty(void) const { return m_ShouldMarkDirty; } + + /** Marks the biomes stored in this object as valid. */ + void MarkBiomesValid(void) { m_AreBiomesValid = true; } + + /** Calculates the heightmap based on the contained blocktypes and marks it valid. */ + void CalculateHeightMap(void); + +protected: + int m_ChunkX; + int m_ChunkZ; + + cChunkDef::BlockTypes m_BlockTypes; + cChunkDef::BlockNibbles m_BlockMetas; + cChunkDef::BlockNibbles m_BlockLight; + cChunkDef::BlockNibbles m_SkyLight; + cChunkDef::HeightMap m_HeightMap; + cChunkDef::BiomeMap m_Biomes; + cEntityList m_Entities; + cBlockEntityList m_BlockEntities; + + bool m_IsLightValid; + bool m_IsHeightMapValid; + bool m_AreBiomesValid; + bool m_ShouldMarkDirty; +}; + +typedef SharedPtr cSetChunkDataPtr; // TODO: Change to unique_ptr once we go C++11 +typedef std::vector cSetChunkDataPtrs; + + + + + diff --git a/src/World.cpp b/src/World.cpp index 104805209..7ad350e24 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -11,6 +11,7 @@ #include "ChunkMap.h" #include "Generating/ChunkDesc.h" #include "OSSupport/Timer.h" +#include "SetChunkData.h" // Serializers #include "WorldStorage/ScoreboardSerializer.h" @@ -719,6 +720,17 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec) // Call the plugins cPluginManager::Get()->CallHookWorldTick(*this, a_Dt, a_LastTickDurationMSec); + // Set any chunk data that has been queued for setting: + cSetChunkDataPtrs SetChunkDataQueue; + { + cCSLock Lock(m_CSSetChunkDataQueue); + std::swap(SetChunkDataQueue, m_SetChunkDataQueue); + } + for (cSetChunkDataPtrs::iterator itr = SetChunkDataQueue.begin(), end = SetChunkDataQueue.end(); itr != end; ++itr) + { + SetChunkData(**itr); + } // for itr - SetChunkDataQueue[] + // We need sub-tick precision here, that's why we store the time in seconds and calculate ticks off of it m_WorldAgeSecs += (double)a_Dt / 1000.0; m_TimeOfDaySecs += (double)a_Dt / 1000.0; @@ -2217,47 +2229,59 @@ void cWorld::MarkChunkSaved (int a_ChunkX, int a_ChunkZ) -void cWorld::SetChunkData( - int a_ChunkX, int a_ChunkZ, - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap * a_BiomeMap, - cEntityList & a_Entities, - cBlockEntityList & a_BlockEntities, - bool a_MarkDirty -) +void cWorld::QueueSetChunkData(const cSetChunkDataPtr & a_SetChunkData) { // Validate biomes, if needed: - cChunkDef::BiomeMap BiomeMap; - const cChunkDef::BiomeMap * Biomes = a_BiomeMap; - if (a_BiomeMap == NULL) + if (!a_SetChunkData->AreBiomesValid()) { // The biomes are not assigned, get them from the generator: - Biomes = &BiomeMap; - m_Generator.GenerateBiomes(a_ChunkX, a_ChunkZ, BiomeMap); + m_Generator.GenerateBiomes(a_SetChunkData->GetChunkX(), a_SetChunkData->GetChunkZ(), a_SetChunkData->GetBiomes()); + a_SetChunkData->MarkBiomesValid(); } - m_ChunkMap->SetChunkData( - a_ChunkX, a_ChunkZ, - a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, - a_HeightMap, *Biomes, - a_BlockEntities, - a_MarkDirty - ); + // Validate heightmap, if needed: + if (!a_SetChunkData->IsHeightMapValid()) + { + a_SetChunkData->CalculateHeightMap(); + } + + // Store a copy of the data in the queue: + // TODO: If the queue is too large, wait for it to get processed. Not likely, though. + cCSLock Lock(m_CSSetChunkDataQueue); + m_SetChunkDataQueue.push_back(a_SetChunkData); +} + + + + + +void cWorld::SetChunkData(cSetChunkData & a_SetChunkData) +{ + ASSERT(a_SetChunkData.AreBiomesValid()); + ASSERT(a_SetChunkData.IsHeightMapValid()); + + m_ChunkMap->SetChunkData(a_SetChunkData); // Initialize the entities (outside the m_ChunkMap's CS, to fix FS #347): - for (cEntityList::iterator itr = a_Entities.begin(), end = a_Entities.end(); itr != end; ++itr) + cEntityList Entities; + std::swap(a_SetChunkData.GetEntities(), Entities); + for (cEntityList::iterator itr = Entities.begin(), end = Entities.end(); itr != end; ++itr) { (*itr)->Initialize(*this); } // If a client is requesting this chunk, send it to them: - if (m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ)) + int ChunkX = a_SetChunkData.GetChunkX(); + int ChunkZ = a_SetChunkData.GetChunkZ(); + if (m_ChunkMap->HasChunkAnyClients(ChunkX, ChunkZ)) + { + m_ChunkSender.ChunkReady(ChunkX, ChunkZ); + } + + // Save the chunk right after generating, so that we don't have to generate it again on next run + if (a_SetChunkData.ShouldMarkDirty()) { - m_ChunkSender.ChunkReady(a_ChunkX, a_ChunkZ); + m_Storage.QueueSaveChunk(ChunkX, 0, ChunkZ); } } @@ -3295,17 +3319,14 @@ void cWorld::cChunkGeneratorCallbacks::OnChunkGenerated(cChunkDesc & a_ChunkDesc cChunkDef::BlockNibbles BlockMetas; a_ChunkDesc.CompressBlockMetas(BlockMetas); - m_World->SetChunkData( + m_World->QueueSetChunkData(cSetChunkDataPtr(new cSetChunkData( a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ(), a_ChunkDesc.GetBlockTypes(), BlockMetas, NULL, NULL, // We don't have lighting, chunk will be lighted when needed &a_ChunkDesc.GetHeightMap(), &a_ChunkDesc.GetBiomeMap(), a_ChunkDesc.GetEntities(), a_ChunkDesc.GetBlockEntities(), true - ); - - // Save the chunk right after generating, so that we don't have to generate it again on next run - m_World->GetStorage().QueueSaveChunk(a_ChunkDesc.GetChunkX(), 0, a_ChunkDesc.GetChunkZ()); + ))); } diff --git a/src/World.h b/src/World.h index 2346ac523..6613b495a 100644 --- a/src/World.h +++ b/src/World.h @@ -49,9 +49,14 @@ class cNoteEntity; class cMobHeadEntity; class cCompositeChat; class cCuboid; +class cSetChunkData; + typedef std::list< cPlayer * > cPlayerList; +typedef SharedPtr cSetChunkDataPtr; // TODO: Change to unique_ptr once we go C++11 +typedef std::vector cSetChunkDataPtrs; + typedef cItemCallback cPlayerListCallback; typedef cItemCallback cEntityCallback; typedef cItemCallback cChestCallback; @@ -246,24 +251,9 @@ public: void MarkChunkSaving(int a_ChunkX, int a_ChunkZ); void MarkChunkSaved (int a_ChunkX, int a_ChunkZ); - /** Sets the chunk data as either loaded from the storage or generated. - a_BlockLight and a_BlockSkyLight are optional, if not present, chunk will be marked as unlighted. - a_BiomeMap is optional, if not present, biomes will be calculated by the generator - a_HeightMap is optional, if not present, will be calculated. - If a_MarkDirty is set, the chunk is set as dirty (used after generating) - */ - void SetChunkData( - int a_ChunkX, int a_ChunkZ, - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap * a_BiomeMap, - cEntityList & a_Entities, - cBlockEntityList & a_BlockEntities, - bool a_MarkDirty - ); + /** Puts the chunk data into a queue to be set into the chunkmap in the tick thread. + If the chunk data doesn't contain valid biomes, the biomes are calculated before adding the data into the queue. */ + void QueueSetChunkData(const cSetChunkDataPtr & a_SetChunkData); void ChunkLighted( int a_ChunkX, int a_ChunkZ, @@ -969,6 +959,12 @@ private: /** List of players that are scheduled for adding, waiting for the Tick thread to add them. */ cPlayerList m_PlayersToAdd; + + /** CS protecting m_SetChunkDataQueue. */ + cCriticalSection m_CSSetChunkDataQueue; + + /** Queue for the chunk data to be set into m_ChunkMap by the tick thread. Protected by m_CSSetChunkDataQueue */ + cSetChunkDataPtrs m_SetChunkDataQueue; cWorld(const AString & a_WorldName); @@ -1011,6 +1007,10 @@ private: /** Adds the players queued in the m_PlayersToAdd queue into the m_Players list. Assumes it is called from the Tick thread. */ void AddQueuedPlayers(void); + + /** Sets the specified chunk data into the chunkmap. Called in the tick thread. + Modifies the a_SetChunkData - moves the entities contained in it into the chunk. */ + void SetChunkData(cSetChunkData & a_SetChunkData); }; // tolua_export diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 663d489bc..2851647fe 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -14,6 +14,7 @@ #include "../Item.h" #include "../ItemGrid.h" #include "../StringCompression.h" +#include "../SetChunkData.h" #include "../BlockEntities/ChestEntity.h" #include "../BlockEntities/CommandBlockEntity.h" @@ -391,7 +392,7 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT } // for y //*/ - m_World->SetChunkData( + m_World->QueueSetChunkData(cSetChunkDataPtr(new cSetChunkData( a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, BlockTypes, MetaData, IsLightValid ? BlockLight : NULL, @@ -399,7 +400,7 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT NULL, Biomes, Entities, BlockEntities, false - ); + ))); return true; } diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp index 5382a3e01..ee47047a0 100644 --- a/src/WorldStorage/WSSCompact.cpp +++ b/src/WorldStorage/WSSCompact.cpp @@ -18,6 +18,7 @@ #include "../BlockEntities/MobHeadEntity.h" #include "../BlockEntities/NoteEntity.h" #include "../BlockEntities/SignEntity.h" +#include "../SetChunkData.h" @@ -911,7 +912,7 @@ bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int a_Uncompre NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + LightOffset); NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + SkyLightOffset); - a_World->SetChunkData( + a_World->QueueSetChunkData(cSetChunkDataPtr(new cSetChunkData( a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, BlockData, MetaData, IsLightValid ? BlockLight : NULL, @@ -919,7 +920,7 @@ bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int a_Uncompre NULL, NULL, Entities, BlockEntities, false - ); + ))); return true; } -- cgit v1.2.3 From 4191be7ddba820af4ed0c505a8d62416c2b7a8b4 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Jul 2014 15:36:13 -0700 Subject: Removed redundant semicolons and re-added warning --- SetFlags.cmake | 14 +++++++------- src/Bindings/Plugin.h | 4 ++-- src/BlockEntities/BlockEntity.h | 4 ++-- src/BlockEntities/JukeboxEntity.h | 2 +- src/BlockEntities/NoteEntity.h | 2 +- src/Blocks/BlockHandler.h | 8 ++++---- src/Chunk.h | 6 +++--- src/ChunkDataCallback.h | 14 +++++++------- src/CommandOutput.h | 6 +++--- src/Entities/ArrowEntity.h | 2 +- src/Entities/Boat.h | 2 +- src/Entities/EnderCrystal.h | 2 +- src/Entities/Entity.h | 2 +- src/Entities/EntityEffect.h | 2 +- src/Entities/ExpBottleEntity.h | 2 +- src/Entities/ExpOrb.h | 2 +- src/Entities/FallingBlock.h | 2 +- src/Entities/FireChargeEntity.h | 2 +- src/Entities/FireworkEntity.h | 2 +- src/Entities/Floater.h | 2 +- src/Entities/GhastFireballEntity.h | 2 +- src/Entities/HangingEntity.h | 4 ++-- src/Entities/ItemFrame.h | 4 ++-- src/Entities/Minecart.h | 12 ++++++------ src/Entities/Painting.h | 2 +- src/Entities/Pawn.h | 2 +- src/Entities/Pickup.h | 2 +- src/Entities/Player.h | 2 +- src/Entities/ProjectileEntity.h | 2 +- src/Entities/SplashPotionEntity.h | 2 +- src/Entities/TNTEntity.h | 2 +- src/Entities/ThrownEggEntity.h | 2 +- src/Entities/ThrownEnderPearlEntity.h | 2 +- src/Entities/ThrownSnowballEntity.h | 2 +- src/Entities/WitherSkullEntity.h | 2 +- src/Generating/ChunkGenerator.h | 2 +- src/HTTPServer/HTTPMessage.h | 2 +- src/Mobs/Bat.h | 2 +- src/Mobs/Blaze.h | 2 +- src/Mobs/CaveSpider.h | 2 +- src/Mobs/Chicken.h | 2 +- src/Mobs/Cow.h | 2 +- src/Mobs/Creeper.h | 2 +- src/Mobs/EnderDragon.h | 2 +- src/Mobs/Enderman.h | 2 +- src/Mobs/Ghast.h | 2 +- src/Mobs/Giant.h | 2 +- src/Mobs/Horse.h | 2 +- src/Mobs/IronGolem.h | 2 +- src/Mobs/MagmaCube.h | 2 +- src/Mobs/Monster.h | 2 +- src/Mobs/Mooshroom.h | 2 +- src/Mobs/Ocelot.h | 2 +- src/Mobs/Pig.h | 2 +- src/Mobs/Sheep.h | 2 +- src/Mobs/Silverfish.h | 2 +- src/Mobs/Skeleton.h | 4 ++-- src/Mobs/Slime.h | 2 +- src/Mobs/SnowGolem.h | 2 +- src/Mobs/Spider.h | 2 +- src/Mobs/Squid.h | 2 +- src/Mobs/Villager.h | 2 +- src/Mobs/Witch.h | 2 +- src/Mobs/Wither.h | 2 +- src/Mobs/Wolf.h | 2 +- src/Mobs/Zombie.h | 2 +- src/Mobs/ZombiePigman.h | 2 +- src/OSSupport/Queue.h | 4 ++-- src/Protocol/Protocol.h | 2 +- src/Protocol/Protocol125.h | 2 +- src/Simulator/Simulator.h | 2 +- src/World.h | 12 ++++++------ src/WorldStorage/FastNBT.h | 2 +- src/WorldStorage/WorldStorage.h | 4 ++-- 74 files changed, 110 insertions(+), 110 deletions(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index bf467ca01..cf8082503 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -28,7 +28,7 @@ endmacro() macro(set_flags) # Add coverage processing, if requested: if (NOT MSVC) - + if (CMAKE_BUILD_TYPE STREQUAL "COVERAGE") message("Including CodeCoverage") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/cmake-coverage/") @@ -85,7 +85,7 @@ macro(set_flags) # We use a signed char (fixes #640 on RasPi) add_flags_cxx("-fsigned-char") - + endif() @@ -202,7 +202,7 @@ macro(enable_profile) set(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugProfile;ReleaseProfile;Coverage" CACHE STRING "" FORCE) endif() endmacro() - + macro(set_exe_flags) # Remove disabling the maximum warning level: # clang does not like a command line that reads -Wall -Wextra -w -Wall -Wextra and does not output any warnings @@ -216,22 +216,22 @@ macro(set_exe_flags) string(REPLACE "-w" "" CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE}") string(REPLACE "-w" "" CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}") add_flags_cxx("-Wall -Wextra -Wno-unused-parameter -Wno-error=switch") - + # we support non-IEEE 754 fpus so can make no guarentees about error add_flags_cxx("-ffast-math") - + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # clang does not provide the __extern_always_inline macro and a part of libm depends on this when using fast-math add_flags_cxx("-D__extern_always_inline=inline") add_flags_cxx("-Werror -Weverything -Wno-c++98-compat-pedantic -Wno-string-conversion") - add_flags_cxx("-Wno-extra-semi -Wno-error=switch-enum -Wno-documentation") + add_flags_cxx("-Wno-error=switch-enum -Wno-documentation -Wno-exit-time-destructors") add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-padded") add_flags_cxx("-Wno-error=deprecated -Wno-error=weak-vtables -Wno-error=float-equal") add_flags_cxx("-Wno-error=missing-prototypes -Wno-error=non-virtual-dtor") add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow") add_flags_cxx("-Wno-error=exit-time-destructors -Wno-error=missing-variable-declarations") add_flags_cxx("-Wno-error=global-constructors -Wno-implicit-fallthrough") - add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum -Wno-exit-time-destructors") + add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum") endif() endif() diff --git a/src/Bindings/Plugin.h b/src/Bindings/Plugin.h index 3882b7474..39d53674b 100644 --- a/src/Bindings/Plugin.h +++ b/src/Bindings/Plugin.h @@ -115,10 +115,10 @@ public: virtual bool HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) = 0; /// All bound commands are to be removed, do any language-dependent cleanup here - virtual void ClearCommands(void) {} ; + virtual void ClearCommands(void) {} /// All bound console commands are to be removed, do any language-dependent cleanup here - virtual void ClearConsoleCommands(void) {} ; + virtual void ClearConsoleCommands(void) {} // tolua_begin const AString & GetName(void) const { return m_Name; } diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h index 24c25e729..5710f8543 100644 --- a/src/BlockEntities/BlockEntity.h +++ b/src/BlockEntities/BlockEntity.h @@ -38,9 +38,9 @@ protected: public: // tolua_end - virtual ~cBlockEntity() {}; // force a virtual destructor in all descendants + virtual ~cBlockEntity() {} // force a virtual destructor in all descendants - virtual void Destroy(void) {}; + virtual void Destroy(void) {} void SetWorld(cWorld * a_World) { diff --git a/src/BlockEntities/JukeboxEntity.h b/src/BlockEntities/JukeboxEntity.h index 8bb3009eb..d677d340f 100644 --- a/src/BlockEntities/JukeboxEntity.h +++ b/src/BlockEntities/JukeboxEntity.h @@ -58,7 +58,7 @@ public: static const char * GetClassStatic(void) { return "cJukeboxEntity"; } virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle &) override { }; + virtual void SendTo(cClientHandle &) override {} private: int m_Record; diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h index 07b8fd259..e8497da3e 100644 --- a/src/BlockEntities/NoteEntity.h +++ b/src/BlockEntities/NoteEntity.h @@ -52,7 +52,7 @@ public: // tolua_end virtual void UsedBy(cPlayer * a_Player) override; - virtual void SendTo(cClientHandle &) override { }; + virtual void SendTo(cClientHandle &) override {} static const char * GetClassStatic(void) { return "cNoteEntity"; } diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 01c64b457..94ab8d8c6 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -60,19 +60,19 @@ public: virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ); /// Called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position) - virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) {}; + virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) {} /// Notifies all neighbors of the given block about a change static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ); /// Called while the player diggs the block. - virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {}; + virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {} /// Called if the user right clicks the block and the block is useable - virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) {}; + virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) {} /** Called when a right click to this block is cancelled */ - virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) {}; + virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) {} /// Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta); diff --git a/src/Chunk.h b/src/Chunk.h index 5d50f9717..7eee3999c 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -380,9 +380,9 @@ public: cRedstoneSimulatorChunkData * GetRedstoneSimulatorData(void) { return &m_RedstoneSimulatorData; } cRedstoneSimulatorChunkData * GetRedstoneSimulatorQueuedData(void) { return &m_RedstoneSimulatorQueuedData; } cIncrementalRedstoneSimulator::PoweredBlocksList * GetRedstoneSimulatorPoweredBlocksList(void) { return &m_RedstoneSimulatorPoweredBlocksList; } - cIncrementalRedstoneSimulator::LinkedBlocksList * GetRedstoneSimulatorLinkedBlocksList(void) { return &m_RedstoneSimulatorLinkedBlocksList; }; - cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList * GetRedstoneSimulatorSimulatedPlayerToggleableList(void) { return &m_RedstoneSimulatorSimulatedPlayerToggleableList; }; - cIncrementalRedstoneSimulator::RepeatersDelayList * GetRedstoneSimulatorRepeatersDelayList(void) { return &m_RedstoneSimulatorRepeatersDelayList; }; + cIncrementalRedstoneSimulator::LinkedBlocksList * GetRedstoneSimulatorLinkedBlocksList(void) { return &m_RedstoneSimulatorLinkedBlocksList; } + cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList * GetRedstoneSimulatorSimulatedPlayerToggleableList(void) { return &m_RedstoneSimulatorSimulatedPlayerToggleableList; } + cIncrementalRedstoneSimulator::RepeatersDelayList * GetRedstoneSimulatorRepeatersDelayList(void) { return &m_RedstoneSimulatorRepeatersDelayList; } bool IsRedstoneDirty(void) const { return m_IsRedstoneDirty; } void SetIsRedstoneDirty(bool a_Flag) { m_IsRedstoneDirty = a_Flag; } diff --git a/src/ChunkDataCallback.h b/src/ChunkDataCallback.h index 53d44d038..804299816 100644 --- a/src/ChunkDataCallback.h +++ b/src/ChunkDataCallback.h @@ -29,25 +29,25 @@ public: (only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()). If false is returned, the chunk is skipped. */ - virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; }; + virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; } /// Called once to provide heightmap data - virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) {UNUSED(a_HeightMap); }; + virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) { UNUSED(a_HeightMap); } /// Called once to provide biome data - virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) {UNUSED(a_BiomeMap); }; + virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) { UNUSED(a_BiomeMap); } /// Called once to let know if the chunk lighting is valid. Return value is ignored - virtual void LightIsValid(bool a_IsLightValid) {UNUSED(a_IsLightValid); }; + virtual void LightIsValid(bool a_IsLightValid) { UNUSED(a_IsLightValid); } /// Called once to export block info - virtual void ChunkData(const cChunkData & a_Buffer) {UNUSED(a_Buffer); }; + virtual void ChunkData(const cChunkData & a_Buffer) { UNUSED(a_Buffer); } /// Called for each entity in the chunk - virtual void Entity(cEntity * a_Entity) {UNUSED(a_Entity); }; + virtual void Entity(cEntity * a_Entity) { UNUSED(a_Entity); } /// Called for each blockentity in the chunk - virtual void BlockEntity(cBlockEntity * a_Entity) {UNUSED(a_Entity); }; + virtual void BlockEntity(cBlockEntity * a_Entity) { UNUSED(a_Entity); } } ; diff --git a/src/CommandOutput.h b/src/CommandOutput.h index 5682b4fd8..daa9430c0 100644 --- a/src/CommandOutput.h +++ b/src/CommandOutput.h @@ -14,16 +14,16 @@ Descendants override that function to provide specific processing of the output. class cCommandOutputCallback { public: - virtual ~cCommandOutputCallback() {}; // Force a virtual destructor in subclasses + virtual ~cCommandOutputCallback() {} // Force a virtual destructor in subclasses - /// Syntax sugar function, calls Out() with Printf()-ed parameters; appends a "\n" + /// Syntax sugar function, calls Out() with Printf()-ed parameters; appends a newline" void Out(const char * a_Fmt, ...) FORMATSTRING(2, 3); /// Called when the command wants to output anything; may be called multiple times virtual void Out(const AString & a_Text) = 0; /// Called when the command processing has been finished - virtual void Finished(void) {}; + virtual void Finished(void) {} } ; diff --git a/src/Entities/ArrowEntity.h b/src/Entities/ArrowEntity.h index ad93dba6c..4bfcb1f6d 100644 --- a/src/Entities/ArrowEntity.h +++ b/src/Entities/ArrowEntity.h @@ -28,7 +28,7 @@ public: // tolua_end - CLASS_PROTODEF(cArrowEntity); + CLASS_PROTODEF(cArrowEntity) /// Creates a new arrow with psNoPickup state and default damage modifier coeff cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Entities/Boat.h b/src/Entities/Boat.h index 0fcfbd602..8de88d165 100644 --- a/src/Entities/Boat.h +++ b/src/Entities/Boat.h @@ -21,7 +21,7 @@ class cBoat : typedef cEntity super; public: - CLASS_PROTODEF(cBoat); + CLASS_PROTODEF(cBoat) // cEntity overrides: virtual void SpawnOn(cClientHandle & a_ClientHandle) override; diff --git a/src/Entities/EnderCrystal.h b/src/Entities/EnderCrystal.h index 30211de13..c98c3b681 100644 --- a/src/Entities/EnderCrystal.h +++ b/src/Entities/EnderCrystal.h @@ -15,7 +15,7 @@ class cEnderCrystal : typedef cEntity super; public: - CLASS_PROTODEF(cEnderCrystal); + CLASS_PROTODEF(cEnderCrystal) cEnderCrystal(double a_X, double a_Y, double a_Z); diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 83fe76e7e..efca60a6c 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -428,7 +428,7 @@ public: // tolua_end /// Called when the specified player right-clicks this entity - virtual void OnRightClicked(cPlayer &) {}; + virtual void OnRightClicked(cPlayer &) {} /// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy(). virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h index ebd611ff0..396a9bbe0 100644 --- a/src/Entities/EntityEffect.h +++ b/src/Entities/EntityEffect.h @@ -55,7 +55,7 @@ public: @param a_OtherEffect The other effect to copy */ cEntityEffect & operator=(cEntityEffect a_OtherEffect); - virtual ~cEntityEffect(void) {}; + virtual ~cEntityEffect(void) {} /** Creates a pointer to the proper entity effect from the effect type @warning This function creates raw pointers that must be manually managed. diff --git a/src/Entities/ExpBottleEntity.h b/src/Entities/ExpBottleEntity.h index e9536452c..d62a84469 100644 --- a/src/Entities/ExpBottleEntity.h +++ b/src/Entities/ExpBottleEntity.h @@ -21,7 +21,7 @@ public: // tolua_end - CLASS_PROTODEF(cExpBottleEntity); + CLASS_PROTODEF(cExpBottleEntity) cExpBottleEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Entities/ExpOrb.h b/src/Entities/ExpOrb.h index 2cd4ef31f..bdb9a5b19 100644 --- a/src/Entities/ExpOrb.h +++ b/src/Entities/ExpOrb.h @@ -16,7 +16,7 @@ class cExpOrb : public: // tolua_end - CLASS_PROTODEF(cExpOrb); + CLASS_PROTODEF(cExpOrb) cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward); cExpOrb(const Vector3d & a_Pos, int a_Reward); diff --git a/src/Entities/FallingBlock.h b/src/Entities/FallingBlock.h index 5ba9909bb..c20fe8eb9 100644 --- a/src/Entities/FallingBlock.h +++ b/src/Entities/FallingBlock.h @@ -20,7 +20,7 @@ class cFallingBlock : typedef cEntity super; public: - CLASS_PROTODEF(cFallingBlock); + CLASS_PROTODEF(cFallingBlock) /// Creates a new falling block. a_BlockPosition is expected in world coords cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); diff --git a/src/Entities/FireChargeEntity.h b/src/Entities/FireChargeEntity.h index 42ecc7d74..5df55bec4 100644 --- a/src/Entities/FireChargeEntity.h +++ b/src/Entities/FireChargeEntity.h @@ -21,7 +21,7 @@ public: // tolua_end - CLASS_PROTODEF(cFireChargeEntity); + CLASS_PROTODEF(cFireChargeEntity) cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Entities/FireworkEntity.h b/src/Entities/FireworkEntity.h index 7dbdc49e1..20f18b6dc 100644 --- a/src/Entities/FireworkEntity.h +++ b/src/Entities/FireworkEntity.h @@ -21,7 +21,7 @@ public: // tolua_end - CLASS_PROTODEF(cFireworkEntity); + CLASS_PROTODEF(cFireworkEntity) cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item); const cItem & GetItem(void) const { return m_FireworkItem; } diff --git a/src/Entities/Floater.h b/src/Entities/Floater.h index 5d2720b6a..96d77ac82 100644 --- a/src/Entities/Floater.h +++ b/src/Entities/Floater.h @@ -16,7 +16,7 @@ class cFloater : public: // tolua_end - CLASS_PROTODEF(cFloater); + CLASS_PROTODEF(cFloater) cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID, int a_CountDownTime); diff --git a/src/Entities/GhastFireballEntity.h b/src/Entities/GhastFireballEntity.h index fa59fa642..3ed72d9ef 100644 --- a/src/Entities/GhastFireballEntity.h +++ b/src/Entities/GhastFireballEntity.h @@ -21,7 +21,7 @@ public: // tolua_end - CLASS_PROTODEF(cGhastFireballEntity); + CLASS_PROTODEF(cGhastFireballEntity) cGhastFireballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Entities/HangingEntity.h b/src/Entities/HangingEntity.h index 6498e4b5b..3593f9ede 100644 --- a/src/Entities/HangingEntity.h +++ b/src/Entities/HangingEntity.h @@ -16,7 +16,7 @@ class cHangingEntity : public: - CLASS_PROTODEF(cHangingEntity); + CLASS_PROTODEF(cHangingEntity) cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z); @@ -38,7 +38,7 @@ public: private: virtual void SpawnOn(cClientHandle & a_ClientHandle) override; - virtual void Tick(float a_Dt, cChunk & a_Chunk) override {}; + virtual void Tick(float a_Dt, cChunk & a_Chunk) override {} eBlockFace m_BlockFace; diff --git a/src/Entities/ItemFrame.h b/src/Entities/ItemFrame.h index 9261e52cc..a63b78b70 100644 --- a/src/Entities/ItemFrame.h +++ b/src/Entities/ItemFrame.h @@ -16,7 +16,7 @@ class cItemFrame : public: - CLASS_PROTODEF(cItemFrame); + CLASS_PROTODEF(cItemFrame) cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z); @@ -24,7 +24,7 @@ public: const cItem & GetItem(void) { return m_Item; } // tolua_export /** Set the item in the frame */ - void SetItem(cItem & a_Item) { m_Item = a_Item; }; // tolua_export + void SetItem(cItem & a_Item) { m_Item = a_Item; } // tolua_export /** Returns the rotation from the item in the frame */ Byte GetRotation(void) const { return m_Rotation; } // tolua_export diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h index c585cfab0..410d3c77d 100644 --- a/src/Entities/Minecart.h +++ b/src/Entities/Minecart.h @@ -21,7 +21,7 @@ class cMinecart : typedef cEntity super; public: - CLASS_PROTODEF(cMinecart); + CLASS_PROTODEF(cMinecart) /** Minecart payload, values correspond to packet subtype */ enum ePayload @@ -89,7 +89,7 @@ class cRideableMinecart : typedef cMinecart super; public: - CLASS_PROTODEF(cRideableMinecart); + CLASS_PROTODEF(cRideableMinecart) cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height); @@ -113,7 +113,7 @@ class cMinecartWithChest : typedef cMinecart super; public: - CLASS_PROTODEF(cMinecartWithChest); + CLASS_PROTODEF(cMinecartWithChest) /// Number of item slots in the chest static const int NumSlots = 9 * 3; @@ -144,7 +144,7 @@ class cMinecartWithFurnace : typedef cMinecart super; public: - CLASS_PROTODEF(cMinecartWithFurnace); + CLASS_PROTODEF(cMinecartWithFurnace) cMinecartWithFurnace(double a_X, double a_Y, double a_Z); @@ -176,7 +176,7 @@ class cMinecartWithTNT : typedef cMinecart super; public: - CLASS_PROTODEF(cMinecartWithTNT); + CLASS_PROTODEF(cMinecartWithTNT) cMinecartWithTNT(double a_X, double a_Y, double a_Z); } ; @@ -191,7 +191,7 @@ class cMinecartWithHopper : typedef cMinecart super; public: - CLASS_PROTODEF(cMinecartWithHopper); + CLASS_PROTODEF(cMinecartWithHopper) cMinecartWithHopper(double a_X, double a_Y, double a_Z); } ; diff --git a/src/Entities/Painting.h b/src/Entities/Painting.h index ce7c6f3de..9877c95c5 100644 --- a/src/Entities/Painting.h +++ b/src/Entities/Painting.h @@ -15,7 +15,7 @@ class cPainting : typedef cEntity super; public: - CLASS_PROTODEF(cPainting); + CLASS_PROTODEF(cPainting) cPainting(const AString & a_Name, int a_Direction, double a_X, double a_Y, double a_Z); const AString & GetName(void) const { return m_Name; } // tolua_export diff --git a/src/Entities/Pawn.h b/src/Entities/Pawn.h index 63c7cfbb6..d50bcd8af 100644 --- a/src/Entities/Pawn.h +++ b/src/Entities/Pawn.h @@ -16,7 +16,7 @@ class cPawn : typedef cEntity super; public: - CLASS_PROTODEF(cPawn); + CLASS_PROTODEF(cPawn) cPawn(eEntityType a_EntityType, double a_Width, double a_Height); diff --git a/src/Entities/Pickup.h b/src/Entities/Pickup.h index d7c5d2b26..4d5250819 100644 --- a/src/Entities/Pickup.h +++ b/src/Entities/Pickup.h @@ -23,7 +23,7 @@ class cPickup : public: // tolua_end - CLASS_PROTODEF(cPickup); + CLASS_PROTODEF(cPickup) cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f); diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 26db2050b..488884602 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -48,7 +48,7 @@ public: virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); }; + virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); } /** Returns the curently equipped weapon; empty item if none */ virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); } diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index e6b05714e..0ebc32f36 100644 --- a/src/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h @@ -41,7 +41,7 @@ public: // tolua_end - CLASS_PROTODEF(cProjectileEntity); + CLASS_PROTODEF(cProjectileEntity) cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height); cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height); diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index 290dd81d4..dd14ea82f 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -23,7 +23,7 @@ public: // tolua_end - CLASS_PROTODEF(cSplashPotionEntity); + CLASS_PROTODEF(cSplashPotionEntity) cSplashPotionEntity( cEntity * a_Creator, diff --git a/src/Entities/TNTEntity.h b/src/Entities/TNTEntity.h index df61b14f5..48503cf76 100644 --- a/src/Entities/TNTEntity.h +++ b/src/Entities/TNTEntity.h @@ -14,7 +14,7 @@ class cTNTEntity : public: // tolua_end - CLASS_PROTODEF(cTNTEntity); + CLASS_PROTODEF(cTNTEntity) cTNTEntity(double a_X, double a_Y, double a_Z, int a_FuseTicks = 80); cTNTEntity(const Vector3d & a_Pos, int a_FuseTicks = 80); diff --git a/src/Entities/ThrownEggEntity.h b/src/Entities/ThrownEggEntity.h index f93731256..a0b7d5340 100644 --- a/src/Entities/ThrownEggEntity.h +++ b/src/Entities/ThrownEggEntity.h @@ -21,7 +21,7 @@ public: // tolua_end - CLASS_PROTODEF(cThrownEggEntity); + CLASS_PROTODEF(cThrownEggEntity) cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Entities/ThrownEnderPearlEntity.h b/src/Entities/ThrownEnderPearlEntity.h index 549d8a3eb..436450013 100644 --- a/src/Entities/ThrownEnderPearlEntity.h +++ b/src/Entities/ThrownEnderPearlEntity.h @@ -21,7 +21,7 @@ public: // tolua_end - CLASS_PROTODEF(cThrownEnderPearlEntity); + CLASS_PROTODEF(cThrownEnderPearlEntity) cThrownEnderPearlEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Entities/ThrownSnowballEntity.h b/src/Entities/ThrownSnowballEntity.h index 6f3efdd7e..8d195ced1 100644 --- a/src/Entities/ThrownSnowballEntity.h +++ b/src/Entities/ThrownSnowballEntity.h @@ -21,7 +21,7 @@ public: // tolua_end - CLASS_PROTODEF(cThrownSnowballEntity); + CLASS_PROTODEF(cThrownSnowballEntity) cThrownSnowballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Entities/WitherSkullEntity.h b/src/Entities/WitherSkullEntity.h index ebc1550e3..c59acd807 100644 --- a/src/Entities/WitherSkullEntity.h +++ b/src/Entities/WitherSkullEntity.h @@ -22,7 +22,7 @@ public: // tolua_end - CLASS_PROTODEF(cWitherSkullEntity); + CLASS_PROTODEF(cWitherSkullEntity) cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed); diff --git a/src/Generating/ChunkGenerator.h b/src/Generating/ChunkGenerator.h index 9b2d9eb3c..88d71f3f9 100644 --- a/src/Generating/ChunkGenerator.h +++ b/src/Generating/ChunkGenerator.h @@ -44,7 +44,7 @@ public: { public: cGenerator(cChunkGenerator & a_ChunkGenerator); - virtual ~cGenerator() {} ; // Force a virtual destructor + virtual ~cGenerator() {} // Force a virtual destructor /// Called to initialize the generator on server startup. virtual void Initialize(cIniFile & a_IniFile); diff --git a/src/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h index dab942136..e402c8ad6 100644 --- a/src/HTTPServer/HTTPMessage.h +++ b/src/HTTPServer/HTTPMessage.h @@ -33,7 +33,7 @@ public: cHTTPMessage(eKind a_Kind); // Force a virtual destructor in all descendants - virtual ~cHTTPMessage() {}; + virtual ~cHTTPMessage() {} /** Adds a header into the internal map of headers. Recognizes special headers: Content-Type and Content-Length */ void AddHeader(const AString & a_Key, const AString & a_Value); diff --git a/src/Mobs/Bat.h b/src/Mobs/Bat.h index e878d0ee8..6b06aeb4f 100644 --- a/src/Mobs/Bat.h +++ b/src/Mobs/Bat.h @@ -15,7 +15,7 @@ class cBat : public: cBat(void); - CLASS_PROTODEF(cBat); + CLASS_PROTODEF(cBat) bool IsHanging(void) const {return false; } } ; diff --git a/src/Mobs/Blaze.h b/src/Mobs/Blaze.h index 5970451c7..f283b1070 100644 --- a/src/Mobs/Blaze.h +++ b/src/Mobs/Blaze.h @@ -15,7 +15,7 @@ class cBlaze : public: cBlaze(void); - CLASS_PROTODEF(cBlaze); + CLASS_PROTODEF(cBlaze) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void Attack(float a_Dt) override; diff --git a/src/Mobs/CaveSpider.h b/src/Mobs/CaveSpider.h index 3f8b2cece..f9ed10e1b 100644 --- a/src/Mobs/CaveSpider.h +++ b/src/Mobs/CaveSpider.h @@ -14,7 +14,7 @@ class cCaveSpider : public: cCaveSpider(void); - CLASS_PROTODEF(cCaveSpider); + CLASS_PROTODEF(cCaveSpider) virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void Attack(float a_Dt) override; diff --git a/src/Mobs/Chicken.h b/src/Mobs/Chicken.h index a4c1d6b9e..b1a50b61c 100644 --- a/src/Mobs/Chicken.h +++ b/src/Mobs/Chicken.h @@ -14,7 +14,7 @@ class cChicken : public: cChicken(void); - CLASS_PROTODEF(cChicken); + CLASS_PROTODEF(cChicken) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override; diff --git a/src/Mobs/Cow.h b/src/Mobs/Cow.h index 973171ab5..8814b7e09 100644 --- a/src/Mobs/Cow.h +++ b/src/Mobs/Cow.h @@ -15,7 +15,7 @@ class cCow : public: cCow(); - CLASS_PROTODEF(cCow); + CLASS_PROTODEF(cCow) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void OnRightClicked(cPlayer & a_Player) override; diff --git a/src/Mobs/Creeper.h b/src/Mobs/Creeper.h index fc7db6716..747daca09 100644 --- a/src/Mobs/Creeper.h +++ b/src/Mobs/Creeper.h @@ -15,7 +15,7 @@ class cCreeper : public: cCreeper(void); - CLASS_PROTODEF(cCreeper); + CLASS_PROTODEF(cCreeper) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; diff --git a/src/Mobs/EnderDragon.h b/src/Mobs/EnderDragon.h index 77177edfe..1d4cd657c 100644 --- a/src/Mobs/EnderDragon.h +++ b/src/Mobs/EnderDragon.h @@ -15,7 +15,7 @@ class cEnderDragon : public: cEnderDragon(void); - CLASS_PROTODEF(cEnderDragon); + CLASS_PROTODEF(cEnderDragon) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; } ; diff --git a/src/Mobs/Enderman.h b/src/Mobs/Enderman.h index 32e40e70b..aa2eff682 100644 --- a/src/Mobs/Enderman.h +++ b/src/Mobs/Enderman.h @@ -15,7 +15,7 @@ class cEnderman : public: cEnderman(void); - CLASS_PROTODEF(cEnderman); + CLASS_PROTODEF(cEnderman) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; diff --git a/src/Mobs/Ghast.h b/src/Mobs/Ghast.h index 43e8bedb6..1d4e6b94a 100644 --- a/src/Mobs/Ghast.h +++ b/src/Mobs/Ghast.h @@ -15,7 +15,7 @@ class cGhast : public: cGhast(void); - CLASS_PROTODEF(cGhast); + CLASS_PROTODEF(cGhast) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void Attack(float a_Dt) override; diff --git a/src/Mobs/Giant.h b/src/Mobs/Giant.h index 356dd4352..7c04c9b4f 100644 --- a/src/Mobs/Giant.h +++ b/src/Mobs/Giant.h @@ -15,7 +15,7 @@ class cGiant : public: cGiant(void); - CLASS_PROTODEF(cGiant); + CLASS_PROTODEF(cGiant) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; } ; diff --git a/src/Mobs/Horse.h b/src/Mobs/Horse.h index be0c23f9b..47189b3b0 100644 --- a/src/Mobs/Horse.h +++ b/src/Mobs/Horse.h @@ -15,7 +15,7 @@ class cHorse : public: cHorse(int Type, int Color, int Style, int TameTimes); - CLASS_PROTODEF(cHorse); + CLASS_PROTODEF(cHorse) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override; diff --git a/src/Mobs/IronGolem.h b/src/Mobs/IronGolem.h index 30f9bedff..c5341ed76 100644 --- a/src/Mobs/IronGolem.h +++ b/src/Mobs/IronGolem.h @@ -15,7 +15,7 @@ class cIronGolem : public: cIronGolem(void); - CLASS_PROTODEF(cIronGolem); + CLASS_PROTODEF(cIronGolem) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h index 43065cae5..bfe63fa2e 100644 --- a/src/Mobs/MagmaCube.h +++ b/src/Mobs/MagmaCube.h @@ -15,7 +15,7 @@ public: /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest cMagmaCube(int a_Size); - CLASS_PROTODEF(cMagmaCube); + CLASS_PROTODEF(cMagmaCube) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; int GetSize(void) const { return m_Size; } diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index ffd078505..cdbd26c09 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -82,7 +82,7 @@ public: */ cMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height); - CLASS_PROTODEF(cMonster); + CLASS_PROTODEF(cMonster) virtual void SpawnOn(cClientHandle & a_ClientHandle) override; diff --git a/src/Mobs/Mooshroom.h b/src/Mobs/Mooshroom.h index 16f6c8248..fb002c2bf 100644 --- a/src/Mobs/Mooshroom.h +++ b/src/Mobs/Mooshroom.h @@ -15,7 +15,7 @@ class cMooshroom : public: cMooshroom(void); - CLASS_PROTODEF(cMooshroom); + CLASS_PROTODEF(cMooshroom) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void OnRightClicked(cPlayer & a_Player) override; diff --git a/src/Mobs/Ocelot.h b/src/Mobs/Ocelot.h index adb7a1f75..f2727d354 100644 --- a/src/Mobs/Ocelot.h +++ b/src/Mobs/Ocelot.h @@ -18,7 +18,7 @@ public: { } - CLASS_PROTODEF(cOcelot); + CLASS_PROTODEF(cOcelot) } ; diff --git a/src/Mobs/Pig.h b/src/Mobs/Pig.h index 313af2f44..534a0ca6f 100644 --- a/src/Mobs/Pig.h +++ b/src/Mobs/Pig.h @@ -15,7 +15,7 @@ class cPig : public: cPig(void); - CLASS_PROTODEF(cPig); + CLASS_PROTODEF(cPig) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void OnRightClicked(cPlayer & a_Player) override; diff --git a/src/Mobs/Sheep.h b/src/Mobs/Sheep.h index 5ffd3e4fe..28e1c7254 100644 --- a/src/Mobs/Sheep.h +++ b/src/Mobs/Sheep.h @@ -20,7 +20,7 @@ public: with the GenerateNaturalRandomColor() function. */ cSheep(int a_Color = -1); - CLASS_PROTODEF(cSheep); + CLASS_PROTODEF(cSheep) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void OnRightClicked(cPlayer & a_Player) override; diff --git a/src/Mobs/Silverfish.h b/src/Mobs/Silverfish.h index a6e11c49d..2df333dbc 100644 --- a/src/Mobs/Silverfish.h +++ b/src/Mobs/Silverfish.h @@ -18,7 +18,7 @@ public: { } - CLASS_PROTODEF(cSilverfish); + CLASS_PROTODEF(cSilverfish) } ; diff --git a/src/Mobs/Skeleton.h b/src/Mobs/Skeleton.h index 9a121ef48..577588b32 100644 --- a/src/Mobs/Skeleton.h +++ b/src/Mobs/Skeleton.h @@ -15,7 +15,7 @@ class cSkeleton : public: cSkeleton(bool IsWither); - CLASS_PROTODEF(cSkeleton); + CLASS_PROTODEF(cSkeleton) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void MoveToPosition(const Vector3d & a_Position) override; @@ -24,7 +24,7 @@ public: virtual bool IsUndead(void) override { return true; } - bool IsWither(void) const { return m_bIsWither; }; + bool IsWither(void) const { return m_bIsWither; } private: diff --git a/src/Mobs/Slime.h b/src/Mobs/Slime.h index 15ae113dc..f0b800f94 100644 --- a/src/Mobs/Slime.h +++ b/src/Mobs/Slime.h @@ -16,7 +16,7 @@ public: /** Creates a slime of the specified size; size can be 1, 2 or 4, with 1 is the smallest and 4 is the tallest. */ cSlime(int a_Size); - CLASS_PROTODEF(cSlime); + CLASS_PROTODEF(cSlime) // cAggressiveMonster overrides: virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; diff --git a/src/Mobs/SnowGolem.h b/src/Mobs/SnowGolem.h index ff5e90da8..aba89e52d 100644 --- a/src/Mobs/SnowGolem.h +++ b/src/Mobs/SnowGolem.h @@ -15,7 +15,7 @@ class cSnowGolem : public: cSnowGolem(void); - CLASS_PROTODEF(cSnowGolem); + CLASS_PROTODEF(cSnowGolem) virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; diff --git a/src/Mobs/Spider.h b/src/Mobs/Spider.h index 51e65d028..813d2e266 100644 --- a/src/Mobs/Spider.h +++ b/src/Mobs/Spider.h @@ -15,7 +15,7 @@ class cSpider : public: cSpider(void); - CLASS_PROTODEF(cSpider); + CLASS_PROTODEF(cSpider) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; } ; diff --git a/src/Mobs/Squid.h b/src/Mobs/Squid.h index a9dba8b70..b57340427 100644 --- a/src/Mobs/Squid.h +++ b/src/Mobs/Squid.h @@ -17,7 +17,7 @@ public: virtual void Tick(float a_Dt, cChunk & a_Chunk) override; - CLASS_PROTODEF(cSquid); + CLASS_PROTODEF(cSquid) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; diff --git a/src/Mobs/Villager.h b/src/Mobs/Villager.h index 068dfd835..aa81f0790 100644 --- a/src/Mobs/Villager.h +++ b/src/Mobs/Villager.h @@ -27,7 +27,7 @@ public: cVillager(eVillagerType VillagerType); - CLASS_PROTODEF(cVillager); + CLASS_PROTODEF(cVillager) // cEntity overrides virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; diff --git a/src/Mobs/Witch.h b/src/Mobs/Witch.h index 51c63322a..bd059f61d 100644 --- a/src/Mobs/Witch.h +++ b/src/Mobs/Witch.h @@ -16,7 +16,7 @@ class cWitch : public: cWitch(); - CLASS_PROTODEF(cWitch); + CLASS_PROTODEF(cWitch) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; diff --git a/src/Mobs/Wither.h b/src/Mobs/Wither.h index cc8d1459b..2403823ed 100644 --- a/src/Mobs/Wither.h +++ b/src/Mobs/Wither.h @@ -15,7 +15,7 @@ class cWither : public: cWither(void); - CLASS_PROTODEF(cWither); + CLASS_PROTODEF(cWither) unsigned int GetWitherInvulnerableTicks(void) const { return m_WitherInvulnerableTicks; } diff --git a/src/Mobs/Wolf.h b/src/Mobs/Wolf.h index fb8a7c995..2e83db701 100644 --- a/src/Mobs/Wolf.h +++ b/src/Mobs/Wolf.h @@ -16,7 +16,7 @@ class cWolf : public: cWolf(void); - CLASS_PROTODEF(cWolf); + CLASS_PROTODEF(cWolf) virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; virtual void OnRightClicked(cPlayer & a_Player) override; diff --git a/src/Mobs/Zombie.h b/src/Mobs/Zombie.h index 082573d8b..118b6e6e7 100644 --- a/src/Mobs/Zombie.h +++ b/src/Mobs/Zombie.h @@ -14,7 +14,7 @@ class cZombie : public: cZombie(bool a_IsVillagerZombie); - CLASS_PROTODEF(cZombie); + CLASS_PROTODEF(cZombie) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void MoveToPosition(const Vector3d & a_Position) override; diff --git a/src/Mobs/ZombiePigman.h b/src/Mobs/ZombiePigman.h index a4bad7efb..bae0115eb 100644 --- a/src/Mobs/ZombiePigman.h +++ b/src/Mobs/ZombiePigman.h @@ -14,7 +14,7 @@ class cZombiePigman : public: cZombiePigman(void); - CLASS_PROTODEF(cZombiePigman); + CLASS_PROTODEF(cZombiePigman) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void KilledBy(TakeDamageInfo & a_TDI) override; diff --git a/src/OSSupport/Queue.h b/src/OSSupport/Queue.h index 269f9db41..bf4d7f004 100644 --- a/src/OSSupport/Queue.h +++ b/src/OSSupport/Queue.h @@ -26,14 +26,14 @@ struct cQueueFuncs public: /// Called when an Item is deleted from the queue without being returned - static void Delete(T) {}; + static void Delete(T) {} /// Called when an Item is inserted with EnqueueItemIfNotPresent and there is another equal value already inserted static void Combine(T & a_existing, const T & a_new) { UNUSED(a_existing); UNUSED(a_new); - }; + } }; diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h index c5ba7a679..166e9ab1b 100644 --- a/src/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h @@ -138,7 +138,7 @@ protected: virtual void SendData(const char * a_Data, size_t a_Size) = 0; /// Called after writing each packet, enables descendants to flush their buffers - virtual void Flush(void) {}; + virtual void Flush(void) {} // Helpers for writing partial packet data, write using SendData() void WriteByte(Byte a_Value) diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h index d7ebf535b..bf08b6c50 100644 --- a/src/Protocol/Protocol125.h +++ b/src/Protocol/Protocol125.h @@ -90,7 +90,7 @@ public: virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override; virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; - virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override {}; + virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override {} virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override; virtual void SendWeather (eWeather a_Weather) override; diff --git a/src/Simulator/Simulator.h b/src/Simulator/Simulator.h index 171eba91c..4d9a18867 100644 --- a/src/Simulator/Simulator.h +++ b/src/Simulator/Simulator.h @@ -32,7 +32,7 @@ public: UNUSED(a_ChunkX); UNUSED(a_ChunkZ); UNUSED(a_Chunk); - }; + } /// Called when a block changes virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk); diff --git a/src/World.h b/src/World.h index 6613b495a..9658178ae 100644 --- a/src/World.h +++ b/src/World.h @@ -96,7 +96,7 @@ public: class cTask { public: - virtual ~cTask(){}; + virtual ~cTask() {} virtual void Run(cWorld & a_World) = 0; } ; @@ -645,7 +645,7 @@ public: void GetChunkStats(int & a_NumValid, int & a_NumDirty, int & a_NumInLightingQueue); // Various queues length queries (cannot be const, they lock their CS): - inline int GetGeneratorQueueLength (void) { return m_Generator.GetQueueLength(); } // tolua_export + inline int GetGeneratorQueueLength (void) { return m_Generator.GetQueueLength(); } // tolua_export inline size_t GetLightingQueueLength (void) { return m_Lighting.GetQueueLength(); } // tolua_export inline size_t GetStorageLoadQueueLength(void) { return m_Storage.GetLoadQueueLength(); } // tolua_export inline size_t GetStorageSaveQueueLength(void) { return m_Storage.GetSaveQueueLength(); } // tolua_export @@ -677,13 +677,13 @@ public: void CastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ); /** Sets the specified weather; resets weather interval; asks and notifies plugins of the change */ - void SetWeather (eWeather a_NewWeather); + void SetWeather(eWeather a_NewWeather); /** Forces a weather change in the next game tick */ - void ChangeWeather (void); + void ChangeWeather(void); /** Returns the current weather. Instead of comparing values directly to the weather constants, use IsWeatherXXX() functions, if possible */ - eWeather GetWeather (void) const { return m_Weather; }; + eWeather GetWeather(void) const { return m_Weather; } /** Returns true if the current weather is sun */ bool IsWeatherSunny(void) const { return (m_Weather == wSunny); } @@ -698,7 +698,7 @@ public: bool IsWeatherRain(void) const { return (m_Weather == wRain); } /** Returns true if it is raining at the specified location. This takes into account biomes. */ - bool IsWeatherRainAt (int a_BlockX, int a_BlockZ) + bool IsWeatherRainAt(int a_BlockX, int a_BlockZ) { return (IsWeatherRain() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ))); } diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index 7aa83fc24..4ef72e379 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -160,7 +160,7 @@ public: /** Returns the direct child tag of the specified name, or -1 if no such tag. */ int FindChildByName(int a_Tag, const char * a_Name, size_t a_NameLength = 0) const; - /** Returns the child tag of the specified path (Name1\Name2\Name3...), or -1 if no such tag. */ + /** Returns the child tag of the specified path (Name1/Name2/Name3...), or -1 if no such tag. */ int FindTagByPath(int a_Tag, const AString & a_Path) const; eTagType GetType(int a_Tag) const { return m_Tags[(size_t)a_Tag].m_Type; } diff --git a/src/WorldStorage/WorldStorage.h b/src/WorldStorage/WorldStorage.h index 2d5d9c830..978a5b5d1 100644 --- a/src/WorldStorage/WorldStorage.h +++ b/src/WorldStorage/WorldStorage.h @@ -103,11 +103,11 @@ protected: struct FuncTable { - static void Delete(sChunkLoad) {}; + static void Delete(sChunkLoad) {} static void Combine(sChunkLoad & a_orig, const sChunkLoad a_new) { a_orig.m_Generate |= a_new.m_Generate; - }; + } }; typedef cQueue sChunkLoadQueue; -- cgit v1.2.3 From 431d898a813ce65eeb1d0dfca449d310b2b2811b Mon Sep 17 00:00:00 2001 From: archshift Date: Thu, 24 Jul 2014 11:19:49 -0700 Subject: Made redundant semi not an error, fixed one more. --- SetFlags.cmake | 2 +- Tools/MCADefrag/Globals.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index cf8082503..abd7bae2b 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -231,7 +231,7 @@ macro(set_exe_flags) add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow") add_flags_cxx("-Wno-error=exit-time-destructors -Wno-error=missing-variable-declarations") add_flags_cxx("-Wno-error=global-constructors -Wno-implicit-fallthrough") - add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum") + add_flags_cxx("-Wno-error=extra-semi -Wno-weak-vtables -Wno-switch-enum") endif() endif() diff --git a/Tools/MCADefrag/Globals.h b/Tools/MCADefrag/Globals.h index 6593187e6..288069599 100644 --- a/Tools/MCADefrag/Globals.h +++ b/Tools/MCADefrag/Globals.h @@ -240,7 +240,7 @@ template class cItemCallback public: /// Called for each item in the internal list; return true to stop the loop, or false to continue enumerating virtual bool Item(Type * a_Type) = 0; - virtual ~cItemCallback() {}; + virtual ~cItemCallback() {} } ; -- cgit v1.2.3 From 3a6002de5b13c1cd56d904892e5af6123978225d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 24 Jul 2014 21:38:25 +0100 Subject: Fixed block drops * Fixes #1242 (the issue addressed within) --- src/Blocks/BlockBigFlower.h | 6 +++--- src/Blocks/BlockHandler.cpp | 19 ++++++++++-------- src/Blocks/BlockHandler.h | 3 ++- src/Items/ItemHandler.cpp | 47 +++++++++++++++++++++++++++++++++++++++++---- src/Items/ItemSword.h | 1 - 5 files changed, 59 insertions(+), 17 deletions(-) diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index bc7098aa0..0b6ac9d8a 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -19,16 +19,16 @@ public: } - virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_DropVerbatim) override + virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop, bool a_DropVerbatim) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); if (Meta & 0x8) { - super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ, a_DropVerbatim); + super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ, a_CanDrop, a_DropVerbatim); } else { - super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_DropVerbatim); + super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_CanDrop, a_DropVerbatim); } } diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 3e16f970a..ddb0186c9 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -418,19 +418,22 @@ void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) -void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_DropVerbatim) +void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop, bool a_DropVerbatim) { cItems Pickups; NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - if (!a_DropVerbatim) + if (a_CanDrop) { - ConvertToPickups(Pickups, Meta); - } - else - { - // TODO: Add a proper overridable function for this - Pickups.Add(m_BlockType, 1, Meta); + if (!a_DropVerbatim) + { + ConvertToPickups(Pickups, Meta); + } + else + { + // TODO: Add a proper overridable function for this + Pickups.Add(m_BlockType, 1, Meta); + } } // Allow plugins to modify the pickups: diff --git a/src/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 01c64b457..a5d15d930 100644 --- a/src/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h @@ -79,9 +79,10 @@ public: /** Handles the dropping, but not destruction, of a block based on what ConvertTo(Verbatim)Pickups() returns, including the spawning of pickups and alertion of plugins @param a_Digger The entity causing the drop; it may be NULL + @param a_CanDrop Informs the handler whether the block should be dropped at all. One example when this is false is when stone is destroyed by hand @param a_DropVerbatim Calls ConvertToVerbatimPickups() instead of its counterpart, meaning the block itself is dropped by default (due to a speical tool or enchantment) */ - virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_DropVerbatim = false); + virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop = true, bool a_DropVerbatim = false); /// Returns step sound name of block virtual const char * GetStepSound(void); diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 1671a8145..23dbb4348 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -330,7 +330,7 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const { cChunkInterface ChunkInterface(a_World->GetChunkMap()); cBlockInServerPluginInterface PluginInterface(*a_World); - Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block)); + Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block), a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0); } a_Player->UseEquippedItem(); @@ -511,9 +511,48 @@ bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType) bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType) { - UNUSED(a_BlockType); - - return false; + switch (a_BlockType) + { + case E_BLOCK_ANVIL: + case E_BLOCK_ENCHANTMENT_TABLE: + case E_BLOCK_FURNACE: + case E_BLOCK_LIT_FURNACE: + case E_BLOCK_COAL_ORE: + case E_BLOCK_STONE: + case E_BLOCK_COBBLESTONE: + case E_BLOCK_END_STONE: + case E_BLOCK_MOSSY_COBBLESTONE: + case E_BLOCK_SANDSTONE_STAIRS: + case E_BLOCK_SANDSTONE: + case E_BLOCK_STONE_BRICKS: + case E_BLOCK_NETHER_BRICK: + case E_BLOCK_NETHERRACK: + case E_BLOCK_STONE_SLAB: + case E_BLOCK_DOUBLE_STONE_SLAB: + case E_BLOCK_STONE_PRESSURE_PLATE: + case E_BLOCK_BRICK: + case E_BLOCK_COBBLESTONE_STAIRS: + case E_BLOCK_COBBLESTONE_WALL: + case E_BLOCK_STONE_BRICK_STAIRS: + case E_BLOCK_NETHER_BRICK_STAIRS: + case E_BLOCK_CAULDRON: + case E_BLOCK_OBSIDIAN: + case E_BLOCK_DIAMOND_BLOCK: + case E_BLOCK_DIAMOND_ORE: + case E_BLOCK_GOLD_BLOCK: + case E_BLOCK_GOLD_ORE: + case E_BLOCK_REDSTONE_ORE: + case E_BLOCK_REDSTONE_ORE_GLOWING: + case E_BLOCK_EMERALD_ORE: + case E_BLOCK_IRON_BLOCK: + case E_BLOCK_IRON_ORE: + case E_BLOCK_LAPIS_ORE: + case E_BLOCK_LAPIS_BLOCK: + { + return false; + } + default: return true; + } } diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 44feb2d83..368b8724e 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -16,7 +16,6 @@ public: cItemSwordHandler(int a_ItemType) : cItemHandler(a_ItemType) { - } virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override -- cgit v1.2.3 From 0f298c8b84756cf5bc055ff82d43ffa9ea8d577b Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 25 Jul 2014 14:23:36 +0200 Subject: Speed up the NetherClumpFoliage finisher. Using IntNoiseXX instead of CubicNoiseXX. --- src/Generating/FinishGen.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index c67cc574e..b2585bfee 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -48,8 +48,8 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc) double ChunkX = a_ChunkDesc.GetChunkX() + 0.1; // We can't devide through 0 so lets add 0.1 to all the chunk coordinates. double ChunkZ = a_ChunkDesc.GetChunkZ() + 0.1; - NOISE_DATATYPE Val1 = m_Noise.CubicNoise2D((float) (ChunkX * ChunkZ * 0.01f), (float) (ChunkZ / ChunkX * 0.01f)); - NOISE_DATATYPE Val2 = m_Noise.CubicNoise2D((float) (ChunkX / ChunkZ / 0.01f), (float) (ChunkZ * ChunkX / 0.01f)); + NOISE_DATATYPE Val1 = m_Noise.IntNoise2D((int) (ChunkX * ChunkZ * 0.01f), (int) (ChunkZ / ChunkX * 0.01f)); + NOISE_DATATYPE Val2 = m_Noise.IntNoise2D((int) (ChunkX / ChunkZ / 0.01f), (int) (ChunkZ * ChunkX / 0.01f)); if (Val1 < 0) { @@ -88,12 +88,14 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc) { continue; } + if (!cBlockInfo::IsSolid(a_ChunkDesc.GetBlockType(PosX, y - 1, PosZ))) // Only place on solid blocks { continue; } - NOISE_DATATYPE BlockType = m_Noise.CubicNoise1D((float) (ChunkX * ChunkZ) / (y * 0.1f)); + // Choose what block to use. + NOISE_DATATYPE BlockType = m_Noise.IntNoise3D((int) ChunkX, y, (int) ChunkZ); if (BlockType < -0.7) { TryPlaceClump(a_ChunkDesc, PosX, y, PosZ, E_BLOCK_BROWN_MUSHROOM); @@ -119,10 +121,10 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a for (int x = a_RelX - 4; x < a_RelX + 4; x++) { - float xx = (float) a_ChunkDesc.GetChunkX() * cChunkDef::Width + x; + int xx = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x; for (int z = a_RelZ - 4; z < a_RelZ + 4; z++) { - float zz = (float) a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z; + int zz = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z; for (int y = a_RelY - 2; y < a_RelY + 2; y++) { if ((y < 1) || (y > cChunkDef::Height)) @@ -149,9 +151,8 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a } } - - NOISE_DATATYPE Val = m_Noise.CubicNoise2D(xx, zz); - if (Val < -0.70) + NOISE_DATATYPE Val = m_Noise.IntNoise2D(xx, zz); + if (Val < -0.5) { a_ChunkDesc.SetBlockType(x, y, z, a_Block); } -- cgit v1.2.3 From a39e19e94a1086cc2c5974cecc5d383cd26b3d12 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Fri, 25 Jul 2014 21:01:40 +0200 Subject: Tweaks to NetherClumpFoliage Simplefied the way NetherClupFoliage creates the X and Z coordinate. --- src/Generating/FinishGen.cpp | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index b2585bfee..4c40270e8 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -45,42 +45,14 @@ static inline bool IsWater(BLOCKTYPE a_BlockType) void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc) { - double ChunkX = a_ChunkDesc.GetChunkX() + 0.1; // We can't devide through 0 so lets add 0.1 to all the chunk coordinates. - double ChunkZ = a_ChunkDesc.GetChunkZ() + 0.1; - - NOISE_DATATYPE Val1 = m_Noise.IntNoise2D((int) (ChunkX * ChunkZ * 0.01f), (int) (ChunkZ / ChunkX * 0.01f)); - NOISE_DATATYPE Val2 = m_Noise.IntNoise2D((int) (ChunkX / ChunkZ / 0.01f), (int) (ChunkZ * ChunkX / 0.01f)); + int ChunkX = a_ChunkDesc.GetChunkX(); + int ChunkZ = a_ChunkDesc.GetChunkZ(); - if (Val1 < 0) - { - Val1 = -Val1; - } - - if (Val2 < 0) - { - Val2 = -Val2; - } + int Val1 = m_Noise.IntNoise2DInt(ChunkX ^ ChunkZ, ChunkZ + ChunkX); + int Val2 = m_Noise.IntNoise2DInt(ChunkZ ^ ChunkX, ChunkZ - ChunkX); - int PosX, PosZ; - // Calculate PosX - if (Val1 <= 1) - { - PosX = (int) floor(Val1 * 16); - } - else - { - PosX = (int) floor(16 / Val1); - } - - // Calculate PosZ - if (Val2 <= 1) - { - PosZ = (int) floor(Val2 * 16); - } - else - { - PosZ = (int) floor(16 / Val2); - } + int PosX = Val1 % 16; + int PosZ = Val2 % 16; for (int y = 1; y < cChunkDef::Height; y++) { -- cgit v1.2.3 From 443112d70e2483bb25594a83ded87d45aff880f6 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 26 Jul 2014 03:34:23 -0700 Subject: Removed the new old-style-cast warning from error treatment This is a new warning included in clang that ships with OS X 10.10 Yosemite. --- SetFlags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SetFlags.cmake b/SetFlags.cmake index abd7bae2b..a5a61eaa4 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -228,7 +228,7 @@ macro(set_exe_flags) add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-padded") add_flags_cxx("-Wno-error=deprecated -Wno-error=weak-vtables -Wno-error=float-equal") add_flags_cxx("-Wno-error=missing-prototypes -Wno-error=non-virtual-dtor") - add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow") + add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow -Wno-error=old-style-cast") add_flags_cxx("-Wno-error=exit-time-destructors -Wno-error=missing-variable-declarations") add_flags_cxx("-Wno-error=global-constructors -Wno-implicit-fallthrough") add_flags_cxx("-Wno-error=extra-semi -Wno-weak-vtables -Wno-switch-enum") -- cgit v1.2.3 From 1595ef73dcd6f6a525744185bd24343c3f8050c8 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 26 Jul 2014 03:42:42 -0700 Subject: Endianness.h: undefined ntohll before redefining --- src/Endianness.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Endianness.h b/src/Endianness.h index 5997086e0..9aeb44986 100644 --- a/src/Endianness.h +++ b/src/Endianness.h @@ -1,6 +1,7 @@ #pragma once +#undef ntohll #define ntohll(x) ((((UInt64)ntohl((u_long)x)) << 32) + ntohl(x >> 32)) -- cgit v1.2.3 From 0298d34406b1582e882795bf4d9d3fea18fd0135 Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 20 Jul 2014 02:56:59 -0700 Subject: Moved potion static functions to EntityEffect to create splash potions through world --- src/Entities/EntityEffect.cpp | 124 ++++++++++++++++++++++++++++++++ src/Entities/EntityEffect.h | 19 +++++ src/Entities/ProjectileEntity.cpp | 2 + src/Entities/SplashPotionEntity.cpp | 16 +++-- src/Entities/SplashPotionEntity.h | 4 +- src/Items/ItemPotion.h | 136 ++---------------------------------- src/WorldStorage/WSSAnvil.cpp | 2 +- 7 files changed, 164 insertions(+), 139 deletions(-) diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp index 6c4b13a58..f58738aef 100644 --- a/src/Entities/EntityEffect.cpp +++ b/src/Entities/EntityEffect.cpp @@ -7,6 +7,130 @@ + +int cEntityEffect::GetPotionColor(short a_ItemDamage) +{ + // Lowest six bits + return (a_ItemDamage & 0x3f); +} + + + + + +cEntityEffect::eType cEntityEffect::GetPotionEffectType(short a_ItemDamage) +{ + // Lowest four bits + // Potion effect bits are different from entity effect values + // For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits + switch (a_ItemDamage & 0x0f) + { + case 0x01: return cEntityEffect::effRegeneration; + case 0x02: return cEntityEffect::effSpeed; + case 0x03: return cEntityEffect::effFireResistance; + case 0x04: return cEntityEffect::effPoison; + case 0x05: return cEntityEffect::effInstantHealth; + case 0x06: return cEntityEffect::effNightVision; + case 0x08: return cEntityEffect::effWeakness; + case 0x09: return cEntityEffect::effStrength; + case 0x0a: return cEntityEffect::effSlowness; + case 0x0c: return cEntityEffect::effInstantDamage; + case 0x0d: return cEntityEffect::effWaterBreathing; + case 0x0e: return cEntityEffect::effInvisibility; + + // No effect potions + case 0x00: + case 0x07: + case 0x0b: // Will be potion of leaping in 1.8 + case 0x0f: + { + break; + } + } + return cEntityEffect::effNoEffect; +} + + + + + +short cEntityEffect::GetPotionEffectIntensity(short a_ItemDamage) +{ + // Level II potion if the fifth lowest bit is set + return ((a_ItemDamage & 0x20) != 0) ? 1 : 0; +} + + + + + +int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage) +{ + // Base duration in ticks + int base = 0; + double TierCoeff = 1, ExtCoeff = 1, SplashCoeff = 1; + + switch (GetPotionEffectType(a_ItemDamage)) + { + case cEntityEffect::effRegeneration: + case cEntityEffect::effPoison: + { + base = 900; + break; + } + + case cEntityEffect::effSpeed: + case cEntityEffect::effFireResistance: + case cEntityEffect::effNightVision: + case cEntityEffect::effStrength: + case cEntityEffect::effWaterBreathing: + case cEntityEffect::effInvisibility: + { + base = 3600; + break; + } + + case cEntityEffect::effWeakness: + case cEntityEffect::effSlowness: + { + base = 1800; + break; + } + } + + // If potion is level II, half the duration. If not, stays the same + TierCoeff = (GetPotionEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1; + + // If potion is extended, multiply duration by 8/3. If not, stays the same + // Extended potion if sixth lowest bit is set + ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1; + + // If potion is splash potion, multiply duration by 3/4. If not, stays the same + SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75; + + // Ref.: + // http://minecraft.gamepedia.com/Data_values#.22Tier.22_bit + // http://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit + // http://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit + + return (int)(base * TierCoeff * ExtCoeff * SplashCoeff); +} + + + + + +bool cEntityEffect::IsPotionDrinkable(short a_ItemDamage) +{ + // Drinkable potion if 13th lowest bit is set + // Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table + return ((a_ItemDamage & 0x2000) != 0); +} + + + + + cEntityEffect::cEntityEffect(): m_Ticks(0), m_Duration(0), diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h index 396a9bbe0..04e25e303 100644 --- a/src/Entities/EntityEffect.h +++ b/src/Entities/EntityEffect.h @@ -36,6 +36,25 @@ public: effSaturation = 23, } ; + /** Returns the potion color (used by the client for visuals), based on the potion's damage value */ + static int GetPotionColor(short a_ItemDamage); + + + /** Translates the potion's damage value into the entity effect that the potion gives */ + static cEntityEffect::eType GetPotionEffectType(short a_ItemDamage); + + + /** Retrieves the intensity level from the potion's damage value. + Returns 0 for level I potions, 1 for level II potions. */ + static short GetPotionEffectIntensity(short a_ItemDamage); + + + /** Returns the effect duration, in ticks, based on the potion's damage value */ + static int GetPotionEffectDuration(short a_ItemDamage); + + /** Returns true if the potion with the given damage is drinkable */ + static bool IsPotionDrinkable(short a_ItemDamage); + // tolua_end /** Creates an empty entity effect */ diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index b5e81bc0c..43023ec28 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -22,6 +22,7 @@ #include "FireworkEntity.h" #include "GhastFireballEntity.h" #include "WitherSkullEntity.h" +#include "SplashPotionEntity.h" #include "Player.h" @@ -263,6 +264,7 @@ cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator, case pkGhastFireball: return new cGhastFireballEntity (a_Creator, a_X, a_Y, a_Z, Speed); case pkFireCharge: return new cFireChargeEntity (a_Creator, a_X, a_Y, a_Z, Speed); case pkExpBottle: return new cExpBottleEntity (a_Creator, a_X, a_Y, a_Z, Speed); + case pkSplashPotion: return new cSplashPotionEntity (a_Creator, a_X, a_Y, a_Z, Speed, *a_Item); case pkWitherSkull: return new cWitherSkullEntity (a_Creator, a_X, a_Y, a_Z, Speed); case pkFirework: { diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index 6d874e957..d874a86e1 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -72,17 +72,21 @@ cSplashPotionEntity::cSplashPotionEntity( cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed, - cEntityEffect::eType a_EntityEffectType, - cEntityEffect a_EntityEffect, - int a_PotionColor + cItem a_Item ) : super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25), - m_EntityEffectType(a_EntityEffectType), - m_EntityEffect(a_EntityEffect), - m_PotionColor(a_PotionColor), + m_EntityEffectType(cEntityEffect::effNoEffect), + m_EntityEffect(cEntityEffect()), + m_PotionColor(0), m_DestroyTimer(-1) { SetSpeed(a_Speed); + m_EntityEffectType = cEntityEffect::GetPotionEffectType(a_Item.m_ItemDamage); + m_EntityEffect = cEntityEffect( + cEntityEffect::GetPotionEffectDuration(a_Item.m_ItemDamage), + cEntityEffect::GetPotionEffectIntensity(a_Item.m_ItemDamage) + ); + m_PotionColor = cEntityEffect::GetPotionColor(a_Item.m_ItemDamage); } diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index dd14ea82f..db1672f9b 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -29,9 +29,7 @@ public: cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed, - cEntityEffect::eType a_EntityEffectType, - cEntityEffect a_EntityEffect, - int a_PotionColor + cItem a_Item ); cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; } diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h index f16d89b39..cc974c8b9 100644 --- a/src/Items/ItemPotion.h +++ b/src/Items/ItemPotion.h @@ -17,126 +17,12 @@ public: } - /** Returns the potion color (used by the client for visuals), based on the potion's damage value */ - static int GetPotionColor(short a_ItemDamage) - { - // Lowest six bits - return (a_ItemDamage & 0x3f); - } - - - /** Translates the potion's damage value into the entity effect that the potion gives */ - static cEntityEffect::eType GetEntityEffectType(short a_ItemDamage) - { - // Lowest four bits - // Potion effect bits are different from entity effect values - // For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits - switch (a_ItemDamage & 0x0f) - { - case 0x01: return cEntityEffect::effRegeneration; - case 0x02: return cEntityEffect::effSpeed; - case 0x03: return cEntityEffect::effFireResistance; - case 0x04: return cEntityEffect::effPoison; - case 0x05: return cEntityEffect::effInstantHealth; - case 0x06: return cEntityEffect::effNightVision; - case 0x08: return cEntityEffect::effWeakness; - case 0x09: return cEntityEffect::effStrength; - case 0x0a: return cEntityEffect::effSlowness; - case 0x0c: return cEntityEffect::effInstantDamage; - case 0x0d: return cEntityEffect::effWaterBreathing; - case 0x0e: return cEntityEffect::effInvisibility; - - // No effect potions - case 0x00: - case 0x07: - case 0x0b: // Will be potion of leaping in 1.8 - case 0x0f: - { - break; - } - } - return cEntityEffect::effNoEffect; - } - - - /** Retrieves the intensity level from the potion's damage value. - Returns 0 for level I potions, 1 for level II potions. */ - static short GetEntityEffectIntensity(short a_ItemDamage) - { - // Level II potion if the fifth lowest bit is set - return ((a_ItemDamage & 0x20) != 0) ? 1 : 0; - } - - - /** Returns the effect duration, in ticks, based on the potion's damage value */ - static int GetEntityEffectDuration(short a_ItemDamage) - { - // Base duration in ticks - int base = 0; - double TierCoeff = 1, ExtCoeff = 1, SplashCoeff = 1; - - switch (GetEntityEffectType(a_ItemDamage)) - { - case cEntityEffect::effRegeneration: - case cEntityEffect::effPoison: - { - base = 900; - break; - } - - case cEntityEffect::effSpeed: - case cEntityEffect::effFireResistance: - case cEntityEffect::effNightVision: - case cEntityEffect::effStrength: - case cEntityEffect::effWaterBreathing: - case cEntityEffect::effInvisibility: - { - base = 3600; - break; - } - - case cEntityEffect::effWeakness: - case cEntityEffect::effSlowness: - { - base = 1800; - break; - } - } - - // If potion is level II, half the duration. If not, stays the same - TierCoeff = (GetEntityEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1; - - // If potion is extended, multiply duration by 8/3. If not, stays the same - // Extended potion if sixth lowest bit is set - ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1; - - // If potion is splash potion, multiply duration by 3/4. If not, stays the same - SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75; - - // Ref.: - // http://minecraft.gamepedia.com/Data_values#.22Tier.22_bit - // http://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit - // http://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit - - return (int)(base * TierCoeff * ExtCoeff * SplashCoeff); - } - - - /** Returns true if the potion with the given damage is drinkable */ - static bool IsPotionDrinkable(short a_ItemDamage) - { - // Drinkable potion if 13th lowest bit is set - // Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table - return ((a_ItemDamage & 0x2000) != 0); - } - - // cItemHandler overrides: virtual bool IsDrinkable(short a_ItemDamage) override { // Drinkable potion if 13th lowest bit is set // Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table - return IsPotionDrinkable(a_ItemDamage); + return cEntityEffect::IsPotionDrinkable(a_ItemDamage); } @@ -145,7 +31,7 @@ public: short PotionDamage = a_Item.m_ItemDamage; // Do not throw non-splash potions: - if (IsPotionDrinkable(PotionDamage)) + if (cEntityEffect::IsPotionDrinkable(PotionDamage)) { return false; } @@ -153,18 +39,8 @@ public: Vector3d Pos = a_Player->GetThrowStartPos(); Vector3d Speed = a_Player->GetLookVector() * 7; - cSplashPotionEntity * Projectile = new cSplashPotionEntity( - a_Player, Pos.x, Pos.y, Pos.z, Speed, - GetEntityEffectType(PotionDamage), cEntityEffect(GetEntityEffectDuration(PotionDamage), - GetEntityEffectIntensity(PotionDamage)), GetPotionColor(PotionDamage) - ); - if (Projectile == NULL) - { - return false; - } - if (!Projectile->Initialize(*a_World)) + if (a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, cProjectileEntity::pkSplashPotion, a_Player, &a_Player->GetEquippedItem(), &Speed) < 0) { - delete Projectile; return false; } @@ -182,12 +58,14 @@ public: short PotionDamage = a_Item->m_ItemDamage; // Do not drink undrinkable potions: - if (!IsDrinkable(a_Item->m_ItemDamage)) + if (!cEntityEffect::IsPotionDrinkable(a_Item->m_ItemDamage)) { return false; } - a_Player->AddEntityEffect(GetEntityEffectType(PotionDamage), GetEntityEffectDuration(PotionDamage), GetEntityEffectIntensity(PotionDamage)); + a_Player->AddEntityEffect(cEntityEffect::GetPotionEffectType(PotionDamage), + cEntityEffect::GetPotionEffectDuration(PotionDamage), + cEntityEffect::GetPotionEffectIntensity(PotionDamage)); a_Player->GetInventory().RemoveOneEquippedItem(); a_Player->GetInventory().AddItem(E_ITEM_GLASS_BOTTLE); return true; diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 2851647fe..023813769 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -1670,7 +1670,7 @@ void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_ void cWSSAnvil::LoadSplashPotionFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) { - std::auto_ptr SplashPotion(new cSplashPotionEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0), cEntityEffect::effNoEffect, cEntityEffect(), 0)); + std::auto_ptr SplashPotion(new cSplashPotionEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0), cItem())); if (!LoadProjectileBaseFromNBT(*SplashPotion.get(), a_NBT, a_TagIdx)) { return; -- cgit v1.2.3 From 60d4a165140b3b1c5202c21fd197b61cae18077c Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 20 Jul 2014 13:11:06 -0700 Subject: Fixed indentations, removed redundant init code in SplashPotionEntity.cpp --- src/Entities/EntityEffect.cpp | 2 +- src/Entities/EntityEffect.h | 3 +-- src/Entities/SplashPotionEntity.cpp | 3 --- src/Items/ItemPotion.h | 8 +++++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp index f58738aef..fdcbe822e 100644 --- a/src/Entities/EntityEffect.cpp +++ b/src/Entities/EntityEffect.cpp @@ -38,7 +38,7 @@ cEntityEffect::eType cEntityEffect::GetPotionEffectType(short a_ItemDamage) case 0x0d: return cEntityEffect::effWaterBreathing; case 0x0e: return cEntityEffect::effInvisibility; - // No effect potions + // No effect potions case 0x00: case 0x07: case 0x0b: // Will be potion of leaping in 1.8 diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h index 04e25e303..f9c1e4eb2 100644 --- a/src/Entities/EntityEffect.h +++ b/src/Entities/EntityEffect.h @@ -44,8 +44,7 @@ public: static cEntityEffect::eType GetPotionEffectType(short a_ItemDamage); - /** Retrieves the intensity level from the potion's damage value. - Returns 0 for level I potions, 1 for level II potions. */ + /** Retrieves the intensity level from the potion's damage value. Returns 0 for level I potions, 1 for level II potions. */ static short GetPotionEffectIntensity(short a_ItemDamage); diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index d874a86e1..ed16f060d 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -75,9 +75,6 @@ cSplashPotionEntity::cSplashPotionEntity( cItem a_Item ) : super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25), - m_EntityEffectType(cEntityEffect::effNoEffect), - m_EntityEffect(cEntityEffect()), - m_PotionColor(0), m_DestroyTimer(-1) { SetSpeed(a_Speed); diff --git a/src/Items/ItemPotion.h b/src/Items/ItemPotion.h index cc974c8b9..24614cd8a 100644 --- a/src/Items/ItemPotion.h +++ b/src/Items/ItemPotion.h @@ -63,9 +63,11 @@ public: return false; } - a_Player->AddEntityEffect(cEntityEffect::GetPotionEffectType(PotionDamage), - cEntityEffect::GetPotionEffectDuration(PotionDamage), - cEntityEffect::GetPotionEffectIntensity(PotionDamage)); + a_Player->AddEntityEffect( + cEntityEffect::GetPotionEffectType(PotionDamage), + cEntityEffect::GetPotionEffectDuration(PotionDamage), + cEntityEffect::GetPotionEffectIntensity(PotionDamage) + ); a_Player->GetInventory().RemoveOneEquippedItem(); a_Player->GetInventory().AddItem(E_ITEM_GLASS_BOTTLE); return true; -- cgit v1.2.3 From 16e0beb5b6f6c4c103acfccc1940585513b5c258 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 26 Jul 2014 03:55:40 -0700 Subject: SplashPotionEntity: Use `const cItem &` instead of a cItem --- src/Entities/SplashPotionEntity.cpp | 2 +- src/Entities/SplashPotionEntity.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Entities/SplashPotionEntity.cpp b/src/Entities/SplashPotionEntity.cpp index ed16f060d..fd1a0179b 100644 --- a/src/Entities/SplashPotionEntity.cpp +++ b/src/Entities/SplashPotionEntity.cpp @@ -72,7 +72,7 @@ cSplashPotionEntity::cSplashPotionEntity( cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed, - cItem a_Item + const cItem & a_Item ) : super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25), m_DestroyTimer(-1) diff --git a/src/Entities/SplashPotionEntity.h b/src/Entities/SplashPotionEntity.h index db1672f9b..4afc5f204 100644 --- a/src/Entities/SplashPotionEntity.h +++ b/src/Entities/SplashPotionEntity.h @@ -29,7 +29,7 @@ public: cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed, - cItem a_Item + const cItem & a_Item ); cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; } -- cgit v1.2.3 From e23f0238a825669ffdf75cb8cd157a7df68ae363 Mon Sep 17 00:00:00 2001 From: archshift Date: Sat, 26 Jul 2014 03:58:59 -0700 Subject: Git: Ignore AllFiles.lst (generated by cmake) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 400bf2c91..51987336c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ cloc.xsl *.suo /EveryNight.cmd /UploadLuaAPI.cmd +AllFiles.lst # IDE Stuff ## Sublime Text -- cgit v1.2.3 From 4de8f5ca2926068eb855ba19c35de2a63ddebf28 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 26 Jul 2014 13:26:14 +0200 Subject: Rename function. --- src/Items/ItemHandler.cpp | 6 +++--- src/Items/ItemHandler.h | 2 +- src/Items/ItemShears.h | 2 +- src/Items/ItemSword.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index e256fa232..ec86648b3 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -335,7 +335,7 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const if (!cBlockInfo::IsOneHitDig(Block)) { - a_Player->UseEquippedItem(GetDurabilityLostWithThatAction(dlaBreakBlock)); + a_Player->UseEquippedItem(GetDurabilityLossByAction(dlaBreakBlock)); } } @@ -346,7 +346,7 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const void cItemHandler::OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity) { UNUSED(a_AttackedEntity); - a_Attacker->UseEquippedItem(GetDurabilityLostWithThatAction(dlaAttackEntity)); + a_Attacker->UseEquippedItem(GetDurabilityLossByAction(dlaAttackEntity)); } @@ -364,7 +364,7 @@ void cItemHandler::OnFoodEaten(cWorld * a_World, cPlayer * a_Player, cItem * a_I -short cItemHandler::GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) +short cItemHandler::GetDurabilityLossByAction(eDurabilityLostAction a_Action) { switch (a_Action) { diff --git a/src/Items/ItemHandler.h b/src/Items/ItemHandler.h index 28b1dd13b..1d5f59f3e 100644 --- a/src/Items/ItemHandler.h +++ b/src/Items/ItemHandler.h @@ -64,7 +64,7 @@ public: virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item); /** Get the durability lost which the item will get, when a specified action was performed. */ - virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action); + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action); /** Returns the maximum stack size for a given item */ virtual char GetMaxStackSize(void); diff --git a/src/Items/ItemShears.h b/src/Items/ItemShears.h index 8f5d5f385..fa2794df2 100644 --- a/src/Items/ItemShears.h +++ b/src/Items/ItemShears.h @@ -63,7 +63,7 @@ public: } - virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override { return 0; } diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 1a17023ef..b90965535 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -44,7 +44,7 @@ public: } - virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override { switch (a_Action) { -- cgit v1.2.3 From 6e2025d12544e33c379f0d03ab875faad08c7330 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 26 Jul 2014 13:29:25 +0200 Subject: Change comment. --- src/UI/SlotArea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index e9b1ef8e0..b5f84c24c 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1866,7 +1866,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C { ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots())); - // Creative inventory must treat a_ClickedItem as a DraggedItem instead, replacing the inventory slot with it + // When the player is in creative mode, the client sends the new item as a_ClickedItem, not the current item in the slot. if (a_Player.IsGameModeCreative() && (m_ParentWindow.GetWindowType() == cWindow::wtInventory)) { if ((a_ClickAction == caDropKey) || (a_ClickAction == caCtrlDropKey)) -- cgit v1.2.3 From c2a2aea9f8808b9742fedbfc8c8864cb9082afd5 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 26 Jul 2014 17:09:59 +0200 Subject: Derp. --- src/Items/ItemHoe.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Items/ItemHoe.h b/src/Items/ItemHoe.h index 6523b36d9..8d0b71478 100644 --- a/src/Items/ItemHoe.h +++ b/src/Items/ItemHoe.h @@ -33,7 +33,7 @@ public: } - virtual short GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action) override + virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override { return 0; } -- cgit v1.2.3 From ce54936f01a832e8bcbd6320d95b4208bad3487f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 27 Jul 2014 00:08:25 +0200 Subject: Updated NetherFort prefabs to latest Gallery content. --- src/Generating/Prefabs/NetherFortPrefabs.cpp | 789 +++++++++++++++++++++++++-- 1 file changed, 752 insertions(+), 37 deletions(-) diff --git a/src/Generating/Prefabs/NetherFortPrefabs.cpp b/src/Generating/Prefabs/NetherFortPrefabs.cpp index ee3a8899b..fb0e93daa 100644 --- a/src/Generating/Prefabs/NetherFortPrefabs.cpp +++ b/src/Generating/Prefabs/NetherFortPrefabs.cpp @@ -1410,6 +1410,383 @@ const cPrefab::sDef g_NetherFortPrefabs[] = + //////////////////////////////////////////////////////////////////////////////// + // BridgeDoubleStairs: + // The data has been exported from the gallery Nether, area index 115, ID 810, created by STR_Warrior + { + // Size: + 15, 16, 16, // SizeX = 15, SizeY = 16, SizeZ = 16 + + // Hitbox (relative to bounding box): + 0, 0, 0, // MinX, MinY, MinZ + 14, 15, 15, // MaxX, MaxY, MaxZ + + // Block definitions: + ".: 0: 0\n" /* air */ + "a:112: 0\n" /* netherbrick */ + "b:114: 7\n" /* netherbrickstairs */ + "c:114: 6\n" /* netherbrickstairs */ + "d:114: 4\n" /* netherbrickstairs */ + "e:114: 5\n" /* netherbrickstairs */ + "f:114: 2\n" /* netherbrickstairs */ + "g:114: 3\n" /* netherbrickstairs */ + "h:114: 1\n" /* netherbrickstairs */ + "i: 44:14\n" /* step */ + "m: 19: 0\n" /* sponge */, + + // Block data: + // Level 0 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmaaam" + /* 1 */ "aammmmmmmmmaaaa" + /* 2 */ "aammmmmmmmmmmma" + /* 3 */ "aammmmmmmmmmmma" + /* 4 */ "mmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmm" + /* 12 */ "aammmmmmmmmmmma" + /* 13 */ "aammmmmmmmmmmma" + /* 14 */ "aammmmmmmmmaaaa" + /* 15 */ "mmmmmmmmmmmaaam" + + // Level 1 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmaaam" + /* 1 */ "aammmmmmmmmaaaa" + /* 2 */ "aammmmmmmmmmmma" + /* 3 */ "aammmmmmmmmmmma" + /* 4 */ "mmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmm" + /* 12 */ "aammmmmmmmmmmma" + /* 13 */ "aammmmmmmmmmmma" + /* 14 */ "aammmmmmmmmaaaa" + /* 15 */ "mmmmmmmmmmmaaam" + + // Level 2 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmaaam" + /* 1 */ "aammmmmmmmmaaaa" + /* 2 */ "aammmmmmmmmmmma" + /* 3 */ "aammmmmmmmmmmma" + /* 4 */ "mmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmm" + /* 12 */ "aammmmmmmmmmmma" + /* 13 */ "aammmmmmmmmmmma" + /* 14 */ "aammmmmmmmmaaaa" + /* 15 */ "mmmmmmmmmmmaaam" + + // Level 3 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmaaam" + /* 1 */ "aammmmmmmmmaaaa" + /* 2 */ "aammmmmmmmmbbba" + /* 3 */ "aammmmmmmmmmmma" + /* 4 */ "mmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmm" + /* 12 */ "aammmmmmmmmmmma" + /* 13 */ "aammmmmmmmmccca" + /* 14 */ "aammmmmmmmmaaaa" + /* 15 */ "mmmmmmmmmmmaaam" + + // Level 4 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmaaam" + /* 1 */ "aammmmmmmmmaaaa" + /* 2 */ "aammmmmmmmmaaaa" + /* 3 */ "aammmmmmmmmbbba" + /* 4 */ "mmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmm" + /* 12 */ "aammmmmmmmmccca" + /* 13 */ "aammmmmmmmmaaaa" + /* 14 */ "aammmmmmmmmaaaa" + /* 15 */ "mmmmmmmmmmmaaam" + + // Level 5 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmdaaae" + /* 1 */ "aammmmmmmmdaaaa" + /* 2 */ "aammmmmmmmdaaaa" + /* 3 */ "aammmmmmmmdaaaa" + /* 4 */ "mmmmmmmmmmdaaae" + /* 5 */ "mmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmdaaae" + /* 12 */ "aammmmmmmmdaaaa" + /* 13 */ "aammmmmmmmdaaaa" + /* 14 */ "aammmmmmmmdaaaa" + /* 15 */ "mmmmmmmmmmdaaae" + + // Level 6 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmaaaaa" + /* 1 */ "aammmmmmmmaaaaa" + /* 2 */ "aammmmmmmmaaaaa" + /* 3 */ "aammmmmmmmaaaaa" + /* 4 */ "mmmmmmmmmmaaaaa" + /* 5 */ "mmmmmmmmmmdaaae" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmdaaae" + /* 11 */ "mmmmmmmmmmaaaaa" + /* 12 */ "aammmmmmmmaaaaa" + /* 13 */ "aammmmmmmmaaaaa" + /* 14 */ "aammmmmmmmaaaaa" + /* 15 */ "mmmmmmmmmmaaaaa" + + // Level 7 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmma...a" + /* 1 */ "aammmmmmmma...a" + /* 2 */ "aammmmmmmma...a" + /* 3 */ "aammmmmmmma...a" + /* 4 */ "mmmmmmmmmmafffa" + /* 5 */ "mmmmmmmmmaaaaaa" + /* 6 */ "mmmmmmmmmaaaaae" + /* 7 */ "mmmmmmmmmaaaaae" + /* 8 */ "mmmmmmmmmaaaaae" + /* 9 */ "mmmmmmmmmaaaaae" + /* 10 */ "mmmmmmmmmaaaaaa" + /* 11 */ "mmmmmmmmmmaggga" + /* 12 */ "aammmmmmmma...a" + /* 13 */ "aammmmmmmma...a" + /* 14 */ "aammmmmmmma...a" + /* 15 */ "mmmmmmmmmma...a" + + // Level 8 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmm...m" + /* 1 */ "aammmmmmmma...a" + /* 2 */ "aammmmmmmma...a" + /* 3 */ "aammmmmmmma...a" + /* 4 */ "mmmmmmmmmma...a" + /* 5 */ "mmmmmmmmmaafffa" + /* 6 */ "mmmmmmmmaaaaaaa" + /* 7 */ "mmmmmmmmaaaaaaa" + /* 8 */ "mmmmmmmmaaaaaaa" + /* 9 */ "mmmmmmmmaaaaaaa" + /* 10 */ "mmmmmmmmmaaggga" + /* 11 */ "mmmmmmmmmma...a" + /* 12 */ "aammmmmmmma...a" + /* 13 */ "aammmmmmmma...a" + /* 14 */ "aammmmmmmma...a" + /* 15 */ "mmmmmmmmmmm...m" + + // Level 9 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmm...m" + /* 1 */ "aaemmmmmmma...a" + /* 2 */ "aaemmmmmmma...a" + /* 3 */ "aaemmmmmmma...a" + /* 4 */ "mmmmmmmmmma...a" + /* 5 */ "mmmmmmmmmaa...a" + /* 6 */ "mmmmaaaaah....a" + /* 7 */ "mmmmaaaaah....a" + /* 8 */ "mmmmaaaaah....a" + /* 9 */ "mmmmaaaaah....a" + /* 10 */ "mmmmmmmmmaa...a" + /* 11 */ "mmmmmmmmmma...a" + /* 12 */ "aaemmmmmmma...a" + /* 13 */ "aaemmmmmmma...a" + /* 14 */ "aaemmmmmmma...a" + /* 15 */ "mmmmmmmmmmm...m" + + // Level 10 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmmmmm" + /* 1 */ "aaaeimmmmmammma" + /* 2 */ "aaaeimmmmmammma" + /* 3 */ "aaaeimmmmma...a" + /* 4 */ "mmmmmmmmmmm...m" + /* 5 */ "mmmmaaaaaam...m" + /* 6 */ "mmmmaaaah.....m" + /* 7 */ "mmmmaaaah.....m" + /* 8 */ "mmmmaaaah.....m" + /* 9 */ "mmmmaaaah.....m" + /* 10 */ "mmmmaaaaaam...m" + /* 11 */ "mmmmmmmmmmm...m" + /* 12 */ "aaaeimmmmma...a" + /* 13 */ "aaaeimmmmmammma" + /* 14 */ "aaaeimmmmmammma" + /* 15 */ "mmmmmmmmmmmmmmm" + + // Level 11 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "ccccccccccccccc" + /* 1 */ "aaaaaaaaaaaaaaa" + /* 2 */ "aaaaaaaaaaaaaaa" + /* 3 */ "aaaaaaaaaaaaaaa" + /* 4 */ "bbbbaaaaabbbbbb" + /* 5 */ "mmmmagggamm...m" + /* 6 */ "mmmma.........m" + /* 7 */ "mmmma.........m" + /* 8 */ "mmmma.........m" + /* 9 */ "mmmma.........m" + /* 10 */ "mmmmafffamm...m" + /* 11 */ "ccccaaaahcccccc" + /* 12 */ "aaaaaaaaaaaaaaa" + /* 13 */ "aaaaaaaaaaaaaaa" + /* 14 */ "aaaaaaaaaaaaaaa" + /* 15 */ "bbbbbbbbbbbbbbb" + + // Level 12 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "aaaaaaaaaaaaaaa" + /* 1 */ "aaaaaaaaaaaaaaa" + /* 2 */ "aaaaaaaaaaaaaaa" + /* 3 */ "aaaaaaaaaaaaaaa" + /* 4 */ "aaaaagggaaaaaaa" + /* 5 */ "mmmma...ammmmmm" + /* 6 */ "mmmma.........m" + /* 7 */ "mmmmm.........m" + /* 8 */ "mmmmm.........m" + /* 9 */ "mmmma.........m" + /* 10 */ "mmmma...ammmmmm" + /* 11 */ "aaaaafffaaaaaaa" + /* 12 */ "aaaaaaaaaaaaaaa" + /* 13 */ "aaaaaaaaaaaaaaa" + /* 14 */ "aaaaaaaaaaaaaaa" + /* 15 */ "aaaaaaaaaaaaaaa" + + // Level 13 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "aaaaaaaaaaaaaaa" + /* 1 */ "..............." + /* 2 */ "..............." + /* 3 */ "..............." + /* 4 */ "aaaaa...aaaaaaa" + /* 5 */ "mmmma...ammmmmm" + /* 6 */ "mmmmm.....mmmmm" + /* 7 */ "mmmmm.....mmmmm" + /* 8 */ "mmmmm.....mmmmm" + /* 9 */ "mmmmm.....mmmmm" + /* 10 */ "mmmma...ammmmmm" + /* 11 */ "aaaaa...aaaaaaa" + /* 12 */ "..............." + /* 13 */ "..............." + /* 14 */ "..............." + /* 15 */ "aaaaaaaaaaaaaaa" + + // Level 14 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmmmmm" + /* 1 */ "..............." + /* 2 */ "..............." + /* 3 */ "..............." + /* 4 */ "mmmmm...mmmmmmm" + /* 5 */ "mmmmm...mmmmmmm" + /* 6 */ "mmmmm...mmmmmmm" + /* 7 */ "mmmmm...mmmmmmm" + /* 8 */ "mmmmm...mmmmmmm" + /* 9 */ "mmmmm...mmmmmmm" + /* 10 */ "mmmmm...mmmmmmm" + /* 11 */ "mmmmm...mmmmmmm" + /* 12 */ "..............." + /* 13 */ "..............." + /* 14 */ "..............." + /* 15 */ "mmmmmmmmmmmmmmm" + + // Level 15 + /* z\x* 11111 */ + /* * 012345678901234 */ + /* 0 */ "mmmmmmmmmmmmmmm" + /* 1 */ "..............." + /* 2 */ "..............." + /* 3 */ "..............." + /* 4 */ "mmmmm...mmmmmmm" + /* 5 */ "mmmmm...mmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmm" + /* 10 */ "mmmmm...mmmmmmm" + /* 11 */ "mmmmm...mmmmmmm" + /* 12 */ "..............." + /* 13 */ "..............." + /* 14 */ "..............." + /* 15 */ "mmmmmmmmmmmmmmm", + + // Connectors: + "0: 0, 13, 13: 4\n" /* Type 0, direction X- */ + "0: 14, 13, 13: 5\n" /* Type 0, direction X+ */ + "0: 0, 13, 2: 4\n" /* Type 0, direction X- */ + "0: 14, 13, 2: 5\n" /* Type 0, direction X+ */ + "0: 12, 7, 15: 3\n" /* Type 0, direction Z+ */ + "0: 12, 7, 0: 2\n" /* Type 0, direction Z- */, + + // AllowedRotations: + 7, /* 1, 2, 3 CCW rotation allowed */ + + // Merge strategy: + cBlockArea::msSpongePrint, + + // ShouldExtendFloor: + true, + + // DefaultWeight: + 100, + + // DepthWeight: + "", + + // AddWeightIfSame: + 0, + + // MoveToGround: + false, + }, // BridgeDoubleStairs + + + //////////////////////////////////////////////////////////////////////////////// // BridgeFunnelDown: // The data has been exported from the gallery Nether, area index 0, ID 2, created by Aloe_vera @@ -2606,12 +2983,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] = /* 2 */ "aaaaaaaaaaa" /* 3 */ "aaaaaaaaaaa" /* 4 */ "aaaaaaaaaaa" - /* 5 */ "aaaaa......" - /* 6 */ "aaaaa......" - /* 7 */ "aaaaa......" - /* 8 */ "aaaaa......" - /* 9 */ "aaaaa......" - /* 10 */ "aaaaa......" + /* 5 */ "aaaaammmmmm" + /* 6 */ "aaaaammmmmm" + /* 7 */ "aaaaammmmmm" + /* 8 */ "aaaaammmmmm" + /* 9 */ "aaaaammmmmm" + /* 10 */ "aaaaammmmmm" // Level 1 /* z\x* 1 */ @@ -2621,12 +2998,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] = /* 2 */ "a.........." /* 3 */ "a.........." /* 4 */ "a...aaaaaaa" - /* 5 */ "a...a......" - /* 6 */ "a...a......" - /* 7 */ "a...a......" - /* 8 */ "a...a......" - /* 9 */ "a...a......" - /* 10 */ "a...a......" + /* 5 */ "a...ammmmmm" + /* 6 */ "a...ammmmmm" + /* 7 */ "a...ammmmmm" + /* 8 */ "a...ammmmmm" + /* 9 */ "a...ammmmmm" + /* 10 */ "a...ammmmmm" // Level 2 /* z\x* 1 */ @@ -2636,12 +3013,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] = /* 2 */ "a.........." /* 3 */ "b.........." /* 4 */ "a...abababa" - /* 5 */ "b...b......" - /* 6 */ "a...a......" - /* 7 */ "b...b......" - /* 8 */ "a...a......" - /* 9 */ "b...b......" - /* 10 */ "a...a......" + /* 5 */ "b...bmmmmmm" + /* 6 */ "a...ammmmmm" + /* 7 */ "b...bmmmmmm" + /* 8 */ "a...ammmmmm" + /* 9 */ "b...bmmmmmm" + /* 10 */ "a...ammmmmm" // Level 3 /* z\x* 1 */ @@ -2651,12 +3028,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] = /* 2 */ "a.........." /* 3 */ "b.........." /* 4 */ "a...abababa" - /* 5 */ "b...b......" - /* 6 */ "a...a......" - /* 7 */ "b...b......" - /* 8 */ "a...a......" - /* 9 */ "b...b......" - /* 10 */ "a...a......" + /* 5 */ "b...bmmmmmm" + /* 6 */ "a...ammmmmm" + /* 7 */ "b...bmmmmmm" + /* 8 */ "a...ammmmmm" + /* 9 */ "b...bmmmmmm" + /* 10 */ "a...ammmmmm" // Level 4 /* z\x* 1 */ @@ -2666,12 +3043,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] = /* 2 */ "a.........." /* 3 */ "b.........." /* 4 */ "a...abababa" - /* 5 */ "b...b......" - /* 6 */ "a...a......" - /* 7 */ "b...b......" - /* 8 */ "a...a......" - /* 9 */ "b...b......" - /* 10 */ "a...a......" + /* 5 */ "b...bmmmmmm" + /* 6 */ "a...ammmmmm" + /* 7 */ "b...bmmmmmm" + /* 8 */ "a...ammmmmm" + /* 9 */ "b...bmmmmmm" + /* 10 */ "a...ammmmmm" // Level 5 /* z\x* 1 */ @@ -2681,12 +3058,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] = /* 2 */ "daaaaaaaaaa" /* 3 */ "daaaaaaaaaa" /* 4 */ "daaaeeeeeee" - /* 5 */ "daaaf......" - /* 6 */ "daaaf......" - /* 7 */ "daaaf......" - /* 8 */ "daaaf......" - /* 9 */ "daaaf......" - /* 10 */ "daaaf......", + /* 5 */ "daaafmmmmmm" + /* 6 */ "daaafmmmmmm" + /* 7 */ "daaafmmmmmm" + /* 8 */ "daaafmmmmmm" + /* 9 */ "daaafmmmmmm" + /* 10 */ "daaafmmmmmm", // Connectors: "1: 2, 1, 10: 3\n" /* Type 1, direction Z+ */ @@ -4097,7 +4474,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] = /* 14 */ "abbaabbaabbaabba", // Connectors: - "", + "1: 0, 6, 7: 4\n" /* Type 1, direction X- */ + "-1: 0, 6, 7: 4\n" /* Type -1, direction X- */ + "1: 9, 1, 0: 2\n" /* Type 1, direction Z- */ + "-1: 9, 1, 0: 2\n" /* Type -1, direction Z- */ + "1: 9, 1, 14: 3\n" /* Type 1, direction Z+ */ + "-1: 9, 1, 14: 3\n" /* Type -1, direction Z+ */, // AllowedRotations: 7, /* 1, 2, 3 CCW rotation allowed */ @@ -4314,6 +4696,339 @@ const cPrefab::sDef g_NetherFortPrefabs[] = + //////////////////////////////////////////////////////////////////////////////// + // SlabbedBridgeStairs: + // The data has been exported from the gallery Nether, area index 116, ID 811, created by Aloe_vera + { + // Size: + 16, 14, 16, // SizeX = 16, SizeY = 14, SizeZ = 16 + + // Hitbox (relative to bounding box): + 0, 0, 0, // MinX, MinY, MinZ + 15, 13, 15, // MaxX, MaxY, MaxZ + + // Block definitions: + ".: 0: 0\n" /* air */ + "a:112: 0\n" /* netherbrick */ + "b:114: 5\n" /* netherbrickstairs */ + "c:114: 4\n" /* netherbrickstairs */ + "d: 44:14\n" /* step */ + "e:114: 6\n" /* netherbrickstairs */ + "f:114: 7\n" /* netherbrickstairs */ + "g: 44: 6\n" /* step */ + "m: 19: 0\n" /* sponge */, + + // Block data: + // Level 0 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmmmmmm" + /* 1 */ "aammmmmmmmmmmmaa" + /* 2 */ "aammmmmmmmmmmmaa" + /* 3 */ "aammmmmmmmmmmmaa" + /* 4 */ "mmmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmmm" + /* 12 */ "maaammmmmmmmmmmm" + /* 13 */ "maaammmmmmmmmmmm" + /* 14 */ "maaammmmmmmmaaam" + /* 15 */ "mmmmmmmmmmmmaaam" + + // Level 1 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmmmmmm" + /* 1 */ "aabmmmmmmmmmmcaa" + /* 2 */ "aabmmmmmmmmmmcaa" + /* 3 */ "aabmmmmmmmmmmcaa" + /* 4 */ "mmmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmmm" + /* 12 */ "maaammmmmmmmmmmm" + /* 13 */ "maaammmmmmmmmmmm" + /* 14 */ "maaammmmmmmmaaam" + /* 15 */ "mmmmmmmmmmmmaaam" + + // Level 2 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmmmmmm" + /* 1 */ "aaabdmmmmmmdcaaa" + /* 2 */ "aaabdmmmmmmdcaaa" + /* 3 */ "aaabdmmmmmmdcaaa" + /* 4 */ "mmmmmmmmmmmmmmmm" + /* 5 */ "mmmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmmm" + /* 12 */ "maaammmmmmmmmmmm" + /* 13 */ "maaammmmmmmmmmmm" + /* 14 */ "maaammmmmmmmaaam" + /* 15 */ "mmmmmmmmmmmmaaam" + + // Level 3 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "eeeeeeeeeeeeeeee" + /* 1 */ "aaaaaaaaaaaaaaaa" + /* 2 */ "aaaaaaaaaaaaaaaa" + /* 3 */ "aaaaaaaaaaaaaaaa" + /* 4 */ "ffffffffffffffff" + /* 5 */ "mmmmmmmmmmmmmmmm" + /* 6 */ "mmmmmmmmmmmmmmmm" + /* 7 */ "mmmmmmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmmm" + /* 12 */ "maaammmmmmmmmmmm" + /* 13 */ "maaammmmmmmmmmmm" + /* 14 */ "maaammmmmmmmaaam" + /* 15 */ "mmmmmmmmmmmmaaam" + + // Level 4 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "aaaaaaaaaaaaaaaa" + /* 1 */ "aaaaaaaaaaaaaaaa" + /* 2 */ "aaaaaaaaaaaaaaaa" + /* 3 */ "aaaaaaaaaaaaaaaa" + /* 4 */ "aaaaaaaaaaaaaaaa" + /* 5 */ "faaabmmmmmmmmmmm" + /* 6 */ "caaabmmmmmmmmmmm" + /* 7 */ "caaabmmmmmmmmmmm" + /* 8 */ "mmmmmmmmmmmmmmmm" + /* 9 */ "mmmmmmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmmm" + /* 12 */ "maaammmmmmmmmmmm" + /* 13 */ "maaammmmmmmmmmmm" + /* 14 */ "maaammmmmmmmaaam" + /* 15 */ "mmmmmmmmmmmmaaam" + + // Level 5 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "aaaaaaaaaaaaaaaa" + /* 1 */ "................" + /* 2 */ "................" + /* 3 */ "................" + /* 4 */ "a...aaaaaaaaaaaa" + /* 5 */ "agggammmmmmmmmmm" + /* 6 */ "aaaaammmmmmmmmmm" + /* 7 */ "aaaaammmmmmmmmmm" + /* 8 */ "caaabmmmmmmmmmmm" + /* 9 */ "caaabmmmmmmmmmmm" + /* 10 */ "mmmmmmmmmmmmmmmm" + /* 11 */ "mmmmmmmmmmmmmmmm" + /* 12 */ "maaammmmmmmmmmmm" + /* 13 */ "maaammmmmmmmmmmm" + /* 14 */ "maaammmmmmmmaaam" + /* 15 */ "mmmmmmmmmmmmaaam" + + // Level 6 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmmaaam" + /* 1 */ "................" + /* 2 */ "................" + /* 3 */ "................" + /* 4 */ "m...mmmmmmmmaaam" + /* 5 */ "a...ammmmmmmmmmm" + /* 6 */ "a...ammmmmmmmmmm" + /* 7 */ "agggammmmmmmmmmm" + /* 8 */ "aaaaammmmmmmmmmm" + /* 9 */ "aaaaammmmmmmmmmm" + /* 10 */ "caaabmmmmmmmmmmm" + /* 11 */ "caaabmmmmmmmmmmm" + /* 12 */ "maaabmmmmmmmmmmm" + /* 13 */ "maaabmmmmmmmmmmm" + /* 14 */ "maaafmmmmmmmaaam" + /* 15 */ "mmmmmmmmmmmmaaam" + + // Level 7 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmmaaam" + /* 1 */ "................" + /* 2 */ "................" + /* 3 */ "................" + /* 4 */ "m...mmmmmmmmaaam" + /* 5 */ "m...mmmmmmmmmmmm" + /* 6 */ "m...mmmmmmmmmmmm" + /* 7 */ "a...ammmmmmmmmmm" + /* 8 */ "a...ammmmmmmmmmm" + /* 9 */ "agggammmmmmmmmmm" + /* 10 */ "aaaaammmmmmmmmmm" + /* 11 */ "aaaaaeemmmmmmmmm" + /* 12 */ "caaaaaammmmmmmmm" + /* 13 */ "caaaaaammmmmmmmm" + /* 14 */ "caaaaaammmmmaaam" + /* 15 */ "fffffffmmmmmaaam" + + // Level 8 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmmaaam" + /* 1 */ "mmmmmmmmmmmmmmmm" + /* 2 */ "mmmmmmmmmmmmmmmm" + /* 3 */ "mmmmmmmmmmmmmmmm" + /* 4 */ "m...mmmmmmmmaaam" + /* 5 */ "m...mmmmmmmmmmmm" + /* 6 */ "m...mmmmmmmmmmmm" + /* 7 */ "m...mmmmmmmmmmmm" + /* 8 */ "m...mmmmmmmmmmmm" + /* 9 */ "a...ammmmmmmmmmm" + /* 10 */ "a...ammmmmmmmmmm" + /* 11 */ "a...aaaeemmmmmmm" + /* 12 */ "a....gaaammmmmmm" + /* 13 */ "a....gaaammmmmmm" + /* 14 */ "a....gaaammmaaam" + /* 15 */ "aaaaaaaffmmmaaam" + + // Level 9 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmcaaab" + /* 1 */ "mmmmmmmmmmmcaaab" + /* 2 */ "mmmmmmmmmmmcaaab" + /* 3 */ "mmmmmmmmmmmcaaab" + /* 4 */ "mmmmmmmmmmmcaaab" + /* 5 */ "mmmmmmmmmmmcaaab" + /* 6 */ "m...mmmmmmmcaaab" + /* 7 */ "m...mmmmmmmcaaab" + /* 8 */ "m...mmmmmmmcaaab" + /* 9 */ "m...mmmmmmmcaaab" + /* 10 */ "m...mmmmmmmcaaab" + /* 11 */ "m...maaaaeecaaab" + /* 12 */ "m......gaaaaaaab" + /* 13 */ "m......gaaaaaaab" + /* 14 */ "m......gaaaaaaab" + /* 15 */ "mmmmmaaaafffaaab" + + // Level 10 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmaaaaa" + /* 1 */ "mmmmmmmmmmmaaaaa" + /* 2 */ "mmmmmmmmmmmaaaaa" + /* 3 */ "mmmmmmmmmmmaaaaa" + /* 4 */ "mmmmmmmmmmmaaaaa" + /* 5 */ "mmmmmmmmmmmaaaaa" + /* 6 */ "mmmmmmmmmmmaaaaa" + /* 7 */ "mmmmmmmmmmmaaaaa" + /* 8 */ "m...mmmmmmmaaaaa" + /* 9 */ "m...mmmmmmmaaaaa" + /* 10 */ "m...mmmmmmmaaaaa" + /* 11 */ "m...mmmaaaaaaaaa" + /* 12 */ "m........gaaaaaa" + /* 13 */ "m........gaaaaaa" + /* 14 */ "m........gaaaaaa" + /* 15 */ "mmmmmmmaaaaaaaaa" + + // Level 11 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmma...a" + /* 1 */ "mmmmmmmmmmma...a" + /* 2 */ "mmmmmmmmmmma...a" + /* 3 */ "mmmmmmmmmmma...a" + /* 4 */ "mmmmmmmmmmma...a" + /* 5 */ "mmmmmmmmmmma...a" + /* 6 */ "mmmmmmmmmmma...a" + /* 7 */ "mmmmmmmmmmma...a" + /* 8 */ "mmmmmmmmmmma...a" + /* 9 */ "mmmmmmmmmmma...a" + /* 10 */ "mmmmmmmmmmma...a" + /* 11 */ "mmmmmmmmmaaa...a" + /* 12 */ "mmmm...........a" + /* 13 */ "mmmm...........a" + /* 14 */ "mmmm...........a" + /* 15 */ "mmmmmmmmmaaa...a" + + // Level 12 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmm...m" + /* 1 */ "mmmmmmmmmmmm...m" + /* 2 */ "mmmmmmmmmmmm...m" + /* 3 */ "mmmmmmmmmmmm...m" + /* 4 */ "mmmmmmmmmmmm...m" + /* 5 */ "mmmmmmmmmmmm...m" + /* 6 */ "mmmmmmmmmmmm...m" + /* 7 */ "mmmmmmmmmmmm...m" + /* 8 */ "mmmmmmmmmmmm...m" + /* 9 */ "mmmmmmmmmmmm...m" + /* 10 */ "mmmmmmmmmmmm...m" + /* 11 */ "mmmmmmmmmmmm...m" + /* 12 */ "mmmmmm.........m" + /* 13 */ "mmmmmm.........m" + /* 14 */ "mmmmmm.........m" + /* 15 */ "mmmmmmmmmmmm...m" + + // Level 13 + /* z\x* 111111 */ + /* * 0123456789012345 */ + /* 0 */ "mmmmmmmmmmmm...m" + /* 1 */ "mmmmmmmmmmmm...m" + /* 2 */ "mmmmmmmmmmmm...m" + /* 3 */ "mmmmmmmmmmmm...m" + /* 4 */ "mmmmmmmmmmmm...m" + /* 5 */ "mmmmmmmmmmmm...m" + /* 6 */ "mmmmmmmmmmmm...m" + /* 7 */ "mmmmmmmmmmmm...m" + /* 8 */ "mmmmmmmmmmmm...m" + /* 9 */ "mmmmmmmmmmmm...m" + /* 10 */ "mmmmmmmmmmmm...m" + /* 11 */ "mmmmmmmmmmmm...m" + /* 12 */ "mmmmmmmm.......m" + /* 13 */ "mmmmmmmm.......m" + /* 14 */ "mmmmmmmm.......m" + /* 15 */ "mmmmmmmmmmmm...m", + + // Connectors: + "0: 13, 11, 0: 2\n" /* Type 0, direction Z- */ + "0: 13, 11, 15: 3\n" /* Type 0, direction Z+ */ + "0: 0, 5, 2: 4\n" /* Type 0, direction X- */ + "0: 15, 5, 2: 5\n" /* Type 0, direction X+ */, + + // AllowedRotations: + 7, /* 1, 2, 3 CCW rotation allowed */ + + // Merge strategy: + cBlockArea::msSpongePrint, + + // ShouldExtendFloor: + true, + + // DefaultWeight: + 100, + + // DepthWeight: + "", + + // AddWeightIfSame: + 0, + + // MoveToGround: + false, + }, // SlabbedBridgeStairs + + + //////////////////////////////////////////////////////////////////////////////// // StairsToOpen1: // The data has been exported from the gallery Nether, area index 27, ID 277, created by Aloe_vera -- cgit v1.2.3 From 50fc1a54699b437aa7f5fccc22f594707d31238d Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 27 Jul 2014 11:59:54 +0200 Subject: NetherClumpFoliage: Fixed assert --- src/Generating/FinishGen.cpp | 47 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 4c40270e8..03137f616 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -91,19 +91,50 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a { bool IsFireBlock = a_Block == E_BLOCK_FIRE; - for (int x = a_RelX - 4; x < a_RelX + 4; x++) + int MinX = a_RelX - 4; + if (MinX < 0) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MinX = 0; + } + + int MaxX = a_RelX + 4; + if (MaxX > cChunkDef::Width) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MaxX = cChunkDef::Width; + } + + int MinZ = a_RelZ - 4; + if (MinZ < 0) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MinZ = 0; + } + + int MaxZ = a_RelZ + 4; + if (MaxZ > cChunkDef::Width) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MaxZ = cChunkDef::Width; + } + + int MinY = a_RelY - 2; + if (MinY < 0) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MinY = 0; + } + + int MaxY = a_RelY + 2; + if (MaxY > cChunkDef::Height) // Check if the coordinate is outside the chunk. If it it then adjust it. + { + MaxY = cChunkDef::Height; + } + + for (int x = MinX; x < MaxX; x++) { int xx = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x; - for (int z = a_RelZ - 4; z < a_RelZ + 4; z++) + for (int z = MinZ; z < MaxZ; z++) { int zz = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z; - for (int y = a_RelY - 2; y < a_RelY + 2; y++) + for (int y = MinY; y < MaxY; y++) { - if ((y < 1) || (y > cChunkDef::Height)) - { - continue; - } - if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) // Don't replace non air blocks. { continue; -- cgit v1.2.3 From fe7018bd005adb8dadf849bd988696d638919f23 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 27 Jul 2014 13:12:45 +0200 Subject: Added a ceiling to disguise the bedrock above it. --- src/Generating/CompoGen.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index faf2ac243..655d629b7 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -628,7 +628,15 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) { a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - a_ChunkDesc.SetBlockType(x, a_ChunkDesc.GetHeight(x, z), z, E_BLOCK_BEDROCK); + + int Height = a_ChunkDesc.GetHeight(x, z); + a_ChunkDesc.SetBlockType(x, Height, z, E_BLOCK_BEDROCK); + int CeilingDisguiseHeight = Height - 2 - (m_Noise1.IntNoise2DInt(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x, a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z) % 3); + + for (int y = Height - 1; y > CeilingDisguiseHeight; y--) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_NETHERRACK); + } } } -- cgit v1.2.3 From bfad1be567ac4fd2393398f52c615496422a67f8 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 27 Jul 2014 14:03:23 +0200 Subject: Made nether ceiling smooth. --- src/Generating/CompoGen.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index 655d629b7..87557afa0 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -631,7 +631,14 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) int Height = a_ChunkDesc.GetHeight(x, z); a_ChunkDesc.SetBlockType(x, Height, z, E_BLOCK_BEDROCK); - int CeilingDisguiseHeight = Height - 2 - (m_Noise1.IntNoise2DInt(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x, a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z) % 3); + // int CeilingDisguiseHeight = Height - 2 - (m_Noise1.IntNoise2DInt(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x, a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z) % 3); + NOISE_DATATYPE CeilingDisguise = (m_Noise1.CubicNoise2D((float)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x) / 10, (float)(a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z) / 10)); + if (CeilingDisguise < 0) + { + CeilingDisguise = -CeilingDisguise; + } + + int CeilingDisguiseHeight = Height - 2 - CeilingDisguise * 3; for (int y = Height - 1; y > CeilingDisguiseHeight; y--) { -- cgit v1.2.3 From 3addd4890c8e09a561b93e84b542a2ab08ee0496 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 27 Jul 2014 14:04:34 +0200 Subject: Removed forgotten comment --- src/Generating/CompoGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp index 87557afa0..912d74248 100644 --- a/src/Generating/CompoGen.cpp +++ b/src/Generating/CompoGen.cpp @@ -631,7 +631,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) int Height = a_ChunkDesc.GetHeight(x, z); a_ChunkDesc.SetBlockType(x, Height, z, E_BLOCK_BEDROCK); - // int CeilingDisguiseHeight = Height - 2 - (m_Noise1.IntNoise2DInt(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x, a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z) % 3); + NOISE_DATATYPE CeilingDisguise = (m_Noise1.CubicNoise2D((float)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x) / 10, (float)(a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z) / 10)); if (CeilingDisguise < 0) { -- cgit v1.2.3 From 003f0e69a9fb8a6d617f498b238543c903cff313 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 27 Jul 2014 20:04:09 +0200 Subject: Updated NetherForts' weights. --- src/Generating/Prefabs/NetherFortPrefabs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Generating/Prefabs/NetherFortPrefabs.cpp b/src/Generating/Prefabs/NetherFortPrefabs.cpp index fb0e93daa..a3e3da158 100644 --- a/src/Generating/Prefabs/NetherFortPrefabs.cpp +++ b/src/Generating/Prefabs/NetherFortPrefabs.cpp @@ -1773,7 +1773,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] = true, // DefaultWeight: - 100, + 20, // DepthWeight: "", @@ -5015,7 +5015,7 @@ const cPrefab::sDef g_NetherFortPrefabs[] = true, // DefaultWeight: - 100, + 20, // DepthWeight: "", -- cgit v1.2.3 From d61f1d0f4a1565d4de7e8100d9bf766d6fd458d1 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 27 Jul 2014 20:48:39 +0200 Subject: NetherClumpGenerator: Fixed generating stuff on halfslabs and fences --- src/Generating/FinishGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 03137f616..9f0c8f3fa 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -141,7 +141,7 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a } BLOCKTYPE BlockBelow = a_ChunkDesc.GetBlockType(x, y - 1, z); - if (!cBlockInfo::IsSolid(BlockBelow)) // Only place on solid blocks + if (!cBlockInfo::FullyOccupiesVoxel(BlockBelow)) // Only place on solid blocks { continue; } -- cgit v1.2.3 From fd4ee20b2a927649b4671be95dccc8644c96e5ab Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 27 Jul 2014 23:15:51 +0200 Subject: Hotfixed compilation problems. --- src/Items/ItemHandler.cpp | 2 +- src/Items/ItemSword.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index ec86648b3..d36b5d663 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -366,7 +366,7 @@ void cItemHandler::OnFoodEaten(cWorld * a_World, cPlayer * a_Player, cItem * a_I short cItemHandler::GetDurabilityLossByAction(eDurabilityLostAction a_Action) { - switch (a_Action) + switch ((int)a_Action) { case dlaAttackEntity: return 2; case dlaBreakBlock: return 1; diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index b90965535..2b2dbfc0d 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -46,7 +46,7 @@ public: virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override { - switch (a_Action) + switch ((int)a_Action) { case dlaAttackEntity: return 1; case dlaBreakBlock: return 2; -- cgit v1.2.3 From 5b69b2ce4faf5a14e6ab5d5974b790d2bd751a95 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Mon, 28 Jul 2014 12:30:16 +0200 Subject: DistortedHeightmap: Now generates gravel in deep ocean. --- src/Generating/DistortedHeightmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp index 1337896ab..c18c402da 100644 --- a/src/Generating/DistortedHeightmap.cpp +++ b/src/Generating/DistortedHeightmap.cpp @@ -809,7 +809,7 @@ void cDistortedHeightmap::FillColumnPattern(cChunkDesc & a_ChunkDesc, int a_RelX } // Select the ocean-floor pattern to use: - a_Pattern = ChooseOceanFloorPattern(a_RelX, a_RelZ); + a_Pattern = a_ChunkDesc.GetBiome(a_RelX, a_RelZ) == biDeepOcean ? patGravel.Get() : ChooseOceanFloorPattern(a_RelX, a_RelZ); HasHadWater = true; } // for y a_ChunkDesc.SetBlockType(a_RelX, 0, a_RelZ, E_BLOCK_BEDROCK); -- cgit v1.2.3