summaryrefslogtreecommitdiffstats
path: root/source/cPlayer.cpp
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-21 21:42:34 +0100
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-21 21:42:34 +0100
commit02f05f749645d3ef211676e6745d3feda2cd0513 (patch)
tree2b4c08e1ff7eab1d69f1dad4a00ef2d4d4fbcd3c /source/cPlayer.cpp
parentChanged chunk generation so any surface sand with air underneath it will turn into sandstone to prevent most sand cave-ins due to odd cave placement. (diff)
downloadcuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.gz
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.bz2
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.lz
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.xz
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.zst
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.zip
Diffstat (limited to 'source/cPlayer.cpp')
-rw-r--r--source/cPlayer.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index 8238f327c..65b6187a6 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -325,11 +325,7 @@ void cPlayer::Heal( int a_Health )
{
if( m_Health < 20 )
{
- m_Health += (short)a_Health;
- if( m_Health > 20 )
- {
- m_Health = 20;
- }
+ m_Health = MIN(a_Health + m_Health, 20);
cPacket_UpdateHealth Health;
Health.m_Health = m_Health;
@@ -344,7 +340,9 @@ void cPlayer::TakeDamage( int a_Damage, cEntity* a_Instigator )
cPacket_UpdateHealth Health;
Health.m_Health = m_Health;
- m_ClientHandle->Send( Health );
+ //TODO: Causes problems sometimes O.o (E.G. Disconnecting when attacked)
+ if(m_ClientHandle != 0)
+ m_ClientHandle->Send( Health );
}
}