diff options
author | mtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-26 10:09:47 +0100 |
---|---|---|
committer | mtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-26 10:09:47 +0100 |
commit | c7fa610be3b6e072d3da4611f6de72390ebbf446 (patch) | |
tree | eaa1e1d08d9136c78228ec067f4d41b1d33ef320 /source/cPlayer.cpp | |
parent | - Added timer to cPlayer PlayerListItem because sending the packets like minecraft does (every tick per player) is 20 pps per client to each client and was causing Kicks for having too high of a packet queue (diff) | |
download | cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.gz cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.bz2 cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.lz cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.xz cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.zst cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cPlayer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index 41bb24945..5fe31c8c9 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -17,6 +17,7 @@ #include "cRoot.h"
#include "cMakeDir.h"
#include "cTimer.h"
+#include "MersenneTwister.h"
#include "packets/cPacket_NamedEntitySpawn.h"
#include "packets/cPacket_EntityLook.h"
@@ -375,15 +376,16 @@ void cPlayer::KilledBy( cEntity* a_Killer ) m_bVisible = false; // So new clients don't see the player
+ MTRand r1;
// Puke out all the items
cItem* Items = m_Inventory->GetSlots();
for( unsigned int i = 1; i < m_Inventory->c_NumSlots; ++i )
{
if( !Items[i].IsEmpty() )
{
- float SpeedX = ((rand()%1000)-500) /100.f;
- float SpeedY = ((rand()%1000)) /100.f;
- float SpeedZ = ((rand()%1000)-500) /100.f;
+ float SpeedX = ((r1.randInt()%1000)-500) /100.f;
+ float SpeedY = ((r1.randInt()%1000)) /100.f;
+ float SpeedZ = ((r1.randInt()%1000)-500) /100.f;
cPickup* Pickup = new cPickup( (int)(m_Pos->x*32), (int)(m_Pos->y*32), (int)(m_Pos->z*32), Items[i], SpeedX, SpeedY, SpeedZ );
Pickup->Initialize( GetWorld() );
}
|