summaryrefslogtreecommitdiffstats
path: root/source/Items/ItemHandler.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-30 14:24:03 +0200
committermadmaxoft <github@xoft.cz>2013-08-30 14:24:03 +0200
commit17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32 (patch)
treefeaaf5bf652bfdc542dee9b9c452391531aee6ba /source/Items/ItemHandler.cpp
parentImplemented basic physics for projectiles. (diff)
downloadcuberite-17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32.tar
cuberite-17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32.tar.gz
cuberite-17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32.tar.bz2
cuberite-17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32.tar.lz
cuberite-17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32.tar.xz
cuberite-17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32.tar.zst
cuberite-17ad4c2610f2c33d5b4a8b42b7d4b8fbda9ade32.zip
Diffstat (limited to '')
-rw-r--r--source/Items/ItemHandler.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/source/Items/ItemHandler.cpp b/source/Items/ItemHandler.cpp
index 66d36e1a6..c0de4a6ec 100644
--- a/source/Items/ItemHandler.cpp
+++ b/source/Items/ItemHandler.cpp
@@ -8,6 +8,7 @@
// Handlers:
#include "ItemBed.h"
+#include "ItemBow.h"
#include "ItemBrewingStand.h"
#include "ItemBucket.h"
#include "ItemCauldron.h"
@@ -47,18 +48,24 @@ cItemHandler * cItemHandler::m_ItemHandler[2268];
-cItemHandler *cItemHandler::GetItemHandler(int a_ItemType)
+cItemHandler * cItemHandler::GetItemHandler(int a_ItemType)
{
- if(a_ItemType < 0) a_ItemType = 0;
+ if (a_ItemType < 0)
+ {
+ ASSERT(!"Bad item type");
+ a_ItemType = 0;
+ }
- if(!m_HandlerInitialized)
- { //We have to initialize
+ if (!m_HandlerInitialized)
+ {
+ // We need to initialize
memset(m_ItemHandler, 0, sizeof(m_ItemHandler));
m_HandlerInitialized = true;
}
- if(m_ItemHandler[a_ItemType])
- return m_ItemHandler[a_ItemType];
- m_ItemHandler[a_ItemType] = CreateItemHandler(a_ItemType);
+ if (m_ItemHandler[a_ItemType] == NULL)
+ {
+ m_ItemHandler[a_ItemType] = CreateItemHandler(a_ItemType);
+ }
return m_ItemHandler[a_ItemType];
}
@@ -77,6 +84,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_BLOCK_SAPLING: return new cItemSaplingHandler(a_ItemType);
case E_BLOCK_WOOL: return new cItemClothHandler(a_ItemType);
case E_ITEM_BED: return new cItemBedHandler(a_ItemType);
+ case E_ITEM_BOW: return new cItemBowHandler;
case E_ITEM_BREWING_STAND: return new cItemBrewingStandHandler(a_ItemType);
case E_ITEM_CAULDRON: return new cItemCauldronHandler(a_ItemType);
case E_ITEM_DYE: return new cItemDyeHandler(a_ItemType);