From 69107bd54fb4b9dc273d16e4073e4861245d2331 Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Thu, 27 Dec 2012 15:07:12 +0000 Subject: Fixed slab usage in creative mode git-svn-id: http://mc-server.googlecode.com/svn/trunk@1112 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Chunk.h | 4 ++-- source/ChunkMap.h | 4 ++-- source/Items/ItemSlab.h | 14 +++++++++++--- source/World.h | 4 ++-- 4 files changed, 17 insertions(+), 9 deletions(-) (limited to 'source') diff --git a/source/Chunk.h b/source/Chunk.h index b5dfd380d..04f634b5b 100644 --- a/source/Chunk.h +++ b/source/Chunk.h @@ -169,7 +169,7 @@ public: bool ForEachChest(cChestCallback & a_Callback); // Lua-accessible /// Calls the callback for each dispenser; returns true if all dispensers processed, false if the callback aborted by returning true - bool ForEachDispenser(cDispenserCallback & a_Callback); // Lua-accessible + bool ForEachDispenser(cDispenserCallback & a_Callback); /// Calls the callback for each furnace; returns true if all furnaces processed, false if the callback aborted by returning true bool ForEachFurnace(cFurnaceCallback & a_Callback); // Lua-accessible @@ -178,7 +178,7 @@ public: bool DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Lua-acessible /// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords, true if found - bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Lua-accessible + bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); /// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords, true if found bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Lua-accessible diff --git a/source/ChunkMap.h b/source/ChunkMap.h index ba037444a..12c6e7275 100644 --- a/source/ChunkMap.h +++ b/source/ChunkMap.h @@ -185,7 +185,7 @@ public: bool ForEachChestInChunk (int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback); // Lua-accessible /// Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true - bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback); // Lua-accessible + bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback); /// Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true bool ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback); // Lua-accessible @@ -194,7 +194,7 @@ public: bool DoWithChestAt (int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Lua-acessible /// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords, true if found - bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Lua-accessible + bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); /// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords, true if found bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Lua-accessible diff --git a/source/Items/ItemSlab.h b/source/Items/ItemSlab.h index 36779138b..174beae22 100644 --- a/source/Items/ItemSlab.h +++ b/source/Items/ItemSlab.h @@ -29,12 +29,20 @@ public: && (Block == a_Item->m_ItemType) // Same slab && ((Meta & 0x7) == (a_Item->m_ItemHealth & 0x7))) // Same Texture { - cItem Item(a_Item->m_ItemType, 1); - if (a_Player->GetInventory().RemoveItem(Item)) + if(a_Player->GetGameMode() == eGameMode_Creative) { - a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, Block - 1, Meta); // Block - 1 simple hack to save one if statement + a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, Block - 1, Meta); // Block - 1 simple hack to save one if statement return true; } + else + { + cItem Item(a_Item->m_ItemType, 1); + if (a_Player->GetInventory().RemoveItem(Item)) + { + a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, Block - 1, Meta); // Block - 1 simple hack to save one if statement + return true; + } + } } return false; } diff --git a/source/World.h b/source/World.h index cefb9abf2..b7b6b6934 100644 --- a/source/World.h +++ b/source/World.h @@ -319,7 +319,7 @@ public: bool ForEachChestInChunk (int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback); // Exported in ManualBindings.cpp /// Calls the callback for each dispenser in the specified chunk; returns true if all dispensers processed, false if the callback aborted by returning true - bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback); // Exported in ManualBindings.cpp + bool ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback); /// Calls the callback for each furnace in the specified chunk; returns true if all furnaces processed, false if the callback aborted by returning true bool ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback); // Exported in ManualBindings.cpp @@ -328,7 +328,7 @@ public: bool DoWithChestAt (int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback); // Exported in ManualBindings.cpp /// Calls the callback for the dispenser at the specified coords; returns false if there's no dispenser at those coords, true if found - bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); // Exported in ManualBindings.cpp + bool DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback); /// Calls the callback for the furnace at the specified coords; returns false if there's no furnace at those coords, true if found bool DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback); // Exported in ManualBindings.cpp -- cgit v1.2.3