[General] Use flags instead of autoCalc for enchantment dynamic records

This brings the handling of dynamic records in multiplayer up-to-date with ad333e88fe
pull/593/head
David Cernat 5 years ago
parent 25a632c650
commit 509f03ca52

@ -239,8 +239,6 @@ int RecordsDynamicFunctions::GetRecordAutoCalc(unsigned int index) noexcept
if (readRecordsType == mwmp::RECORD_TYPE::POTION)
return WorldstateFunctions::readWorldstate->potionRecords.at(index).data.mData.mAutoCalc;
else if (readRecordsType == mwmp::RECORD_TYPE::ENCHANTMENT)
return WorldstateFunctions::readWorldstate->enchantmentRecords.at(index).data.mData.mAutocalc;
return -1;
}
@ -273,6 +271,8 @@ int RecordsDynamicFunctions::GetRecordFlags(unsigned int index) noexcept
if (readRecordsType == mwmp::RECORD_TYPE::SPELL)
return WorldstateFunctions::readWorldstate->spellRecords.at(index).data.mData.mFlags;
else if (readRecordsType == mwmp::RECORD_TYPE::ENCHANTMENT)
return WorldstateFunctions::readWorldstate->enchantmentRecords.at(index).data.mData.mFlags;
return -1;
}
@ -737,8 +737,6 @@ void RecordsDynamicFunctions::SetRecordAutoCalc(int autoCalc) noexcept
if (writeRecordsType == mwmp::RECORD_TYPE::POTION)
tempPotion.data.mData.mAutoCalc = autoCalc;
else if (writeRecordsType == mwmp::RECORD_TYPE::ENCHANTMENT)
tempEnchantment.data.mData.mAutocalc = autoCalc;
else if (writeRecordsType == mwmp::RECORD_TYPE::NPC)
{
if (autoCalc)
@ -799,6 +797,8 @@ void RecordsDynamicFunctions::SetRecordFlags(int flags) noexcept
if (writeRecordsType == mwmp::RECORD_TYPE::SPELL)
tempSpell.data.mData.mFlags = flags;
else if (writeRecordsType == mwmp::RECORD_TYPE::ENCHANTMENT)
tempEnchantment.data.mData.mFlags = flags;
else if (writeRecordsType == mwmp::RECORD_TYPE::WEAPON)
tempWeapon.data.mData.mFlags = flags;
else if (writeRecordsType == mwmp::RECORD_TYPE::BODYPART)

@ -678,8 +678,8 @@ void RecordHelper::overrideRecord(const mwmp::EnchantmentRecord& record)
if (record.baseOverrides.hasCharge)
finalData.mData.mCharge = recordData.mData.mCharge;
if (record.baseOverrides.hasAutoCalc)
finalData.mData.mAutocalc = recordData.mData.mAutocalc;
if (record.baseOverrides.hasFlags)
finalData.mData.mFlags = recordData.mData.mFlags;
if (record.baseOverrides.hasEffects)
finalData.mEffects.mList = recordData.mEffects.mList;

@ -208,7 +208,7 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
RW(recordData.mData.mType, send);
RW(recordData.mData.mCost, send);
RW(recordData.mData.mCharge, send);
RW(recordData.mData.mAutocalc, send);
RW(recordData.mData.mFlags, send);
ProcessEffects(recordData.mEffects, send);
if (!record.baseId.empty())
@ -217,7 +217,7 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
RW(overrides.hasSubtype, send);
RW(overrides.hasCost, send);
RW(overrides.hasCharge, send);
RW(overrides.hasAutoCalc, send);
RW(overrides.hasFlags, send);
RW(overrides.hasEffects, send);
}
}

Loading…
Cancel
Save