Make SetHP only throw an error if the item represents something intelligent - as it stands, with one of the constructors requiring a HP value, it makes the most sense to just allow HP to be set for a non-intelligent item, as it seems said value is ignored by the engine, anyway.

This commit is contained in:
hispidence 2021-07-04 14:36:01 +01:00
parent 33dcd85a06
commit 2dd4f546fa

View file

@ -146,7 +146,8 @@ short GameScriptItemInfo::GetHP() const
void GameScriptItemInfo::SetHP(short hp)
{
if (hp < 0 || hp > Objects[m_item->objectNumber].hitPoints)
if(Objects[m_item->objectNumber].intelligent &&
(hp < 0 || hp > Objects[m_item->objectNumber].hitPoints))
{
if (WarningsAsErrors)
throw std::runtime_error("invalid HP");