1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Fixes to Crime System

Victimless crimes were removed because victims may not exist in the
case of stealing items.

Is class now uses case insensitive comparison.

Fixed issue with confiscation of stolen items.
This commit is contained in:
Jeffrey Haines 2014-04-19 19:03:31 -04:00
parent e2fab228f9
commit 6733a1541e
3 changed files with 4 additions and 4 deletions

View file

@ -1305,7 +1305,7 @@ namespace MWClass
bool Npc::isClass(const MWWorld::Ptr& ptr, const std::string &className) const bool Npc::isClass(const MWWorld::Ptr& ptr, const std::string &className) const
{ {
return ptr.get<ESM::NPC>()->mBase->mClass == className; return Misc::StringUtils::ciEqual(ptr.get<ESM::NPC>()->mBase->mClass, className);
} }
const ESM::GameSetting *Npc::fMinWalkSpeed; const ESM::GameSetting *Npc::fMinWalkSpeed;

View file

@ -805,8 +805,8 @@ namespace MWMechanics
// NOTE: int arg can be from itemTaken() so DON'T modify it, since it is // NOTE: int arg can be from itemTaken() so DON'T modify it, since it is
// passed to reportCrime later on in this function. // passed to reportCrime later on in this function.
// Only player can commit crime and no victimless crimes // Only player can commit crime
if (ptr.getRefData().getHandle() != "player" || victim.isEmpty()) if (ptr.getRefData().getHandle() != "player")
return false; return false;
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();

View file

@ -814,6 +814,7 @@ namespace MWScript
{ {
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
player.getClass().getNpcStats(player).setBounty(0); player.getClass().getNpcStats(player).setBounty(0);
MWBase::Environment::get().getWorld()->confiscateStolenItems(player);
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId(); MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
} }
}; };
@ -825,7 +826,6 @@ namespace MWScript
{ {
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
player.getClass().getNpcStats(player).setBounty(0); player.getClass().getNpcStats(player).setBounty(0);
MWBase::Environment::get().getWorld()->confiscateStolenItems(player);
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId(); MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
} }
}; };