summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemBow.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-18 21:10:51 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-18 21:10:51 +0200
commit37140ae57835680d2c4fb3aa365082622d3a150e (patch)
tree89a636c74375b3c9f0fe77b20ecbadc693bd0989 /src/Items/ItemBow.h
parentMerge branch 'master' of https://github.com/mc-server/MCServer into portals (diff)
parentMonster fixes (diff)
downloadcuberite-37140ae57835680d2c4fb3aa365082622d3a150e.tar
cuberite-37140ae57835680d2c4fb3aa365082622d3a150e.tar.gz
cuberite-37140ae57835680d2c4fb3aa365082622d3a150e.tar.bz2
cuberite-37140ae57835680d2c4fb3aa365082622d3a150e.tar.lz
cuberite-37140ae57835680d2c4fb3aa365082622d3a150e.tar.xz
cuberite-37140ae57835680d2c4fb3aa365082622d3a150e.tar.zst
cuberite-37140ae57835680d2c4fb3aa365082622d3a150e.zip
Diffstat (limited to 'src/Items/ItemBow.h')
-rw-r--r--src/Items/ItemBow.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h
index 821e2ab26..e7a77dcbc 100644
--- a/src/Items/ItemBow.h
+++ b/src/Items/ItemBow.h
@@ -46,20 +46,17 @@ public:
{
// Actual shot - produce the arrow with speed based on the ticks that the bow was charged
ASSERT(a_Player != NULL);
-
+
int BowCharge = a_Player->FinishChargingBow();
- double Force = (double)BowCharge / 20;
- Force = (Force * Force + 2 * Force) / 3; // This formula is used by the 1.6.2 client
+ double Force = (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)
{
// Too little force, ignore the shot
return;
}
- if (Force > 1)
- {
- Force = 1;
- }
-
+ Force = std::min(Force, 1.0);
+
// Create the arrow entity:
cArrowEntity * Arrow = new cArrowEntity(*a_Player, Force * 2);
if (Arrow == NULL)
@@ -72,9 +69,8 @@ public:
Arrow = NULL;
return;
}
- a_Player->GetWorld()->BroadcastSpawnEntity(*Arrow);
- a_Player->GetWorld()->BroadcastSoundEffect("random.bow", (int)a_Player->GetPosX() * 8, (int)a_Player->GetPosY() * 8, (int)a_Player->GetPosZ() * 8, 0.5, (float)Force);
+ a_Player->GetWorld()->BroadcastSoundEffect("random.bow", a_Player->GetPosX(), a_Player->GetPosY(), a_Player->GetPosZ(), 0.5, (float)Force);
if (!a_Player->IsGameModeCreative())
{
a_Player->UseEquippedItem();