mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 00:11:34 +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
2 changed files with 19 additions and 6 deletions
|
@ -133,8 +133,6 @@ void BirthDialog::updateBirths()
|
||||||
const MWWorld::Store<ESM::BirthSign> &signs =
|
const MWWorld::Store<ESM::BirthSign> &signs =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>();
|
||||||
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
// sort by name
|
// sort by name
|
||||||
std::vector < std::pair<std::string, const ESM::BirthSign*> > birthSigns;
|
std::vector < std::pair<std::string, const ESM::BirthSign*> > birthSigns;
|
||||||
|
|
||||||
|
@ -145,12 +143,20 @@ void BirthDialog::updateBirths()
|
||||||
}
|
}
|
||||||
std::sort(birthSigns.begin(), birthSigns.end(), sortBirthSigns);
|
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);
|
mBirthList->addItem(it2->second->mName, it2->first);
|
||||||
if (boost::iequals(it2->first, mCurrentBirthId))
|
if (mCurrentBirthId.empty())
|
||||||
|
{
|
||||||
mBirthList->setIndexSelected(index);
|
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;
|
const std::string &id = it->mId;
|
||||||
mClassList->addItem(it->mName, id);
|
mClassList->addItem(it->mName, id);
|
||||||
if (boost::iequals(id, mCurrentClassId))
|
if (mCurrentClassId.empty())
|
||||||
|
{
|
||||||
|
mCurrentClassId = id;
|
||||||
mClassList->setIndexSelected(index);
|
mClassList->setIndexSelected(index);
|
||||||
|
}
|
||||||
|
else if (boost::iequals(id, mCurrentClassId))
|
||||||
|
{
|
||||||
|
mClassList->setIndexSelected(index);
|
||||||
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue