1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00: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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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)