From c7fa610be3b6e072d3da4611f6de72390ebbf446 Mon Sep 17 00:00:00 2001 From: "mtilden@gmail.com" Date: Mon, 26 Dec 2011 09:09:47 +0000 Subject: - Linux compatible fixes including updated makefile - Mersenne Twister still says uint32 but it's now signed for compatibility with random uses needing negative values - Server seed is sent to clients, but needs to be able to be signed long long later on for authentic reasons - Protocol Version is required to match to ensure client compatibility, this should probably have a settings.ini check as well as store the value there git-svn-id: http://mc-server.googlecode.com/svn/trunk@121 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPlayer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/cPlayer.cpp') 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() ); } -- cgit v1.2.3