1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-18 04:20:48 +00:00

Clarify CharacterCreation::setValue

This commit is contained in:
Evil Eye 2023-05-21 19:53:31 +02:00
parent 4e05dd3cd3
commit ed7b6dc2a7

View File

@ -107,9 +107,10 @@ namespace MWGui
if (id.starts_with(prefix) && id.size() == prefix.size() + 1) if (id.starts_with(prefix) && id.size() == prefix.size() + 1)
{ {
char index = id[prefix.size()]; char index = id[prefix.size()];
auto attribute = static_cast<ESM::Attribute::AttributeID>(index - '0' - 1); if (index >= '1' && index <= '8')
if (attribute >= ESM::Attribute::Strength && attribute < ESM::Attribute::Length)
{ {
// Match [AttribVal1-AttribVal8] to the corresponding AttributeID values [0-7]
auto attribute = static_cast<ESM::Attribute::AttributeID>(index - '0' - 1);
mPlayerAttributes[attribute] = value; mPlayerAttributes[attribute] = value;
if (mReviewDialog) if (mReviewDialog)
mReviewDialog->setAttribute(attribute, value); mReviewDialog->setAttribute(attribute, value);