1
0

- 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
This commit is contained in:
mtilden@gmail.com
2011-12-26 09:09:47 +00:00
parent e2acb45d19
commit c7fa610be3
15 changed files with 125 additions and 47 deletions

View File

@@ -11,6 +11,7 @@
#include "cPickup.h"
#include "cItem.h"
#include "cMonsterConfig.h"
#include "MersenneTwister.h"
#include "packets/cPacket_SpawnMob.h"
#include "packets/cPacket_EntityLook.h"
@@ -64,7 +65,8 @@ cMonster::cMonster()
LOG("In state: %s",GetState());
m_Health = 10;
int RandVal = rand() % 4;
MTRand r1;
int RandVal = r1.randInt() % 4;
if( RandVal == 0 )
m_MobType = 90; // Pig
else if( RandVal == 1 )
@@ -418,12 +420,13 @@ void cMonster::EventLosePlayer(){
void cMonster::InStateIdle(float a_Dt) {
idle_interval += a_Dt;
if(idle_interval > 1) { //at this interval the results are predictable
int rem = rand()%6 + 1;
MTRand r1;
int rem = r1.randInt()%6 + 1;
//LOG("Moving: int: %3.3f rem: %i",idle_interval,rem);
idle_interval = 0;
Vector3f Dist;
Dist.x = (float)((rand()%11)-5);
Dist.z = (float)((rand()%11)-5);
Dist.x = (float)((r1.randInt()%11)-5);
Dist.z = (float)((r1.randInt()%11)-5);
if( Dist.SqrLength() > 2 && rem >= 3)
{
m_Destination->x = (float)(m_Pos->x + Dist.x);
@@ -581,5 +584,6 @@ void cMonster::DropItem(ENUM_ITEM_ID a_Item, unsigned int a_Count)
void cMonster::RandomDropItem(ENUM_ITEM_ID a_Item, unsigned int a_Min, unsigned int a_Max)
{
return cMonster::DropItem(a_Item, rand() % (a_Max + 1) + a_Min);
MTRand r1;
return cMonster::DropItem(a_Item, r1.randInt() % (a_Max + 1) + a_Min);
}