mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 12:36:45 +03:00
Fix GameScriptItemInfo::SetHP messages.
This commit is contained in:
parent
bac8fb7171
commit
8d0d307b19
1 changed files with 3 additions and 1 deletions
|
@ -351,14 +351,16 @@ void GameScriptItemInfo::SetHP(short hp)
|
||||||
if(Objects[m_item->objectNumber].intelligent &&
|
if(Objects[m_item->objectNumber].intelligent &&
|
||||||
(hp < 0 || hp > Objects[m_item->objectNumber].hitPoints))
|
(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)
|
if (hp < 0)
|
||||||
{
|
{
|
||||||
hp = 0;
|
hp = 0;
|
||||||
|
ScriptWarn("Setting HP to 0.");
|
||||||
}
|
}
|
||||||
else if (hp > Objects[m_item->objectNumber].hitPoints)
|
else if (hp > Objects[m_item->objectNumber].hitPoints)
|
||||||
{
|
{
|
||||||
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