1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 07:06:43 +00:00

make sure magic effects added by expansions are available

This commit is contained in:
Marc Zinnschlag 2014-09-27 12:38:42 +02:00
parent 25a1112627
commit aa89370db6
2 changed files with 34 additions and 0 deletions

View file

@ -2023,6 +2023,7 @@ void CSMDoc::Document::addOptionalGmsts()
{ {
ESM::GameSetting gmst; ESM::GameSetting gmst;
gmst.mId = sFloats[i]; gmst.mId = sFloats[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_Float); gmst.mValue.setType (ESM::VT_Float);
addOptionalGmst (gmst); addOptionalGmst (gmst);
} }
@ -2031,6 +2032,7 @@ void CSMDoc::Document::addOptionalGmsts()
{ {
ESM::GameSetting gmst; ESM::GameSetting gmst;
gmst.mId = sIntegers[i]; gmst.mId = sIntegers[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_Int); gmst.mValue.setType (ESM::VT_Int);
addOptionalGmst (gmst); addOptionalGmst (gmst);
} }
@ -2039,6 +2041,7 @@ void CSMDoc::Document::addOptionalGmsts()
{ {
ESM::GameSetting gmst; ESM::GameSetting gmst;
gmst.mId = sStrings[i]; gmst.mId = sStrings[i];
gmst.blank();
gmst.mValue.setType (ESM::VT_String); gmst.mValue.setType (ESM::VT_String);
gmst.mValue.setString ("<no text>"); gmst.mValue.setString ("<no text>");
addOptionalGmst (gmst); addOptionalGmst (gmst);
@ -2059,6 +2062,7 @@ void CSMDoc::Document::addOptionalGlobals()
{ {
ESM::Global global; ESM::Global global;
global.mId = sGlobals[i]; global.mId = sGlobals[i];
global.blank();
global.mValue.setType (ESM::VT_Long); global.mValue.setType (ESM::VT_Long);
if (i==0) 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) void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
{ {
if (getData().getGmsts().searchId (gmst.mId)==-1) 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() void CSMDoc::Document::createBase()
{ {
static const char *sGlobals[] = static const char *sGlobals[] =
@ -2260,6 +2288,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
addOptionalGmsts(); addOptionalGmsts();
addOptionalGlobals(); addOptionalGlobals();
addOptionalMagicEffects();
connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool))); connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool)));

View file

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