1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-21 20:05:45 +02:00

Irrlicht support changes (#14383)

This commit is contained in:
sfan5
2024-02-19 21:14:47 +01:00
committed by GitHub
parent 84dd812da4
commit e3cc26cb7c
8 changed files with 49 additions and 85 deletions

View File

@@ -515,8 +515,9 @@ void PlayerSAO::setHP(s32 target_hp, const PlayerHPChangeReason &reason, bool fr
return; // Nothing to do
s32 hp_change = m_env->getScriptIface()->on_player_hpchange(this, target_hp - (s32)m_hp, reason);
hp_change = std::min<s32>(hp_change, U16_MAX); // Protect against overflow
s32 hp = (s32)m_hp + std::min(hp_change, U16_MAX); // Protection against s32 overflow
s32 hp = (s32)m_hp + hp_change;
hp = rangelim(hp, 0, U16_MAX);
if (hp > m_prop.hp_max)