1
0

Pawn, Player: fixed asserts when teleporting players outside of the world (setting spawn Y to 256)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1346 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-04-01 18:05:41 +00:00
parent 0e35f2225a
commit 1406d80b2b
2 changed files with 27 additions and 10 deletions

View File

@ -315,8 +315,14 @@ void cPawn::SetMetaData(MetaData a_MetaData)
//----Change Entity MetaData
void cPawn::CheckMetaDataBurn()
void cPawn::CheckMetaDataBurn(void)
{
if ((GetPosY() < 1) || (GetPosY() >= 254))
{
// Y coord out of range
return;
}
BLOCKTYPE Block = GetWorld()->GetBlock((int) GetPosX(), (int) GetPosY(), (int) GetPosZ());
BLOCKTYPE BlockAbove = GetWorld()->GetBlock((int) GetPosX(), (int) GetPosY() + 1, (int) GetPosZ());
BLOCKTYPE BlockBelow = GetWorld()->GetBlock((int) GetPosX(), (int) GetPosY() - 1, (int) GetPosZ());

View File

@ -267,20 +267,31 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
if (!m_bTouchGround)
{
if(GetPosY() > m_LastJumpHeight) m_LastJumpHeight = (float)GetPosY();
cWorld* World = GetWorld();
char BlockID = World->GetBlock( float2int(GetPosX()), float2int(GetPosY()), float2int(GetPosZ()) );
if( BlockID != E_BLOCK_AIR )
if (GetPosY() > m_LastJumpHeight)
{
m_LastJumpHeight = (float)GetPosY();
}
cWorld * World = GetWorld();
if ((GetPosY() >= 0) && (GetPosY() < 256))
{
BLOCKTYPE BlockType = World->GetBlock( float2int(GetPosX()), float2int(GetPosY()), float2int(GetPosZ()) );
if (BlockType != E_BLOCK_AIR)
{
// LOGD("TouchGround set to true by server");
m_bTouchGround = true;
}
if( BlockID == E_BLOCK_WATER || BlockID == E_BLOCK_STATIONARY_WATER || BlockID == E_BLOCK_LADDER || BlockID == E_BLOCK_VINES )
if (
(BlockType == E_BLOCK_WATER) ||
(BlockType == E_BLOCK_STATIONARY_WATER) ||
(BlockType == E_BLOCK_LADDER) ||
(BlockType == E_BLOCK_VINES)
)
{
// LOGD("Water / Ladder / Torch");
m_LastGroundHeight = (float)GetPosY();
}
}
}
if (m_bTouchGround)
{