diff options
author | Mattes D <github@xoft.cz> | 2019-09-29 14:59:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-29 14:59:24 +0200 |
commit | 365cbc6e1cea96741e26c9ce912b003f8fd2c62c (patch) | |
tree | f23682c47928597791c53f3a300b03494ffde417 /src/Entities/ProjectileEntity.cpp | |
parent | Cactus can now grow and will be dropped if there is no place to grow. (diff) | |
download | cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.gz cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.bz2 cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.lz cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.xz cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.tar.zst cuberite-365cbc6e1cea96741e26c9ce912b003f8fd2c62c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 4a5da0874..b2148fa2b 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -224,8 +224,8 @@ protected: //////////////////////////////////////////////////////////////////////////////// // cProjectileEntity: -cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height) : - super(etProjectile, a_X, a_Y, a_Z, a_Width, a_Height), +cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, double a_Width, double a_Height): + super(etProjectile, a_Pos, a_Width, a_Height), m_ProjectileKind(a_Kind), m_CreatorData( ((a_Creator != nullptr) ? a_Creator->GetUniqueID() : cEntity::INVALID_ID), @@ -242,8 +242,8 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a -cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height) : - super(etProjectile, a_Pos.x, a_Pos.y, a_Pos.z, a_Width, a_Height), +cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed, double a_Width, double a_Height): + super(etProjectile, a_Pos, a_Width, a_Height), m_ProjectileKind(a_Kind), m_CreatorData(a_Creator->GetUniqueID(), a_Creator->IsPlayer() ? static_cast<cPlayer *>(a_Creator)->GetName() : "", a_Creator->GetEquippedWeapon().m_Enchantments), m_IsInGround(false) @@ -259,7 +259,13 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Ve -std::unique_ptr<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) +std::unique_ptr<cProjectileEntity> cProjectileEntity::Create( + eKind a_Kind, + cEntity * a_Creator, + Vector3d a_Pos, + const cItem * a_Item, + const Vector3d * a_Speed +) { Vector3d Speed; if (a_Speed != nullptr) @@ -269,15 +275,15 @@ std::unique_ptr<cProjectileEntity> cProjectileEntity::Create(eKind a_Kind, cEnti switch (a_Kind) { - case pkArrow: return cpp14::make_unique<cArrowEntity> (a_Creator, a_X, a_Y, a_Z, Speed); - case pkEgg: return cpp14::make_unique<cThrownEggEntity> (a_Creator, a_X, a_Y, a_Z, Speed); - case pkEnderPearl: return cpp14::make_unique<cThrownEnderPearlEntity>(a_Creator, a_X, a_Y, a_Z, Speed); - case pkSnowball: return cpp14::make_unique<cThrownSnowballEntity> (a_Creator, a_X, a_Y, a_Z, Speed); - case pkGhastFireball: return cpp14::make_unique<cGhastFireballEntity> (a_Creator, a_X, a_Y, a_Z, Speed); - case pkFireCharge: return cpp14::make_unique<cFireChargeEntity> (a_Creator, a_X, a_Y, a_Z, Speed); - case pkExpBottle: return cpp14::make_unique<cExpBottleEntity> (a_Creator, a_X, a_Y, a_Z, Speed); - case pkSplashPotion: return cpp14::make_unique<cSplashPotionEntity> (a_Creator, a_X, a_Y, a_Z, Speed, *a_Item); - case pkWitherSkull: return cpp14::make_unique<cWitherSkullEntity> (a_Creator, a_X, a_Y, a_Z, Speed); + case pkArrow: return cpp14::make_unique<cArrowEntity> (a_Creator, a_Pos, Speed); + case pkEgg: return cpp14::make_unique<cThrownEggEntity> (a_Creator, a_Pos, Speed); + case pkEnderPearl: return cpp14::make_unique<cThrownEnderPearlEntity>(a_Creator, a_Pos, Speed); + case pkSnowball: return cpp14::make_unique<cThrownSnowballEntity> (a_Creator, a_Pos, Speed); + case pkGhastFireball: return cpp14::make_unique<cGhastFireballEntity> (a_Creator, a_Pos, Speed); + case pkFireCharge: return cpp14::make_unique<cFireChargeEntity> (a_Creator, a_Pos, Speed); + case pkExpBottle: return cpp14::make_unique<cExpBottleEntity> (a_Creator, a_Pos, Speed); + case pkSplashPotion: return cpp14::make_unique<cSplashPotionEntity> (a_Creator, a_Pos, Speed, *a_Item); + case pkWitherSkull: return cpp14::make_unique<cWitherSkullEntity> (a_Creator, a_Pos, Speed); case pkFirework: { ASSERT(a_Item != nullptr); @@ -286,7 +292,7 @@ std::unique_ptr<cProjectileEntity> cProjectileEntity::Create(eKind a_Kind, cEnti return nullptr; } - return cpp14::make_unique<cFireworkEntity>(a_Creator, a_X, a_Y, a_Z, *a_Item); + return cpp14::make_unique<cFireworkEntity>(a_Creator, a_Pos, *a_Item); } case pkFishingFloat: break; } |