Fix disposition changes from trades not applying properly

actorid
scrawl 11 years ago
parent 728365b48d
commit c85c2cff4e

@ -51,7 +51,7 @@ namespace MWBase
virtual void persuade (int type) = 0;
virtual int getTemporaryDispositionChange () const = 0;
virtual void applyTemporaryDispositionChange (int delta) = 0;
virtual void applyDispositionChange (int delta) = 0;
};
}

@ -126,6 +126,8 @@ namespace MWDialogue
void DialogueManager::startDialogue (const MWWorld::Ptr& actor)
{
mLastTopic = "";
mPermanentDispositionChange = 0;
mTemporaryDispositionChange = 0;
mChoice = -1;
mIsInChoice = false;
@ -514,9 +516,19 @@ namespace MWDialogue
return mTemporaryDispositionChange;
}
void DialogueManager::applyTemporaryDispositionChange(int delta)
void DialogueManager::applyDispositionChange(int delta)
{
int oldTemp = mTemporaryDispositionChange;
mTemporaryDispositionChange += delta;
// don't allow increasing beyond 100 or decreasing below 0
int curDisp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor);
if (curDisp + mTemporaryDispositionChange < 0)
mTemporaryDispositionChange = -curDisp;
else if (curDisp + mTemporaryDispositionChange > 100)
mTemporaryDispositionChange = 100 - curDisp;
int diff = mTemporaryDispositionChange - oldTemp;
mPermanentDispositionChange += diff;
}
bool DialogueManager::checkServiceRefused()

@ -76,7 +76,7 @@ namespace MWDialogue
virtual void persuade (int type);
virtual int getTemporaryDispositionChange () const;
virtual void applyTemporaryDispositionChange (int delta);
virtual void applyDispositionChange (int delta);
};

@ -319,7 +319,7 @@ namespace MWGui
messageBox("#{sNotifyMessage9}");
int iBarterFailDisposition = gmst.find("iBarterFailDisposition")->getInt();
MWBase::Environment::get().getDialogueManager()->applyTemporaryDispositionChange(iBarterFailDisposition);
MWBase::Environment::get().getDialogueManager()->applyDispositionChange(iBarterFailDisposition);
return;
}
@ -328,7 +328,7 @@ namespace MWGui
}
int iBarterSuccessDisposition = gmst.find("iBarterSuccessDisposition")->getInt();
MWBase::Environment::get().getDialogueManager()->applyTemporaryDispositionChange(iBarterSuccessDisposition);
MWBase::Environment::get().getDialogueManager()->applyDispositionChange(iBarterSuccessDisposition);
// make the item transfer
mTradeModel->transferItems();

@ -248,7 +248,8 @@ namespace MWMechanics
void CreatureStats::setAiSetting (AiSetting index, int base)
{
Stat<int> stat(base);
Stat<int> stat = getAiSetting(index);
stat.setBase(base);
setAiSetting(index, stat);
}

@ -749,11 +749,15 @@ namespace MWMechanics
if (!owner.empty())
victim = MWBase::Environment::get().getWorld()->getPtr(owner, true);
// TODO: expell from faction
commitCrime(ptr, victim, OT_Theft, item.getClass().getValue(item) * count);
}
void MechanicsManager::commitCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg)
{
// TODO: expell from faction
bool reported=false;
for (Actors::PtrControllerMap::const_iterator it = mActors.begin(); it != mActors.end(); ++it)
{

Loading…
Cancel
Save