Merge branch 'remove_klass' into 'master'

Replace 'klass' by meaningful names

See merge request OpenMW/openmw!3745
revert-c3c8fa1e
Evil Eye 12 months ago
commit 97dee00263

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

@ -248,27 +248,27 @@ namespace MWGui
if (mCurrentClassId.empty())
return;
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Class* klass = store.get<ESM::Class>().search(mCurrentClassId);
if (!klass)
const ESM::Class* currentClass = store.get<ESM::Class>().search(mCurrentClassId);
if (!currentClass)
return;
ESM::Class::Specialization specialization
= static_cast<ESM::Class::Specialization>(klass->mData.mSpecialization);
= static_cast<ESM::Class::Specialization>(currentClass->mData.mSpecialization);
std::string specName{ MWBase::Environment::get().getWindowManager()->getGameSettingString(
ESM::Class::sGmstSpecializationIds[specialization], ESM::Class::sGmstSpecializationIds[specialization]) };
mSpecializationName->setCaption(specName);
ToolTips::createSpecializationToolTip(mSpecializationName, specName, specialization);
mFavoriteAttribute[0]->setAttributeId(ESM::Attribute::indexToRefId(klass->mData.mAttribute[0]));
mFavoriteAttribute[1]->setAttributeId(ESM::Attribute::indexToRefId(klass->mData.mAttribute[1]));
mFavoriteAttribute[0]->setAttributeId(ESM::Attribute::indexToRefId(currentClass->mData.mAttribute[0]));
mFavoriteAttribute[1]->setAttributeId(ESM::Attribute::indexToRefId(currentClass->mData.mAttribute[1]));
ToolTips::createAttributeToolTip(mFavoriteAttribute[0], mFavoriteAttribute[0]->getAttributeId());
ToolTips::createAttributeToolTip(mFavoriteAttribute[1], mFavoriteAttribute[1]->getAttributeId());
for (size_t i = 0; i < klass->mData.mSkills.size(); ++i)
for (size_t i = 0; i < currentClass->mData.mSkills.size(); ++i)
{
ESM::RefId minor = ESM::Skill::indexToRefId(klass->mData.mSkills[i][0]);
ESM::RefId major = ESM::Skill::indexToRefId(klass->mData.mSkills[i][1]);
ESM::RefId minor = ESM::Skill::indexToRefId(currentClass->mData.mSkills[i][0]);
ESM::RefId major = ESM::Skill::indexToRefId(currentClass->mData.mSkills[i][1]);
mMinorSkill[i]->setSkillId(minor);
mMajorSkill[i]->setSkillId(major);
ToolTips::createSkillToolTip(mMinorSkill[i], minor);

@ -148,11 +148,11 @@ namespace MWGui
mUpdateSkillArea = true;
}
void ReviewDialog::setClass(const ESM::Class& class_)
void ReviewDialog::setClass(const ESM::Class& playerClass)
{
mKlass = class_;
mClassWidget->setCaption(mKlass.mName);
ToolTips::createClassToolTip(mClassWidget, mKlass);
mClass = playerClass;
mClassWidget->setCaption(mClass.mName);
ToolTips::createClassToolTip(mClassWidget, mClass);
}
void ReviewDialog::setBirthSign(const ESM::RefId& signId)

@ -30,7 +30,7 @@ namespace MWGui
void setPlayerName(const std::string& name);
void setRace(const ESM::RefId& raceId);
void setClass(const ESM::Class& class_);
void setClass(const ESM::Class& playerClass);
void setBirthSign(const ESM::RefId& signId);
void setHealth(const MWMechanics::DynamicStat<float>& value);
@ -96,7 +96,7 @@ namespace MWGui
std::map<ESM::RefId, MyGUI::TextBox*> mSkillWidgetMap;
ESM::RefId mRaceId, mBirthSignId;
std::string mName;
ESM::Class mKlass;
ESM::Class mClass;
std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
bool mUpdateSkillArea;

Loading…
Cancel
Save