summaryrefslogtreecommitdiffstats
path: root/src/Items
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items')
-rw-r--r--src/Items/CMakeLists.txt4
-rw-r--r--src/Items/ItemBow.h11
-rw-r--r--src/Items/ItemBucket.h20
-rw-r--r--src/Items/ItemEmptyMap.h2
-rw-r--r--src/Items/ItemMushroomSoup.h2
5 files changed, 32 insertions, 7 deletions
diff --git a/src/Items/CMakeLists.txt b/src/Items/CMakeLists.txt
index c50ddb372..71f2d9ceb 100644
--- a/src/Items/CMakeLists.txt
+++ b/src/Items/CMakeLists.txt
@@ -56,6 +56,10 @@ SET (HDRS
ItemThrowable.h
)
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set_source_files_properties(ItemHandler.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=old-style-cast -Wno-error=switch-enum")
+endif()
+
if(NOT MSVC)
add_library(Items ${SRCS} ${HDRS})
endif()
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h
index 5164ddf59..8bbaa3d8c 100644
--- a/src/Items/ItemBow.h
+++ b/src/Items/ItemBow.h
@@ -53,7 +53,7 @@ public:
ASSERT(a_Player != nullptr);
int BowCharge = a_Player->FinishChargingBow();
- double Force = (double)BowCharge / 20.0;
+ double Force = static_cast<double>(BowCharge) / 20.0;
Force = (Force * Force + 2.0 * Force) / 3.0; // This formula is used by the 1.6.2 client
if (Force < 0.1)
{
@@ -80,7 +80,14 @@ public:
Arrow = nullptr;
return;
}
- a_Player->GetWorld()->BroadcastSoundEffect("random.bow", a_Player->GetPosX(), a_Player->GetPosY(), a_Player->GetPosZ(), 0.5, (float)Force);
+ a_Player->GetWorld()->BroadcastSoundEffect(
+ "random.bow",
+ a_Player->GetPosX(),
+ a_Player->GetPosY(),
+ a_Player->GetPosZ(),
+ 0.5,
+ static_cast<float>(Force)
+ );
if (!a_Player->IsGameModeCreative())
{
if (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchInfinity) == 0)
diff --git a/src/Items/ItemBucket.h b/src/Items/ItemBucket.h
index 015720415..4d39bde82 100644
--- a/src/Items/ItemBucket.h
+++ b/src/Items/ItemBucket.h
@@ -80,6 +80,13 @@ public:
return false;
}
+ // Check to see if destination block is too far away
+ // Reach Distance Multiplayer = 5 Blocks
+ if ((BlockPos.x - a_Player->GetPosX() > 5) || (BlockPos.z - a_Player->GetPosZ() > 5))
+ {
+ return false;
+ }
+
// Remove water / lava block (unless plugins disagree)
if (!a_Player->PlaceBlock(BlockPos.x, BlockPos.y, BlockPos.z, E_BLOCK_AIR, 0))
{
@@ -96,7 +103,7 @@ public:
ASSERT(!"Inventory bucket mismatch");
return true;
}
- if (a_Player->GetInventory().AddItem(cItem(NewItem), true, true) != 1)
+ if (a_Player->GetInventory().AddItem(cItem(NewItem)) != 1)
{
// The bucket didn't fit, toss it as a pickup:
a_Player->TossPickup(cItem(NewItem));
@@ -126,6 +133,13 @@ public:
{
return false;
}
+
+ // Check to see if destination block is too far away
+ // Reach Distance Multiplayer = 5 Blocks
+ if ((BlockPos.x - a_Player->GetPosX() > 5) || (BlockPos.z - a_Player->GetPosZ() > 5))
+ {
+ return false;
+ }
if (a_Player->GetGameMode() != gmCreative)
{
@@ -137,7 +151,7 @@ public:
return false;
}
cItem Item(E_ITEM_BUCKET, 1);
- if (!a_Player->GetInventory().AddItem(Item, true, true))
+ if (!a_Player->GetInventory().AddItem(Item))
{
return false;
}
@@ -236,7 +250,7 @@ public:
m_EntryFace = static_cast<eBlockFace>(a_CBEntryFace);
if (!cFluidSimulator::CanWashAway(a_CBBlockType) && !IsBlockLiquid(a_CBBlockType))
{
- AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, (eBlockFace)a_CBEntryFace); // Was an unwashawayable block, can't overwrite it!
+ AddFaceDirection(a_CBBlockX, a_CBBlockY, a_CBBlockZ, static_cast<eBlockFace>(a_CBEntryFace)); // Was an unwashawayable block, can't overwrite it!
}
m_Pos.Set(a_CBBlockX, a_CBBlockY, a_CBBlockZ); // (Block could be washed away, replace it)
return true; // Abort tracing
diff --git a/src/Items/ItemEmptyMap.h b/src/Items/ItemEmptyMap.h
index 6e944b4da..fba8c0a2c 100644
--- a/src/Items/ItemEmptyMap.h
+++ b/src/Items/ItemEmptyMap.h
@@ -60,7 +60,7 @@ public:
return true;
}
- a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, (short)(NewMap->GetID() & 0x7fff)), true, true);
+ a_Player->GetInventory().AddItem(cItem(E_ITEM_MAP, 1, (short)(NewMap->GetID() & 0x7fff)));
return true;
}
diff --git a/src/Items/ItemMushroomSoup.h b/src/Items/ItemMushroomSoup.h
index dba313ec5..1a761cbf1 100644
--- a/src/Items/ItemMushroomSoup.h
+++ b/src/Items/ItemMushroomSoup.h
@@ -41,7 +41,7 @@ public:
// Return a bowl to the inventory
if (!a_Player->IsGameModeCreative())
{
- a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL), true, true);
+ a_Player->GetInventory().AddItem(cItem(E_ITEM_BOWL));
}
return true;
}