summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-07-13 16:48:13 +0200
committerMattes D <github@xoft.cz>2014-07-13 16:48:13 +0200
commit760fe6b99d63e99ff7468312852a51b5c4545eb2 (patch)
tree30c62bd1f4e1f95bc06ef5f2b833f3327b540ec5
parentFixed MSVC warnings in SoundEffect functions. (diff)
parentAdjusted calls to CreateProjectile that passed Items (diff)
downloadcuberite-760fe6b99d63e99ff7468312852a51b5c4545eb2.tar
cuberite-760fe6b99d63e99ff7468312852a51b5c4545eb2.tar.gz
cuberite-760fe6b99d63e99ff7468312852a51b5c4545eb2.tar.bz2
cuberite-760fe6b99d63e99ff7468312852a51b5c4545eb2.tar.lz
cuberite-760fe6b99d63e99ff7468312852a51b5c4545eb2.tar.xz
cuberite-760fe6b99d63e99ff7468312852a51b5c4545eb2.tar.zst
cuberite-760fe6b99d63e99ff7468312852a51b5c4545eb2.zip
Diffstat (limited to '')
m---------lib/polarssl0
-rw-r--r--src/Entities/ProjectileEntity.cpp7
-rw-r--r--src/Entities/ProjectileEntity.h2
-rw-r--r--src/Items/ItemThrowable.h4
-rw-r--r--src/World.cpp2
-rw-r--r--src/World.h2
6 files changed, 9 insertions, 8 deletions
diff --git a/lib/polarssl b/lib/polarssl
-Subproject 1ed82759c68f92c4acc7e3f33b850cf9f01c8ab
+Subproject 784b04ff9afd5faeaeb15c3fa159ff98adf5518
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index 0bb34019e..b5ef5c90a 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -243,7 +243,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Ve
-cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item, const Vector3d * a_Speed)
+cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem * a_Item, const Vector3d * a_Speed)
{
Vector3d Speed;
if (a_Speed != NULL)
@@ -262,12 +262,13 @@ cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator,
case pkExpBottle: return new cExpBottleEntity (a_Creator, a_X, a_Y, a_Z, Speed);
case pkFirework:
{
- if (a_Item.m_FireworkItem.m_Colours.empty())
+ ASSERT(a_Item != NULL);
+ if (a_Item->m_FireworkItem.m_Colours.empty())
{
return NULL;
}
- return new cFireworkEntity(a_Creator, a_X, a_Y, a_Z, a_Item);
+ return new cFireworkEntity(a_Creator, a_X, a_Y, a_Z, *a_Item);
}
}
diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h
index 7b38169e2..14cee1272 100644
--- a/src/Entities/ProjectileEntity.h
+++ b/src/Entities/ProjectileEntity.h
@@ -46,7 +46,7 @@ public:
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height);
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height);
- static cProjectileEntity * Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item, const Vector3d * a_Speed = NULL);
+ static cProjectileEntity * Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem * a_Item, const Vector3d * a_Speed = NULL);
/// Called by the physics blocktracer when the entity hits a solid block, the hit position and the face hit (BLOCK_FACE_) is given
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace);
diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h
index fde7b8e67..c151c5d3a 100644
--- a/src/Items/ItemThrowable.h
+++ b/src/Items/ItemThrowable.h
@@ -35,7 +35,7 @@ public:
cFastRandom Random;
a_World->BroadcastSoundEffect("random.bow", a_Player->GetPosX(), a_Player->GetPosY() - a_Player->GetHeight(), a_Player->GetPosZ(), 0.5f, 0.4f / (Random.NextFloat(1.0f) * 0.4f + 0.8f));
- if (a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, m_ProjectileKind, a_Player, a_Player->GetEquippedItem(), &Speed) < 0)
+ if (a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, m_ProjectileKind, a_Player, &a_Player->GetEquippedItem(), &Speed) < 0)
{
return false;
}
@@ -135,7 +135,7 @@ public:
return false;
}
- if (a_World->CreateProjectile(a_BlockX + 0.5, a_BlockY + 1, a_BlockZ + 0.5, m_ProjectileKind, a_Player, a_Player->GetEquippedItem()) < 0)
+ if (a_World->CreateProjectile(a_BlockX + 0.5, a_BlockY + 1, a_BlockZ + 0.5, m_ProjectileKind, a_Player, &a_Player->GetEquippedItem()) < 0)
{
return false;
}
diff --git a/src/World.cpp b/src/World.cpp
index 46a193d4f..ba8add8f0 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2998,7 +2998,7 @@ int cWorld::SpawnMobFinalize(cMonster * a_Monster)
-int cWorld::CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem & a_Item, const Vector3d * a_Speed)
+int cWorld::CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem * a_Item, const Vector3d * a_Speed)
{
cProjectileEntity * Projectile = cProjectileEntity::Create(a_Kind, a_Creator, a_PosX, a_PosY, a_PosZ, a_Item, a_Speed);
if (Projectile == NULL)
diff --git a/src/World.h b/src/World.h
index be055f004..5bb0e640f 100644
--- a/src/World.h
+++ b/src/World.h
@@ -751,7 +751,7 @@ public:
/** Creates a projectile of the specified type. Returns the projectile's EntityID if successful, <0 otherwise
Item parameter used currently for Fireworks to correctly set entity metadata based on item metadata
*/
- int CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem & a_Item, const Vector3d * a_Speed = NULL); // tolua_export
+ int CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const cItem * a_Item, const Vector3d * a_Speed = NULL); // tolua_export
/** Returns a random number from the m_TickRand in range [0 .. a_Range]. To be used only in the tick thread! */
int GetTickRandomNumber(unsigned a_Range) { return (int)(m_TickRand.randInt(a_Range)); }