Fixed the jump food exhaustion being added when player is swimming

master
James Ravenscroft 2013-08-08 16:57:34 +01:00
parent 9f7db50de0
commit 2b9fdc3e36
1 changed files with 8 additions and 3 deletions

View File

@ -32,8 +32,7 @@
#include "Protocol/ProtocolRecognizer.h"
#define float2int(x) ((x)<0 ? ((int)(x))-1 : (int)(x))
#define AddPistonDir(x, y, z, dir, amount) switch (dir) { case 0: (y)-=(amount); break; case 1: (y)+=(amount); break;\
@ -505,7 +504,13 @@ void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ,
// If a jump just started, process food exhaustion:
if ((a_PosY > m_Player->GetPosY()) && !a_IsOnGround && m_Player->IsOnGround())
{
m_Player->AddFoodExhaustion(m_Player->IsSprinting() ? 0.8 : 0.2);
// we only add this exhaustion if the player is not swimming - otherwise we end up with both jump + swim exhaustion
cWorld * World = m_Player->GetWorld();
BLOCKTYPE BlockType = World->GetBlock( float2int(m_Player->GetPosX()), float2int(m_Player->GetPosY()), float2int(m_Player->GetPosZ()) );
if(! IsBlockWater(BlockType) )
{
m_Player->AddFoodExhaustion(m_Player->IsSprinting() ? 0.8 : 0.2);
}
}
m_Player->MoveTo(Pos);