|
|
@ -333,10 +333,10 @@ namespace MWGui
|
|
|
|
if (!classId.empty())
|
|
|
|
if (!classId.empty())
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
|
|
|
|
|
|
|
|
|
|
|
const ESM::Class* klass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(classId);
|
|
|
|
const ESM::Class* pickedClass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(classId);
|
|
|
|
if (klass)
|
|
|
|
if (pickedClass)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mPlayerClass = *klass;
|
|
|
|
mPlayerClass = *pickedClass;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mPickClassDialog));
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mPickClassDialog));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -454,30 +454,30 @@ namespace MWGui
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mCreateClassDialog)
|
|
|
|
if (mCreateClassDialog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ESM::Class klass;
|
|
|
|
ESM::Class createdClass;
|
|
|
|
klass.mName = mCreateClassDialog->getName();
|
|
|
|
createdClass.mName = mCreateClassDialog->getName();
|
|
|
|
klass.mDescription = mCreateClassDialog->getDescription();
|
|
|
|
createdClass.mDescription = mCreateClassDialog->getDescription();
|
|
|
|
klass.mData.mSpecialization = mCreateClassDialog->getSpecializationId();
|
|
|
|
createdClass.mData.mSpecialization = mCreateClassDialog->getSpecializationId();
|
|
|
|
klass.mData.mIsPlayable = 0x1;
|
|
|
|
createdClass.mData.mIsPlayable = 0x1;
|
|
|
|
klass.mRecordFlags = 0;
|
|
|
|
createdClass.mRecordFlags = 0;
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<ESM::RefId> attributes = mCreateClassDialog->getFavoriteAttributes();
|
|
|
|
std::vector<ESM::RefId> attributes = mCreateClassDialog->getFavoriteAttributes();
|
|
|
|
assert(attributes.size() >= klass.mData.mAttribute.size());
|
|
|
|
assert(attributes.size() >= createdClass.mData.mAttribute.size());
|
|
|
|
for (size_t i = 0; i < klass.mData.mAttribute.size(); ++i)
|
|
|
|
for (size_t i = 0; i < createdClass.mData.mAttribute.size(); ++i)
|
|
|
|
klass.mData.mAttribute[i] = ESM::Attribute::refIdToIndex(attributes[i]);
|
|
|
|
createdClass.mData.mAttribute[i] = ESM::Attribute::refIdToIndex(attributes[i]);
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<ESM::RefId> majorSkills = mCreateClassDialog->getMajorSkills();
|
|
|
|
std::vector<ESM::RefId> majorSkills = mCreateClassDialog->getMajorSkills();
|
|
|
|
std::vector<ESM::RefId> minorSkills = mCreateClassDialog->getMinorSkills();
|
|
|
|
std::vector<ESM::RefId> minorSkills = mCreateClassDialog->getMinorSkills();
|
|
|
|
assert(majorSkills.size() >= klass.mData.mSkills.size());
|
|
|
|
assert(majorSkills.size() >= createdClass.mData.mSkills.size());
|
|
|
|
assert(minorSkills.size() >= klass.mData.mSkills.size());
|
|
|
|
assert(minorSkills.size() >= createdClass.mData.mSkills.size());
|
|
|
|
for (size_t i = 0; i < klass.mData.mSkills.size(); ++i)
|
|
|
|
for (size_t i = 0; i < createdClass.mData.mSkills.size(); ++i)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
klass.mData.mSkills[i][1] = ESM::Skill::refIdToIndex(majorSkills[i]);
|
|
|
|
createdClass.mData.mSkills[i][1] = ESM::Skill::refIdToIndex(majorSkills[i]);
|
|
|
|
klass.mData.mSkills[i][0] = ESM::Skill::refIdToIndex(minorSkills[i]);
|
|
|
|
createdClass.mData.mSkills[i][0] = ESM::Skill::refIdToIndex(minorSkills[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(createdClass);
|
|
|
|
mPlayerClass = klass;
|
|
|
|
mPlayerClass = std::move(createdClass);
|
|
|
|
|
|
|
|
|
|
|
|
// Do not delete dialog, so that choices are remembered in case we want to go back and adjust them later
|
|
|
|
// Do not delete dialog, so that choices are remembered in case we want to go back and adjust them later
|
|
|
|
mCreateClassDialog->setVisible(false);
|
|
|
|
mCreateClassDialog->setVisible(false);
|
|
|
@ -666,9 +666,10 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
|
|
|
|
|
|
|
|
|
|
|
const ESM::Class* klass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(mGenerateClass);
|
|
|
|
const ESM::Class* generatedClass
|
|
|
|
|
|
|
|
= MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(mGenerateClass);
|
|
|
|
|
|
|
|
|
|
|
|
mPlayerClass = *klass;
|
|
|
|
mPlayerClass = *generatedClass;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CharacterCreation::onGenerateClassBack()
|
|
|
|
void CharacterCreation::onGenerateClassBack()
|
|
|
|