1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 12:39:55 +00:00

Merge pull request #2376 from Capostrophic/getweapontype

GetWeaponType returns -2 for picks and -3 for probes (feature #5031)
This commit is contained in:
Andrei Kortunov 2019-05-11 17:03:07 +04:00 committed by GitHub
commit 4af9315672
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -113,6 +113,7 @@
Feature #4994: Persistent pinnable windows hiding
Feature #5000: Compressed BSA format support
Feature #5010: Native graphics herbalism support
Feature #5031: Make GetWeaponType function return different values for tools
Task #4686: Upgrade media decoder to a more current FFmpeg API
Task #4695: Optimize Distant Terrain memory consumption
Task #4721: Add NMake support to the Windows prebuild script

View File

@ -354,11 +354,27 @@ namespace MWScript
const MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr);
MWWorld::ConstContainerStoreIterator it = invStore.getSlot (MWWorld::InventoryStore::Slot_CarriedRight);
if (it == invStore.end() || it->getTypeName () != typeid(ESM::Weapon).name())
if (it == invStore.end())
{
runtime.push(-1);
return;
}
else if (it->getTypeName() != typeid(ESM::Weapon).name())
{
if (it->getTypeName() == typeid(ESM::Lockpick).name())
{
runtime.push(-2);
}
else if (it->getTypeName() == typeid(ESM::Probe).name())
{
runtime.push(-3);
}
else
{
runtime.push(-1);
}
return;
}
runtime.push(it->get<ESM::Weapon>()->mBase->mData.mType);
}