Skip to content

Commit d0f0cea

Browse files
ClobberXDSmallJoker
authored andcommittedApr 27, 2019
Range-limit value passed to PlayerSAO::set{HP|Breath} (#8264)
1 parent 695d9ed commit d0f0cea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/content_sao.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,8 @@ void PlayerSAO::setHP(s32 hp, const PlayerHPChangeReason &reason)
13341334
{
13351335
s32 oldhp = m_hp;
13361336

1337+
hp = rangelim(hp, 0, m_prop.hp_max);
1338+
13371339
s32 hp_change = m_env->getScriptIface()->on_player_hpchange(this, hp - oldhp, reason);
13381340
if (hp_change == 0)
13391341
return;
@@ -1355,7 +1357,7 @@ void PlayerSAO::setBreath(const u16 breath, bool send)
13551357
if (m_player && breath != m_breath)
13561358
m_player->setDirty(true);
13571359

1358-
m_breath = MYMIN(breath, m_prop.breath_max);
1360+
m_breath = rangelim(breath, 0, m_prop.breath_max);
13591361

13601362
if (send)
13611363
m_env->getGameDef()->SendPlayerBreath(this);

0 commit comments

Comments
 (0)
Please sign in to comment.