From 53e22b11857fed62e2313d6d84d90f88ed412ffb Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Mon, 29 Jul 2013 12:13:03 +0100 Subject: Changed everyting to Unix line endings. --- source/BlockEntities/BlockEntityWithItems.h | 172 ++++++++++++++-------------- 1 file changed, 86 insertions(+), 86 deletions(-) (limited to 'source/BlockEntities/BlockEntityWithItems.h') diff --git a/source/BlockEntities/BlockEntityWithItems.h b/source/BlockEntities/BlockEntityWithItems.h index 587b10461..0846ae17e 100644 --- a/source/BlockEntities/BlockEntityWithItems.h +++ b/source/BlockEntities/BlockEntityWithItems.h @@ -1,86 +1,86 @@ - -// BlockEntityWithItems.h - -// Declares the cBlockEntityWithItems class representing a common ancestor for all block entities that have an ItemGrid - - - - - -#pragma once - -#include "BlockEntity.h" -#include "../ItemGrid.h" - - - - - -// tolua_begin -class cBlockEntityWithItems : - public cBlockEntity - // tolua_end - // tolua doesn't seem to support multiple inheritance? - , public cItemGrid::cListener - // tolua_begin -{ - typedef cBlockEntity super; - -public: - // tolua_end - - cBlockEntityWithItems( - BLOCKTYPE a_BlockType, // Type of the block that the entity represents - int a_BlockX, int a_BlockY, int a_BlockZ, // Position of the block entity - int a_ItemGridWidth, int a_ItemGridHeight, // Dimensions of the ItemGrid - cWorld * a_World // Optional world to assign to the entity - ) : - super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World), - m_Contents(a_ItemGridWidth, a_ItemGridHeight) - { - m_Contents.AddListener(*this); - } - - virtual void Destroy(void) override - { - // Drop the contents as pickups: - ASSERT(m_World != NULL); - cItems Pickups; - m_Contents.CopyToItems(Pickups); - m_Contents.Clear(); - m_World->SpawnItemPickups(Pickups, m_PosX, m_PosY, m_PosZ); - } - - // tolua_begin - - const cItem & GetSlot(int a_SlotNum) const { return m_Contents.GetSlot(a_SlotNum); } - const cItem & GetSlot(int a_X, int a_Y) const { return m_Contents.GetSlot(a_X, a_Y); } - - void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); } - void SetSlot(int a_X, int a_Y, const cItem & a_Item) { m_Contents.SetSlot(a_X, a_Y, a_Item); } - - /// Returns the ItemGrid used for storing the contents - cItemGrid & GetContents(void) { return m_Contents; } - - // tolua_end - - /// Const version of the GetContents() function for C++ type-safety - const cItemGrid & GetContents(void) const { return m_Contents; } - -protected: - cItemGrid m_Contents; - - // cItemGrid::cListener overrides: - virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) - { - ASSERT(a_Grid == &m_Contents); - if (m_World != NULL) - { - m_World->MarkChunkDirty(GetChunkX(), GetChunkZ()); - } - } -} ; // tolua_export - - - - + +// BlockEntityWithItems.h + +// Declares the cBlockEntityWithItems class representing a common ancestor for all block entities that have an ItemGrid + + + + + +#pragma once + +#include "BlockEntity.h" +#include "../ItemGrid.h" + + + + + +// tolua_begin +class cBlockEntityWithItems : + public cBlockEntity + // tolua_end + // tolua doesn't seem to support multiple inheritance? + , public cItemGrid::cListener + // tolua_begin +{ + typedef cBlockEntity super; + +public: + // tolua_end + + cBlockEntityWithItems( + BLOCKTYPE a_BlockType, // Type of the block that the entity represents + int a_BlockX, int a_BlockY, int a_BlockZ, // Position of the block entity + int a_ItemGridWidth, int a_ItemGridHeight, // Dimensions of the ItemGrid + cWorld * a_World // Optional world to assign to the entity + ) : + super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World), + m_Contents(a_ItemGridWidth, a_ItemGridHeight) + { + m_Contents.AddListener(*this); + } + + virtual void Destroy(void) override + { + // Drop the contents as pickups: + ASSERT(m_World != NULL); + cItems Pickups; + m_Contents.CopyToItems(Pickups); + m_Contents.Clear(); + m_World->SpawnItemPickups(Pickups, m_PosX, m_PosY, m_PosZ); + } + + // tolua_begin + + const cItem & GetSlot(int a_SlotNum) const { return m_Contents.GetSlot(a_SlotNum); } + const cItem & GetSlot(int a_X, int a_Y) const { return m_Contents.GetSlot(a_X, a_Y); } + + void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); } + void SetSlot(int a_X, int a_Y, const cItem & a_Item) { m_Contents.SetSlot(a_X, a_Y, a_Item); } + + /// Returns the ItemGrid used for storing the contents + cItemGrid & GetContents(void) { return m_Contents; } + + // tolua_end + + /// Const version of the GetContents() function for C++ type-safety + const cItemGrid & GetContents(void) const { return m_Contents; } + +protected: + cItemGrid m_Contents; + + // cItemGrid::cListener overrides: + virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) + { + ASSERT(a_Grid == &m_Contents); + if (m_World != NULL) + { + m_World->MarkChunkDirty(GetChunkX(), GetChunkZ()); + } + } +} ; // tolua_export + + + + -- cgit v1.2.3