Moved mWitnesses into Player. resetCrime for paying fine.

actorid
Jeffrey Haines 11 years ago
parent 7c0b51fb7e
commit 6f1211dd8d

@ -17,7 +17,6 @@ namespace MWMechanics
mAttacked (false), mHostile (false),
mAttackingOrSpell(false),
mIsWerewolf(false),
mWitnesses(),
mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mHitRecovery(false), mBlock(false),
mMovementFlags(0), mDrawState (DrawState_Nothing), mAttackStrength(0.f)
{
@ -497,17 +496,4 @@ namespace MWMechanics
{
return mGoldPool;
}
void CreatureStats::addPlayerWitnesses(std::vector<MWWorld::Ptr> witnesses)
{
mWitnesses.insert(mWitnesses.end(), witnesses.begin(), witnesses.end());
}
std::vector<MWWorld::Ptr> CreatureStats::getPlayerWitnesses() const
{
return mWitnesses;
}
void CreatureStats::resetPlayerWitnesses()
{
mWitnesses.clear();
}
}

@ -59,8 +59,6 @@ namespace MWMechanics
int mGoldPool; // the pool of merchant gold not in inventory
std::vector<MWWorld::Ptr> mWitnesses; // the witnesses to players crimes
protected:
bool mIsWerewolf;
AttributeValue mWerewolfAttributes[8];
@ -235,10 +233,6 @@ namespace MWMechanics
void setGoldPool(int pool);
int getGoldPool() const;
void addPlayerWitnesses(std::vector<MWWorld::Ptr> witnesses);
std::vector<MWWorld::Ptr> getPlayerWitnesses() const;
void resetPlayerWitnesses();
};
}

@ -901,7 +901,7 @@ namespace MWMechanics
}
}
if (reported)
ptr.getClass().getCreatureStats(ptr).addPlayerWitnesses(neighbors);
MWBase::Environment::get().getWorld()->getPlayer().addPlayerWitnesses(neighbors);
return reported;
}

@ -810,9 +810,11 @@ namespace MWScript
public:
virtual void execute(Interpreter::Runtime &runtime)
{
MWBase::World* world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
player.getClass().getNpcStats(player).setBounty(0);
MWBase::Environment::get().getWorld()->confiscateStolenItems(player);
world->confiscateStolenItems(player);
world->resetCrimes(player);
}
};
@ -821,8 +823,10 @@ namespace MWScript
public:
virtual void execute(Interpreter::Runtime &runtime)
{
MWBase::World* world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
player.getClass().getNpcStats(player).setBounty(0);
world->resetCrimes(player);
}
};

@ -274,4 +274,17 @@ namespace MWWorld
return false;
}
void Player::addPlayerWitnesses(std::vector<MWWorld::Ptr> witnesses)
{
mWitnesses.insert(mWitnesses.end(), witnesses.begin(), witnesses.end());
}
std::vector<MWWorld::Ptr> Player::getPlayerWitnesses() const
{
return mWitnesses;
}
void Player::resetPlayerWitnesses()
{
mWitnesses.clear();
}
}

@ -41,6 +41,8 @@ namespace MWWorld
bool mAutoMove;
int mForwardBackward;
bool mTeleported;
std::vector<MWWorld::Ptr> mWitnesses;
public:
Player(const ESM::NPC *player, const MWBase::World& world);
@ -94,6 +96,10 @@ namespace MWWorld
void write (ESM::ESMWriter& writer) const;
bool readRecord (ESM::ESMReader& reader, int32_t type);
void addPlayerWitnesses(std::vector<MWWorld::Ptr> witnesses);
std::vector<MWWorld::Ptr> getPlayerWitnesses() const;
void resetPlayerWitnesses();
};
}
#endif

@ -2777,7 +2777,7 @@ namespace MWWorld
void World::resetCrimes(const MWWorld::Ptr& ptr)
{
// Reset witnesses to the players crimes
std::vector<MWWorld::Ptr> neighbors = ptr.getClass().getCreatureStats(ptr).getPlayerWitnesses();
std::vector<MWWorld::Ptr> neighbors = mPlayer->getPlayerWitnesses();
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
{
// Reset states
@ -2790,7 +2790,7 @@ namespace MWWorld
it->getClass().getCreatureStats(*it).getAiSequence().stopPersue();
}
ptr.getClass().getCreatureStats(ptr).resetPlayerWitnesses();
mPlayer->resetPlayerWitnesses();
}
void World::spawnRandomCreature(const std::string &creatureList)

Loading…
Cancel
Save