mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-02 14:57:59 +03:00
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
be39395ce7
21 changed files with 220 additions and 62 deletions
|
@ -179,6 +179,8 @@ namespace Compiler
|
|||
opcodeGetReputationExplicit);
|
||||
extensions.registerFunction("samefaction", 'l', "", opcodeSameFaction,
|
||||
opcodeSameFactionExplicit);
|
||||
extensions.registerInstruction("modfactionreaction", "ccl", opcodeModFactionReaction);
|
||||
extensions.registerFunction("getfactionreaction", 'l', "ccl", opcodeGetFactionReaction);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,8 @@ namespace Compiler
|
|||
const int opcodeGetReputationExplicit = 0x20001b2;
|
||||
const int opcodeSameFaction = 0x20001b5;
|
||||
const int opcodeSameFactionExplicit = 0x20001b6;
|
||||
const int opcodeModFactionReaction = 0x2000242;
|
||||
const int opcodeGetFactionReaction = 0x2000243;
|
||||
}
|
||||
|
||||
namespace Gui
|
||||
|
|
|
@ -8,6 +8,20 @@ void ESM::DialogueState::load (ESMReader &esm)
|
|||
{
|
||||
while (esm.isNextSub ("TOPI"))
|
||||
mKnownTopics.push_back (esm.getHString());
|
||||
|
||||
while (esm.isNextSub ("FACT"))
|
||||
{
|
||||
std::string faction = esm.getHString();
|
||||
|
||||
while (esm.isNextSub ("REAC"))
|
||||
{
|
||||
std::string faction2 = esm.getHString();
|
||||
int reaction;
|
||||
esm.getHNT(reaction, "INTV");
|
||||
|
||||
mModFactionReaction[faction][faction2] = reaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ESM::DialogueState::save (ESMWriter &esm) const
|
||||
|
@ -16,6 +30,18 @@ void ESM::DialogueState::save (ESMWriter &esm) const
|
|||
iter!=mKnownTopics.end(); ++iter)
|
||||
{
|
||||
esm.writeHNString ("TOPI", *iter);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (std::map<std::string, std::map<std::string, int> >::const_iterator iter = mModFactionReaction.begin();
|
||||
iter != mModFactionReaction.end(); ++iter)
|
||||
{
|
||||
esm.writeHNString ("FACT", iter->first);
|
||||
|
||||
for (std::map<std::string, int>::const_iterator reactIter = iter->second.begin();
|
||||
reactIter != iter->second.end(); ++reactIter)
|
||||
{
|
||||
esm.writeHNString ("REAC", reactIter->first);
|
||||
esm.writeHNT ("INTV", reactIter->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -15,9 +16,11 @@ namespace ESM
|
|||
{
|
||||
std::vector<std::string> mKnownTopics;
|
||||
|
||||
std::map<std::string, std::map<std::string, int> > mModFactionReaction;
|
||||
|
||||
void load (ESMReader &esm);
|
||||
void save (ESMWriter &esm) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -44,10 +44,10 @@ void Faction::load(ESMReader &esm)
|
|||
// Read faction response values
|
||||
while (esm.hasMoreSubs())
|
||||
{
|
||||
Reaction r;
|
||||
r.mFaction = esm.getHNString("ANAM");
|
||||
esm.getHNT(r.mReaction, "INTV");
|
||||
mReactions.push_back(r);
|
||||
std::string faction = esm.getHNString("ANAM");
|
||||
int reaction;
|
||||
esm.getHNT(reaction, "INTV");
|
||||
mReactions[faction] = reaction;
|
||||
}
|
||||
}
|
||||
void Faction::save(ESMWriter &esm) const
|
||||
|
@ -64,10 +64,10 @@ void Faction::save(ESMWriter &esm) const
|
|||
|
||||
esm.writeHNT("FADT", mData, 240);
|
||||
|
||||
for (std::vector<Reaction>::const_iterator it = mReactions.begin(); it != mReactions.end(); ++it)
|
||||
for (std::map<std::string, int>::const_iterator it = mReactions.begin(); it != mReactions.end(); ++it)
|
||||
{
|
||||
esm.writeHNString("ANAM", it->mFaction);
|
||||
esm.writeHNT("INTV", it->mReaction);
|
||||
esm.writeHNString("ANAM", it->first);
|
||||
esm.writeHNT("INTV", it->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define OPENMW_ESM_FACT_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -53,13 +53,8 @@ struct Faction
|
|||
|
||||
FADTstruct mData;
|
||||
|
||||
struct Reaction
|
||||
{
|
||||
std::string mFaction;
|
||||
int mReaction;
|
||||
};
|
||||
|
||||
std::vector<Reaction> mReactions;
|
||||
// <Faction ID, Reaction>
|
||||
std::map<std::string, int> mReactions;
|
||||
|
||||
// Name of faction ranks (may be empty for NPC factions)
|
||||
std::string mRanks[10];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue