make sure magic effects added by expansions are available

deque
Marc Zinnschlag 10 years ago
parent 25a1112627
commit aa89370db6

@ -2023,6 +2023,7 @@ void CSMDoc::Document::addOptionalGmsts()
{
ESM::GameSetting gmst;
gmst.mId = sFloats[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_Float);
addOptionalGmst (gmst);
}
@ -2031,6 +2032,7 @@ void CSMDoc::Document::addOptionalGmsts()
{
ESM::GameSetting gmst;
gmst.mId = sIntegers[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_Int);
addOptionalGmst (gmst);
}
@ -2039,6 +2041,7 @@ void CSMDoc::Document::addOptionalGmsts()
{
ESM::GameSetting gmst;
gmst.mId = sStrings[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_String);
gmst.mValue.setString ("<no text>");
addOptionalGmst (gmst);
@ -2059,6 +2062,7 @@ void CSMDoc::Document::addOptionalGlobals()
{
ESM::Global global;
global.mId = sGlobals[i];
global.blank();
global.mValue.setType (ESM::VT_Long);
if (i==0)
@ -2068,6 +2072,19 @@ void CSMDoc::Document::addOptionalGlobals()
}
}
void CSMDoc::Document::addOptionalMagicEffects()
{
for (int i=ESM::MagicEffect::SummonFabricant; i<=ESM::MagicEffect::SummonCreature05; ++i)
{
ESM::MagicEffect effect;
effect.mIndex = i;
effect.mId = ESM::MagicEffect::indexToId (i);
effect.blank();
addOptionalMagicEffect (effect);
}
}
void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
{
if (getData().getGmsts().searchId (gmst.mId)==-1)
@ -2090,6 +2107,17 @@ void CSMDoc::Document::addOptionalGlobal (const ESM::Global& global)
}
}
void CSMDoc::Document::addOptionalMagicEffect (const ESM::MagicEffect& magicEffect)
{
if (getData().getMagicEffects().searchId (magicEffect.mId)==-1)
{
CSMWorld::Record<ESM::MagicEffect> record;
record.mBase = magicEffect;
record.mState = CSMWorld::RecordBase::State_BaseOnly;
getData().getMagicEffects().appendRecord (record);
}
}
void CSMDoc::Document::createBase()
{
static const char *sGlobals[] =
@ -2260,6 +2288,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
addOptionalGmsts();
addOptionalGlobals();
addOptionalMagicEffects();
connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool)));

@ -26,6 +26,7 @@ namespace ESM
{
struct GameSetting;
struct Global;
struct MagicEffect;
}
namespace Files
@ -73,10 +74,14 @@ namespace CSMDoc
void addOptionalGlobals();
void addOptionalMagicEffects();
void addOptionalGmst (const ESM::GameSetting& gmst);
void addOptionalGlobal (const ESM::Global& global);
void addOptionalMagicEffect (const ESM::MagicEffect& effect);
public:
Document (const Files::ConfigurationManager& configuration,

Loading…
Cancel
Save