mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 13:06:40 +00:00
add missing item when executing the Equip instruction
This commit is contained in:
parent
48c257b939
commit
03a35c38df
1 changed files with 7 additions and 3 deletions
|
@ -102,7 +102,7 @@ namespace MWScript
|
||||||
|| ::Misc::StringUtils::ciEqual(item, "gold_025")
|
|| ::Misc::StringUtils::ciEqual(item, "gold_025")
|
||||||
|| ::Misc::StringUtils::ciEqual(item, "gold_100"))
|
|| ::Misc::StringUtils::ciEqual(item, "gold_100"))
|
||||||
item = "gold_001";
|
item = "gold_001";
|
||||||
|
|
||||||
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
||||||
|
|
||||||
runtime.push (store.count(item));
|
runtime.push (store.count(item));
|
||||||
|
@ -136,7 +136,7 @@ namespace MWScript
|
||||||
|| ::Misc::StringUtils::ciEqual(item, "gold_025")
|
|| ::Misc::StringUtils::ciEqual(item, "gold_025")
|
||||||
|| ::Misc::StringUtils::ciEqual(item, "gold_100"))
|
|| ::Misc::StringUtils::ciEqual(item, "gold_100"))
|
||||||
item = "gold_001";
|
item = "gold_001";
|
||||||
|
|
||||||
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
|
||||||
|
|
||||||
std::string itemName;
|
std::string itemName;
|
||||||
|
@ -188,7 +188,11 @@ namespace MWScript
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (it == invStore.end())
|
if (it == invStore.end())
|
||||||
throw std::runtime_error("Item to equip not found");
|
{
|
||||||
|
it = ptr.getClass().getContainerStore (ptr).add (item, 1, ptr);
|
||||||
|
std::cerr << "Implicitly adding one " << item << " to container "
|
||||||
|
"to fulfil requirements of Equip instruction" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
MWBase::Environment::get().getWindowManager()->useItem(*it);
|
MWBase::Environment::get().getWindowManager()->useItem(*it);
|
||||||
|
|
Loading…
Reference in a new issue