Merge pull request #2770 from Capostrophic/autocalc

Handle enchantment autocalc flag as a flag (bug #5363)
pull/593/head
Andrei Kortunov 5 years ago committed by GitHub
commit 94c1672e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@
------
Bug #5358: ForceGreeting always resets the dialogue window completely
Bug #5363: Enchantment autocalc not always 0/1
Bug #5364: Script fails/stops if trying to startscript an unknown script
Bug #5367: Selecting a spell on an enchanted item per hotkey always plays the equip sound
Bug #5369: Spawnpoint in the Grazelands doesn't produce oversized creatures

@ -4,6 +4,7 @@
#include <components/esm/loadcell.hpp>
#include <components/esm/loadcont.hpp>
#include <components/esm/loadcrea.hpp>
#include <components/esm/loadench.hpp>
#include <components/esm/loadlevlist.hpp>
#include <components/esm/loadligh.hpp>
#include <components/esm/loadmgef.hpp>
@ -726,6 +727,16 @@ std::string creatureFlags(int flags)
return properties;
}
std::string enchantmentFlags(int flags)
{
std::string properties;
if (flags == 0) properties += "[None] ";
if (flags & ESM::Enchantment::Autocalc) properties += "Autocalc ";
if (flags & (0xFFFFFFFF ^ ESM::Enchantment::Autocalc)) properties += "Invalid ";
properties += Misc::StringUtils::format("(0x%08X)", flags);
return properties;
}
std::string landFlags(int flags)
{
std::string properties;

@ -49,6 +49,7 @@ std::string bodyPartFlags(int flags);
std::string cellFlags(int flags);
std::string containerFlags(int flags);
std::string creatureFlags(int flags);
std::string enchantmentFlags(int flags);
std::string landFlags(int flags);
std::string creatureListFlags(int flags);
std::string itemListFlags(int flags);

@ -714,7 +714,7 @@ void Record<ESM::Enchantment>::print()
<< " (" << mData.mData.mType << ")" << std::endl;
std::cout << " Cost: " << mData.mData.mCost << std::endl;
std::cout << " Charge: " << mData.mData.mCharge << std::endl;
std::cout << " AutoCalc: " << mData.mData.mAutocalc << std::endl;
std::cout << " Flags: " << enchantmentFlags(mData.mData.mFlags) << std::endl;
printEffectList(mData.mEffects);
std::cout << " Deleted: " << mIsDeleted << std::endl;
}

@ -373,7 +373,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, bool fsStrict, const Files::Pat
mEnchantments.addColumn (new EnchantmentTypeColumn<ESM::Enchantment>);
mEnchantments.addColumn (new CostColumn<ESM::Enchantment>);
mEnchantments.addColumn (new ChargesColumn2<ESM::Enchantment>);
mEnchantments.addColumn (new AutoCalcColumn<ESM::Enchantment>);
mEnchantments.addColumn (new FlagColumn<ESM::Enchantment> (Columns::ColumnId_AutoCalc, ESM::Enchantment::Autocalc));
// Enchantment effects
mEnchantments.addColumn (new NestedParentColumn<ESM::Enchantment> (Columns::ColumnId_EffectList));
index = mEnchantments.getColumns()-1;

@ -63,7 +63,7 @@ namespace MWMechanics
const MWWorld::Ptr& player = getPlayer();
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
ESM::Enchantment enchantment;
enchantment.mData.mAutocalc = 0;
enchantment.mData.mFlags = 0;
enchantment.mData.mType = mCastStyle;
enchantment.mData.mCost = getBaseCastCost();
@ -219,7 +219,7 @@ namespace MWMechanics
if (iter->mEffects.mList.size() != toFind.mEffects.mList.size())
continue;
if (iter->mData.mAutocalc != toFind.mData.mAutocalc
if (iter->mData.mFlags != toFind.mData.mFlags
|| iter->mData.mType != toFind.mData.mType
|| iter->mData.mCost != toFind.mData.mCost
|| iter->mData.mCharge != toFind.mData.mCharge)

@ -66,7 +66,7 @@ namespace ESM
mData.mType = 0;
mData.mCost = 0;
mData.mCharge = 0;
mData.mAutocalc = 0;
mData.mFlags = 0;
mEffects.mList.clear();
}

@ -29,13 +29,17 @@ struct Enchantment
ConstantEffect = 3
};
enum Flags
{
Autocalc = 0x01
};
struct ENDTstruct
{
int mType;
int mCost;
int mCharge;
int mAutocalc; // Guessing this is 1 if we are supposed to auto
// calculate
int mFlags;
};
std::string mId;

Loading…
Cancel
Save