Add default values for fDifficultyMult and sDifficulty (Fixes #1742)

Also added values for some other GMSTs added in a Morrowind patch or Tribunal/BM
deque
scrawl 11 years ago
parent 09f27d142a
commit 28e61c9834

@ -350,36 +350,59 @@ namespace MWWorld
void World::ensureNeededRecords() void World::ensureNeededRecords()
{ {
if (!mStore.get<ESM::GameSetting>().search("sCompanionShare")) std::map<std::string, ESM::Variant> gmst;
{ // Companion (tribunal)
ESM::GameSetting sCompanionShare; gmst["sCompanionShare"] = ESM::Variant("Companion Share");
sCompanionShare.mId = "sCompanionShare"; gmst["sCompanionWarningMessage"] = ESM::Variant("Warning message");
ESM::Variant value; gmst["sCompanionWarningButtonOne"] = ESM::Variant("Button 1");
value.setType(ESM::VT_String); gmst["sCompanionWarningButtonTwo"] = ESM::Variant("Button 2");
value.setString("Companion Share"); gmst["sCompanionShare"] = ESM::Variant("Companion Share");
sCompanionShare.mValue = value; gmst["sProfitValue"] = ESM::Variant("Profit Value");
mStore.insertStatic(sCompanionShare); gmst["sTeleportDisabled"] = ESM::Variant("Teleport disabled");
} gmst["sLevitateDisabled"] = ESM::Variant("Levitate disabled");
if (!mStore.get<ESM::Global>().search("dayspassed"))
{ // Missing in unpatched MW 1.0
// vanilla Morrowind does not define dayspassed. gmst["sDifficulty"] = ESM::Variant("Difficulty");
ESM::Global dayspassed; gmst["fDifficultyMult"] = ESM::Variant(5.f);
dayspassed.mId = "dayspassed"; gmst["sAuto_Run"] = ESM::Variant("Auto Run");
ESM::Variant value; gmst["sServiceRefusal"] = ESM::Variant("Service Refusal");
value.setType(ESM::VT_Long); gmst["sNeedOneSkill"] = ESM::Variant("Need one skill");
value.setInteger(1); // but the addons start counting at 1 :( gmst["sNeedTwoSkills"] = ESM::Variant("Need two skills");
dayspassed.mValue = value; gmst["sEasy"] = ESM::Variant("Easy");
mStore.insertStatic(dayspassed); gmst["sHard"] = ESM::Variant("Hard");
} gmst["sDeleteNote"] = ESM::Variant("Delete Note");
if (!mStore.get<ESM::GameSetting>().search("fWereWolfRunMult")) gmst["sEditNote"] = ESM::Variant("Edit Note");
{
ESM::GameSetting fWereWolfRunMult; // Werewolf (BM)
fWereWolfRunMult.mId = "fWereWolfRunMult"; gmst["fWereWolfRunMult"] = ESM::Variant(1.f);
ESM::Variant value; gmst["fWereWolfSilverWeaponDamageMult"] = ESM::Variant(1.f);
value.setType(ESM::VT_Float);
value.setFloat(1.f);
fWereWolfRunMult.mValue = value; std::map<std::string, ESM::Variant> globals;
mStore.insertStatic(fWereWolfRunMult); // vanilla Morrowind does not define dayspassed.
globals["dayspassed"] = ESM::Variant(1); // but the addons start counting at 1 :(
globals["WerewolfClawMult"] = ESM::Variant(1.f);
for (std::map<std::string, ESM::Variant>::iterator it = gmst.begin(); it != gmst.end(); ++it)
{
if (!mStore.get<ESM::GameSetting>().search(it->first))
{
ESM::GameSetting setting;
setting.mId = it->first;
setting.mValue = it->second;
mStore.insertStatic(setting);
}
}
for (std::map<std::string, ESM::Variant>::iterator it = globals.begin(); it != globals.end(); ++it)
{
if (!mStore.get<ESM::Global>().search(it->first))
{
ESM::Global setting;
setting.mId = it->first;
setting.mValue = it->second;
mStore.insertStatic(setting);
}
} }
} }

@ -17,6 +17,30 @@ namespace
ESM::Variant::Variant() : mType (VT_None), mData (0) {} ESM::Variant::Variant() : mType (VT_None), mData (0) {}
ESM::Variant::Variant(const std::string &value)
{
mData = 0;
mType = VT_None;
setType(VT_String);
setString(value);
}
ESM::Variant::Variant(int value)
{
mData = 0;
mType = VT_None;
setType(VT_Long);
setInteger(value);
}
ESM::Variant::Variant(float value)
{
mData = 0;
mType = VT_None;
setType(VT_Float);
setFloat(value);
}
ESM::Variant::~Variant() ESM::Variant::~Variant()
{ {
delete mData; delete mData;

@ -38,6 +38,10 @@ namespace ESM
Variant(); Variant();
Variant (const std::string& value);
Variant (int value);
Variant (float value);
~Variant(); ~Variant();
Variant& operator= (const Variant& variant); Variant& operator= (const Variant& variant);
@ -83,4 +87,4 @@ namespace ESM
bool operator!= (const Variant& left, const Variant& right); bool operator!= (const Variant& left, const Variant& right);
} }
#endif #endif

Loading…
Cancel
Save