Make PcRaiseRank, PcLowerRank and PcJoinFaction properly accept references instead of using the actor that the player talked to last.

This also solves a potential crash when no actor has been talked to yet, e.g. immediately after loading a savegame.
actorid
scrawl 11 years ago
parent ef39b0f6ab
commit f921f2e7db

@ -45,9 +45,6 @@ namespace MWBase
virtual void goodbye() = 0;
virtual MWWorld::Ptr getActor() const = 0;
///< Return the actor the player is currently talking to.
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const = 0;
//calbacks for the GUI

@ -468,11 +468,6 @@ namespace MWDialogue
mIsInChoice = true;
}
MWWorld::Ptr DialogueManager::getActor() const
{
return mActor;
}
void DialogueManager::goodbye()
{
mIsInChoice = true;

@ -68,9 +68,6 @@ namespace MWDialogue
virtual void goodbye();
virtual MWWorld::Ptr getActor() const;
///< Return the actor the player is currently talking to.
virtual bool checkServiceRefused ();
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const;

@ -54,7 +54,10 @@ op 0x20025: AiFollowCell, explicit reference
op 0x20026: ModRegion
op 0x20027: RemoveSoulGem
op 0x20028: RemoveSoulGem, explicit reference
opcodes 0x20029-0x3ffff unused
op 0x20029: PCRaiseRank, explicit reference
op 0x2002a: PCLowerRank, explicit reference
op 0x2002b: PCJoinFaction, explicit reference
opcodes 0x2002c-0x3ffff unused
Segment 4:
(not implemented yet)

@ -29,10 +29,8 @@
namespace
{
std::string getDialogueActorFaction()
std::string getDialogueActorFaction(MWWorld::Ptr actor)
{
MWWorld::Ptr actor = MWBase::Environment::get().getDialogueManager()->getActor();
const MWMechanics::NpcStats &stats = MWWorld::Class::get (actor).getNpcStats (actor);
if (stats.getFactionRanks().empty())
@ -523,6 +521,7 @@ namespace MWScript
}
};
template<class R>
class OpPCJoinFaction : public Interpreter::Opcode1
{
public:
@ -533,7 +532,8 @@ namespace MWScript
if(arg0==0)
{
factionID = getDialogueActorFaction();
MWWorld::Ptr actor = R()(runtime);
factionID = getDialogueActorFaction(actor);
}
else
{
@ -552,6 +552,7 @@ namespace MWScript
}
};
template<class R>
class OpPCRaiseRank : public Interpreter::Opcode1
{
public:
@ -562,7 +563,8 @@ namespace MWScript
if(arg0==0)
{
factionID = getDialogueActorFaction();
MWWorld::Ptr actor = R()(runtime);
factionID = getDialogueActorFaction(actor);
}
else
{
@ -585,6 +587,7 @@ namespace MWScript
}
};
template<class R>
class OpPCLowerRank : public Interpreter::Opcode1
{
public:
@ -595,7 +598,8 @@ namespace MWScript
if(arg0==0)
{
factionID = getDialogueActorFaction();
MWWorld::Ptr actor = R()(runtime);
factionID = getDialogueActorFaction(actor);
}
else
{
@ -1180,9 +1184,12 @@ namespace MWScript
interpreter.installSegment5 (Compiler::Stats::opcodeGetSpell, new OpGetSpell<ImplicitRef>);
interpreter.installSegment5 (Compiler::Stats::opcodeGetSpellExplicit, new OpGetSpell<ExplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodePCRaiseRank,new OpPCRaiseRank);
interpreter.installSegment3(Compiler::Stats::opcodePCLowerRank,new OpPCLowerRank);
interpreter.installSegment3(Compiler::Stats::opcodePCJoinFaction,new OpPCJoinFaction);
interpreter.installSegment3(Compiler::Stats::opcodePCRaiseRank,new OpPCRaiseRank<ImplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodePCLowerRank,new OpPCLowerRank<ImplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodePCJoinFaction,new OpPCJoinFaction<ImplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodePCRaiseRankExplicit,new OpPCRaiseRank<ExplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodePCLowerRankExplicit,new OpPCLowerRank<ExplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodePCJoinFactionExplicit,new OpPCJoinFaction<ExplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodeGetPCRank,new OpGetPCRank<ImplicitRef>);
interpreter.installSegment3(Compiler::Stats::opcodeGetPCRankExplicit,new OpGetPCRank<ExplicitRef>);

@ -409,9 +409,9 @@ namespace Compiler
opcodeResurrectExplicit);
extensions.registerFunction ("getspell", 'l', "c", opcodeGetSpell, opcodeGetSpellExplicit);
extensions.registerInstruction("pcraiserank","/S",opcodePCRaiseRank);
extensions.registerInstruction("pclowerrank","/S",opcodePCLowerRank);
extensions.registerInstruction("pcjoinfaction","/S",opcodePCJoinFaction);
extensions.registerInstruction("pcraiserank","/S",opcodePCRaiseRank, opcodePCRaiseRankExplicit);
extensions.registerInstruction("pclowerrank","/S",opcodePCLowerRank, opcodePCLowerRankExplicit);
extensions.registerInstruction("pcjoinfaction","/S",opcodePCJoinFaction, opcodePCJoinFactionExplicit);
extensions.registerInstruction ("moddisposition","l",opcodeModDisposition,
opcodeModDispositionExplicit);
extensions.registerInstruction ("setdisposition","l",opcodeSetDisposition,

@ -330,6 +330,10 @@ namespace Compiler
const int opcodePCRaiseRank = 0x2000b;
const int opcodePCLowerRank = 0x2000c;
const int opcodePCJoinFaction = 0x2000d;
const int opcodePCRaiseRankExplicit = 0x20029;
const int opcodePCLowerRankExplicit = 0x2002a;
const int opcodePCJoinFactionExplicit = 0x2002b;
const int opcodeGetPCRank = 0x2000e;
const int opcodeGetPCRankExplicit = 0x2000f;
const int opcodeModDisposition = 0x200014d;

Loading…
Cancel
Save