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()) 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()

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

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

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

Loading…
Cancel
Save