summaryrefslogtreecommitdiffstats
path: root/src/Entities/ExpOrb.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-15 19:52:15 +0100
committerHowaner <franzi.moos@googlemail.com>2014-02-16 01:25:39 +0100
commit707916b404e8ba16b8f39b43cb9e91af9d4b37b4 (patch)
tree8007f9a88f30eb7b209c68e9ab2a88bb290d382b /src/Entities/ExpOrb.cpp
parentAdd Exp Bottle Effects (diff)
downloadcuberite-707916b404e8ba16b8f39b43cb9e91af9d4b37b4.tar
cuberite-707916b404e8ba16b8f39b43cb9e91af9d4b37b4.tar.gz
cuberite-707916b404e8ba16b8f39b43cb9e91af9d4b37b4.tar.bz2
cuberite-707916b404e8ba16b8f39b43cb9e91af9d4b37b4.tar.lz
cuberite-707916b404e8ba16b8f39b43cb9e91af9d4b37b4.tar.xz
cuberite-707916b404e8ba16b8f39b43cb9e91af9d4b37b4.tar.zst
cuberite-707916b404e8ba16b8f39b43cb9e91af9d4b37b4.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/ExpOrb.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp
index 8b0838d27..41b60cc3b 100644
--- a/src/Entities/ExpOrb.cpp
+++ b/src/Entities/ExpOrb.cpp
@@ -4,8 +4,6 @@
#include "Player.h"
#include "../ClientHandle.h"
-#include <ctime>
-
cExpOrb::cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward) :
cEntity(etExpOrb, a_X, a_Y, a_Z, 0.98, 0.98),
@@ -54,10 +52,9 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk)
LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward);
a_ClosestPlayer->DeltaExperience(m_Reward);
- srand (static_cast <unsigned> (time(0)));
- float r1 = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); // Random Float Value (Java: random.nextFloat())
- float r2 = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); // Random Float Value (Java: random.nextFloat())
- a_ClosestPlayer->PlaySoundEffect("random.orb", 0.1F, 0.5F * ((r1 - r2) * 0.7F + 1.8F));
+ float r1 = (float) (0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64); // Random Float Value
+ float r2 = (float) (0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64); // Random Float Value
+ m_World->BroadcastSoundEffect("random.orb", (int) (GetPosX() * 8.0F), (int) (GetPosY() * 8.0F), (int) (GetPosZ() * 8.0F), 0.1F, 0.5F * ((r1 - r2) * 0.7F + 1.8F));
Destroy(true);
}