summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-06 21:39:42 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-06 21:39:42 +0100
commite2a557f46cb564caadd750114dd4a0e8225b9b4e (patch)
treefbe890e3f4c3e5863d6fd4d3d56aa92e4785c582 /src/World.cpp
parentRe-implemented redstone duplicate checking (diff)
downloadcuberite-e2a557f46cb564caadd750114dd4a0e8225b9b4e.tar
cuberite-e2a557f46cb564caadd750114dd4a0e8225b9b4e.tar.gz
cuberite-e2a557f46cb564caadd750114dd4a0e8225b9b4e.tar.bz2
cuberite-e2a557f46cb564caadd750114dd4a0e8225b9b4e.tar.lz
cuberite-e2a557f46cb564caadd750114dd4a0e8225b9b4e.tar.xz
cuberite-e2a557f46cb564caadd750114dd4a0e8225b9b4e.tar.zst
cuberite-e2a557f46cb564caadd750114dd4a0e8225b9b4e.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 7982924ae..04eab1851 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -1585,6 +1585,12 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
a_FlyAwaySpeed /= 1000; // Pre-divide, so that we don't have to divide each time inside the loop
for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
{
+ if (!IsValidItem(itr->m_ItemType))
+ {
+ // Don't spawn pickup if item isn't even valid; should prevent client crashing too
+ continue;
+ }
+
float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
float SpeedY = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500));
@@ -1605,6 +1611,11 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
{
for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr)
{
+ if (!IsValidItem(itr->m_ItemType))
+ {
+ continue;
+ }
+
cPickup * Pickup = new cPickup(
a_BlockX, a_BlockY, a_BlockZ,
*itr, IsPlayerCreated, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ