1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-20 06:41:33 +00:00

Merge branch 'creaturesstronk' into 'master'

Allow creatures' strength to be edited

See merge request OpenMW/openmw!4448
This commit is contained in:
Alexei Kotov 2024-11-08 20:18:24 +00:00
commit 32a6ed6f49

View file

@ -1287,7 +1287,7 @@ QVariant CSMWorld::CreatureAttributesRefIdAdapter::getNestedData(
if (subColIndex == 0) if (subColIndex == 0)
return subRowIndex; return subRowIndex;
else if (subColIndex == 1 && subRowIndex > 0 && subRowIndex < ESM::Attribute::Length) else if (subColIndex == 1 && subRowIndex >= 0 && subRowIndex < ESM::Attribute::Length)
return creature.mData.mAttributes[subRowIndex]; return creature.mData.mAttributes[subRowIndex];
return QVariant(); // throw an exception here? return QVariant(); // throw an exception here?
} }
@ -1298,7 +1298,7 @@ void CSMWorld::CreatureAttributesRefIdAdapter::setNestedData(
Record<ESM::Creature>& record Record<ESM::Creature>& record
= static_cast<Record<ESM::Creature>&>(data.getRecord(RefIdData::LocalIndex(row, UniversalId::Type_Creature))); = static_cast<Record<ESM::Creature>&>(data.getRecord(RefIdData::LocalIndex(row, UniversalId::Type_Creature)));
if (subColIndex == 1 && subRowIndex > 0 && subRowIndex < ESM::Attribute::Length) if (subColIndex == 1 && subRowIndex >= 0 && subRowIndex < ESM::Attribute::Length)
{ {
ESM::Creature creature = record.get(); ESM::Creature creature = record.get();
creature.mData.mAttributes[subRowIndex] = value.toInt(); creature.mData.mAttributes[subRowIndex] = value.toInt();