mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-12 04:14:05 +00:00
GUI: Birth and Class dialogs now both select 1st item in list at first
time.
This commit is contained in:
parent
725bfe6372
commit
59808c3e10
@ -133,8 +133,6 @@ void BirthDialog::updateBirths()
|
||||
const MWWorld::Store<ESM::BirthSign> &signs =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>();
|
||||
|
||||
int index = 0;
|
||||
|
||||
// sort by name
|
||||
std::vector < std::pair<std::string, const ESM::BirthSign*> > birthSigns;
|
||||
|
||||
@ -145,12 +143,20 @@ void BirthDialog::updateBirths()
|
||||
}
|
||||
std::sort(birthSigns.begin(), birthSigns.end(), sortBirthSigns);
|
||||
|
||||
for (std::vector < std::pair<std::string, const ESM::BirthSign*> >::const_iterator it2 = birthSigns.begin(); it2 != birthSigns.end(); ++it2)
|
||||
int index = 0;
|
||||
for (std::vector<std::pair<std::string, const ESM::BirthSign*> >::const_iterator it2 = birthSigns.begin();
|
||||
it2 != birthSigns.end(); ++it2, ++index)
|
||||
{
|
||||
mBirthList->addItem(it2->second->mName, it2->first);
|
||||
if (boost::iequals(it2->first, mCurrentBirthId))
|
||||
if (mCurrentBirthId.empty())
|
||||
{
|
||||
mBirthList->setIndexSelected(index);
|
||||
++index;
|
||||
mCurrentBirthId = it2->first;
|
||||
}
|
||||
else if (boost::iequals(it2->first, mCurrentBirthId))
|
||||
{
|
||||
mBirthList->setIndexSelected(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,8 +197,15 @@ void PickClassDialog::updateClasses()
|
||||
|
||||
const std::string &id = it->mId;
|
||||
mClassList->addItem(it->mName, id);
|
||||
if (boost::iequals(id, mCurrentClassId))
|
||||
if (mCurrentClassId.empty())
|
||||
{
|
||||
mCurrentClassId = id;
|
||||
mClassList->setIndexSelected(index);
|
||||
}
|
||||
else if (boost::iequals(id, mCurrentClassId))
|
||||
{
|
||||
mClassList->setIndexSelected(index);
|
||||
}
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user