mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 20:19:57 +00:00
Handle enchantment autocalc flag as a flag (bug #5363)
This commit is contained in:
parent
f27e299025
commit
ad333e88fe
8 changed files with 24 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
0.47.0
|
||||
------
|
||||
|
||||
Bug #5363: Enchantment autocalc not always 0/1
|
||||
|
||||
0.46.0
|
||||
------
|
||||
|
|
|
@ -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…
Reference in a new issue