forked from teamnwah/openmw-tes3coop
Fix using wrong bit flag for NPC stats auto-calculation. Also set the corresponding mNpdtType which is used when determining which data structure to save. Should resolve Bug #2668.
This commit is contained in:
parent
8d22d26669
commit
b81454d226
4 changed files with 23 additions and 19 deletions
|
@ -119,7 +119,7 @@ std::string clothingTypeLabel(int idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string armorTypeLabel(int idx)
|
std::string armorTypeLabel(int idx)
|
||||||
{
|
{
|
||||||
if (idx >= 0 && idx <= 10)
|
if (idx >= 0 && idx <= 10)
|
||||||
{
|
{
|
||||||
static const char *armorTypeLabels[] = {
|
static const char *armorTypeLabels[] = {
|
||||||
|
@ -645,7 +645,7 @@ std::string ruleFunction(int idx)
|
||||||
else
|
else
|
||||||
return "Invalid";
|
return "Invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
// The "unused flag bits" should probably be defined alongside the
|
// The "unused flag bits" should probably be defined alongside the
|
||||||
// defined bits in the ESM component. The names of the flag bits are
|
// defined bits in the ESM component. The names of the flag bits are
|
||||||
// very inconsistent.
|
// very inconsistent.
|
||||||
|
@ -653,7 +653,7 @@ std::string ruleFunction(int idx)
|
||||||
std::string bodyPartFlags(int flags)
|
std::string bodyPartFlags(int flags)
|
||||||
{
|
{
|
||||||
std::string properties = "";
|
std::string properties = "";
|
||||||
if (flags == 0) properties += "[None] ";
|
if (flags == 0) properties += "[None] ";
|
||||||
if (flags & ESM::BodyPart::BPF_Female) properties += "Female ";
|
if (flags & ESM::BodyPart::BPF_Female) properties += "Female ";
|
||||||
if (flags & ESM::BodyPart::BPF_NotPlayable) properties += "NotPlayable ";
|
if (flags & ESM::BodyPart::BPF_NotPlayable) properties += "NotPlayable ";
|
||||||
int unused = (0xFFFFFFFF ^
|
int unused = (0xFFFFFFFF ^
|
||||||
|
@ -667,7 +667,7 @@ std::string bodyPartFlags(int flags)
|
||||||
std::string cellFlags(int flags)
|
std::string cellFlags(int flags)
|
||||||
{
|
{
|
||||||
std::string properties = "";
|
std::string properties = "";
|
||||||
if (flags == 0) properties += "[None] ";
|
if (flags == 0) properties += "[None] ";
|
||||||
if (flags & ESM::Cell::HasWater) properties += "HasWater ";
|
if (flags & ESM::Cell::HasWater) properties += "HasWater ";
|
||||||
if (flags & ESM::Cell::Interior) properties += "Interior ";
|
if (flags & ESM::Cell::Interior) properties += "Interior ";
|
||||||
if (flags & ESM::Cell::NoSleep) properties += "NoSleep ";
|
if (flags & ESM::Cell::NoSleep) properties += "NoSleep ";
|
||||||
|
@ -830,12 +830,12 @@ std::string npcFlags(int flags)
|
||||||
std::string properties = "";
|
std::string properties = "";
|
||||||
if (flags == 0) properties += "[None] ";
|
if (flags == 0) properties += "[None] ";
|
||||||
// Mythicmods and the ESM component differ. Mythicmods says
|
// Mythicmods and the ESM component differ. Mythicmods says
|
||||||
// 0x8=None and 0x10=AutoCalc, while our code defines 0x8 as
|
// 0x8=None and 0x10=AutoCalc, while our code previously defined
|
||||||
// AutoCalc. The former seems to be correct. All Bethesda
|
// 0x8 as AutoCalc. The former seems to be correct. All Bethesda
|
||||||
// records have bit 0x8 set. A suspiciously large portion of
|
// records have bit 0x8 set. Previously, suspiciously large portion
|
||||||
// females have autocalc turned off.
|
// of females had autocalc turned off.
|
||||||
if (flags & ESM::NPC::Autocalc) properties += "Unknown ";
|
if (flags & 0x00000008) properties += "Unknown ";
|
||||||
if (flags & 0x00000010) properties += "Autocalc ";
|
if (flags & ESM::NPC::Autocalc) properties += "Autocalc ";
|
||||||
if (flags & ESM::NPC::Female) properties += "Female ";
|
if (flags & ESM::NPC::Female) properties += "Female ";
|
||||||
if (flags & ESM::NPC::Respawn) properties += "Respawn ";
|
if (flags & ESM::NPC::Respawn) properties += "Respawn ";
|
||||||
if (flags & ESM::NPC::Essential) properties += "Essential ";
|
if (flags & ESM::NPC::Essential) properties += "Essential ";
|
||||||
|
@ -847,8 +847,8 @@ std::string npcFlags(int flags)
|
||||||
// however the only unknown bit occurs on ALL records, and
|
// however the only unknown bit occurs on ALL records, and
|
||||||
// relatively few NPCs have this bit set.
|
// relatively few NPCs have this bit set.
|
||||||
int unused = (0xFFFFFFFF ^
|
int unused = (0xFFFFFFFF ^
|
||||||
(ESM::NPC::Autocalc|
|
(0x00000008|
|
||||||
0x00000010|
|
ESM::NPC::Autocalc|
|
||||||
ESM::NPC::Female|
|
ESM::NPC::Female|
|
||||||
ESM::NPC::Respawn|
|
ESM::NPC::Respawn|
|
||||||
ESM::NPC::Essential|
|
ESM::NPC::Essential|
|
||||||
|
|
|
@ -648,7 +648,7 @@ void CSMTools::ReferenceableCheckStage::npcCheck (
|
||||||
|
|
||||||
if (npc.mNpdtType == ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS) //12 = autocalculated
|
if (npc.mNpdtType == ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS) //12 = autocalculated
|
||||||
{
|
{
|
||||||
if ((npc.mFlags & ESM::NPC::Autocalc) == 0) //0x0008 = autocalculated flag
|
if ((npc.mFlags & ESM::NPC::Autocalc) == 0) //0x0010 = autocalculated flag
|
||||||
{
|
{
|
||||||
messages.push_back (std::make_pair (id, npc.mId + " mNpdtType or flags mismatch!")); //should not happend?
|
messages.push_back (std::make_pair (id, npc.mId + " mNpdtType or flags mismatch!")); //should not happend?
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -546,6 +546,10 @@ void CSMWorld::NpcRefIdAdapter::setData (const RefIdColumn *column, RefIdData& d
|
||||||
record.get().mFlags |= iter->second;
|
record.get().mFlags |= iter->second;
|
||||||
else
|
else
|
||||||
record.get().mFlags &= ~iter->second;
|
record.get().mFlags &= ~iter->second;
|
||||||
|
|
||||||
|
if (iter->second == ESM::NPC::Autocalc)
|
||||||
|
record.get().mNpdtType = (value.toInt() != 0) ? ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS
|
||||||
|
: ESM::NPC::NPC_DEFAULT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ActorRefIdAdapter<ESM::NPC>::setData (column, data, index, value);
|
ActorRefIdAdapter<ESM::NPC>::setData (column, data, index, value);
|
||||||
|
|
|
@ -52,12 +52,12 @@ struct NPC
|
||||||
|
|
||||||
enum Flags
|
enum Flags
|
||||||
{
|
{
|
||||||
Female = 0x0001,
|
Female = 0x0001,
|
||||||
Essential = 0x0002,
|
Essential = 0x0002,
|
||||||
Respawn = 0x0004,
|
Respawn = 0x0004,
|
||||||
Autocalc = 0x0008,
|
Autocalc = 0x0010,
|
||||||
Skeleton = 0x0400, // Skeleton blood effect (white)
|
Skeleton = 0x0400, // Skeleton blood effect (white)
|
||||||
Metal = 0x0800 // Metal blood effect (golden?)
|
Metal = 0x0800 // Metal blood effect (golden?)
|
||||||
};
|
};
|
||||||
|
|
||||||
enum NpcType
|
enum NpcType
|
||||||
|
|
Loading…
Reference in a new issue