summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-04 09:56:57 +0200
committermadmaxoft <github@xoft.cz>2014-04-04 09:56:57 +0200
commit402d85d896c793644681c4bb2934a7e0abb5ed8c (patch)
tree1cf3fa3d08cf88829695f8d063e3132be3f9e9b9 /src/Items
parentProtoProxy: Fixed a few Clang and MSVC warnings. (diff)
downloadcuberite-402d85d896c793644681c4bb2934a7e0abb5ed8c.tar
cuberite-402d85d896c793644681c4bb2934a7e0abb5ed8c.tar.gz
cuberite-402d85d896c793644681c4bb2934a7e0abb5ed8c.tar.bz2
cuberite-402d85d896c793644681c4bb2934a7e0abb5ed8c.tar.lz
cuberite-402d85d896c793644681c4bb2934a7e0abb5ed8c.tar.xz
cuberite-402d85d896c793644681c4bb2934a7e0abb5ed8c.tar.zst
cuberite-402d85d896c793644681c4bb2934a7e0abb5ed8c.zip
Diffstat (limited to 'src/Items')
-rw-r--r--src/Items/ItemEmptyMap.h2
-rw-r--r--src/Items/ItemFishingRod.h4
-rw-r--r--src/Items/ItemHandler.cpp6
-rw-r--r--src/Items/ItemLilypad.h23
-rw-r--r--src/Items/ItemMap.h2
5 files changed, 19 insertions, 18 deletions
diff --git a/src/Items/ItemEmptyMap.h b/src/Items/ItemEmptyMap.h
index f0b1e1424..953673382 100644
--- a/src/Items/ItemEmptyMap.h
+++ b/src/Items/ItemEmptyMap.h
@@ -55,7 +55,7 @@ public:
return true;
}
- a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, NewMap->GetID()), true, true);
+ a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, (short)(NewMap->GetID() & 0x7fff)), true, true);
return true;
}
diff --git a/src/Items/ItemFishingRod.h b/src/Items/ItemFishingRod.h
index 15acbd9fe..0431b88b7 100644
--- a/src/Items/ItemFishingRod.h
+++ b/src/Items/ItemFishingRod.h
@@ -123,7 +123,7 @@ public:
}
case 2:
{
- Drops.Add(cItem(E_ITEM_FISHING_ROD, 1, a_World->GetTickRandomNumber(50))); // Fishing rod with durability. TODO: Enchantments on it
+ Drops.Add(cItem(E_ITEM_FISHING_ROD, 1, (short)a_World->GetTickRandomNumber(50))); // Fishing rod with durability. TODO: Enchantments on it
break;
}
case 3:
@@ -152,7 +152,7 @@ public:
}
else if (Junk <= 4)
{
- Drops.Add(cItem(E_ITEM_BOW, 1, a_World->GetTickRandomNumber(64)));
+ Drops.Add(cItem(E_ITEM_BOW, 1, (short)a_World->GetTickRandomNumber(64)));
}
else if (Junk <= 9)
{
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 337b3a83c..1e77717e3 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -506,13 +506,13 @@ bool cItemHandler::GetPlacementBlockTypeMeta(
{
ASSERT(m_ItemType < 256); // Items with IDs above 255 should all be handled by specific handlers
- if (m_ItemType > 256)
+ if (m_ItemType >= 256)
{
- LOGERROR("%s: Item %d has no valid block!", __FUNCTION__, m_ItemType);
+ LOGERROR("%s: Item %d is not eligible for direct block placement!", __FUNCTION__, m_ItemType);
return false;
}
- cBlockHandler * BlockH = BlockHandler(m_ItemType);
+ cBlockHandler * BlockH = BlockHandler((BLOCKTYPE)m_ItemType);
cChunkInterface ChunkInterface(a_World->GetChunkMap());
return BlockH->GetPlacementBlockTypeMeta(
ChunkInterface, a_Player,
diff --git a/src/Items/ItemLilypad.h b/src/Items/ItemLilypad.h
index 5a29abe94..8fc1d8543 100644
--- a/src/Items/ItemLilypad.h
+++ b/src/Items/ItemLilypad.h
@@ -16,17 +16,19 @@ class cItemLilypadHandler :
typedef cItemHandler super;
public:
- cItemLilypadHandler(BLOCKTYPE a_BlockType)
- : cItemHandler(a_BlockType)
+ cItemLilypadHandler(int a_ItemType):
+ super(a_ItemType)
{
}
+
virtual bool IsPlaceable(void) override
{
return false; // Set as not placeable so OnItemUse is called
}
+
virtual bool OnItemUse(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
{
if (a_BlockFace > BLOCK_FACE_NONE)
@@ -45,23 +47,22 @@ public:
public cBlockTracer::cCallbacks
{
public:
- cCallbacks(cWorld * a_World) :
+ cCallbacks(cWorld * a_CBWorld) :
m_HasHitFluid(false),
- m_World(a_World)
+ m_World(a_CBWorld)
{
}
- virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override
+ virtual bool OnNextBlock(int a_CBBlockX, int a_CBBlockY, int a_CBBlockZ, BLOCKTYPE a_CBBlockType, NIBBLETYPE a_CBBlockMeta, char a_CBEntryFace) override
{
- if (IsBlockWater(a_BlockType))
+ if (IsBlockWater(a_CBBlockType))
{
- if ((a_BlockMeta != 0) || (a_EntryFace == BLOCK_FACE_NONE)) // The hit block should be a source. The FACE_NONE check is clicking whilst submerged
+ if ((a_CBBlockMeta != 0) || (a_CBEntryFace == BLOCK_FACE_NONE)) // The hit block should be a source. The FACE_NONE check is clicking whilst submerged
{
return false;
}
- a_EntryFace = BLOCK_FACE_YP; // Always place pad at top of water block
- AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, (eBlockFace)a_EntryFace);
- BLOCKTYPE Block = m_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
+ AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, BLOCK_FACE_YP); // Always place pad at top of water block
+ BLOCKTYPE Block = m_World->GetBlock(a_CBBlockX, a_CBBlockY, a_CBBlockZ);
if (
!IsBlockWater(Block) &&
cBlockInfo::FullyOccupiesVoxel(Block)
@@ -71,7 +72,7 @@ public:
return true;
}
m_HasHitFluid = true;
- m_Pos.Set(a_BlockX, a_BlockY, a_BlockZ);
+ m_Pos.Set(a_CBBlockX, a_CBBlockY, a_CBBlockZ);
return true;
}
return false;
diff --git a/src/Items/ItemMap.h b/src/Items/ItemMap.h
index e8ff9da88..056fe0fe7 100644
--- a/src/Items/ItemMap.h
+++ b/src/Items/ItemMap.h
@@ -29,7 +29,7 @@ public:
virtual void OnUpdate(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item)
{
- cMap * Map = a_World->GetMapManager().GetMapData(a_Item.m_ItemDamage);
+ cMap * Map = a_World->GetMapManager().GetMapData((unsigned)a_Item.m_ItemDamage);
if (Map == NULL)
{