mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-08 11:38:08 +03:00
Fix GameScriptItemInfo::SetHP messages.
This commit is contained in:
parent
27a9009f33
commit
c0f8f5ec27
1 changed files with 3 additions and 1 deletions
|
@ -351,14 +351,16 @@ void GameScriptItemInfo::SetHP(short hp)
|
|||
if(Objects[m_item->objectNumber].intelligent &&
|
||||
(hp < 0 || hp > Objects[m_item->objectNumber].hitPoints))
|
||||
{
|
||||
ScriptAssert(false, "Invalid value: " + hp);
|
||||
ScriptAssert(false, "Invalid HP value: " + std::to_string(hp));
|
||||
if (hp < 0)
|
||||
{
|
||||
hp = 0;
|
||||
ScriptWarn("Setting HP to 0.");
|
||||
}
|
||||
else if (hp > Objects[m_item->objectNumber].hitPoints)
|
||||
{
|
||||
hp = Objects[m_item->objectNumber].hitPoints;
|
||||
ScriptWarn("Setting HP to default value (" + std::to_string(hp) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue