|
|
|
@ -14,6 +14,16 @@
|
|
|
|
|
using namespace MWGui;
|
|
|
|
|
using namespace Widgets;
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
bool sortBirthSigns(const std::pair<std::string, const ESM::BirthSign*>& left, const std::pair<std::string, const ESM::BirthSign*>& right)
|
|
|
|
|
{
|
|
|
|
|
return left.second->mName.compare (right.second->mName) < 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
|
|
|
|
: WindowBase("openmw_chargen_birth.layout", parWindowManager)
|
|
|
|
|
{
|
|
|
|
@ -115,11 +125,21 @@ void BirthDialog::updateBirths()
|
|
|
|
|
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
|
|
|
|
|
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
|
|
|
|
|
int index = 0;
|
|
|
|
|
for (; it != end; ++it)
|
|
|
|
|
|
|
|
|
|
// sort by name
|
|
|
|
|
std::vector < std::pair<std::string, const ESM::BirthSign*> > birthSigns;
|
|
|
|
|
for (; it!=end; ++it)
|
|
|
|
|
{
|
|
|
|
|
std::string id = it->first;
|
|
|
|
|
const ESM::BirthSign* sign = &it->second;
|
|
|
|
|
birthSigns.push_back(std::make_pair(id, sign));
|
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
const ESM::BirthSign &birth = it->second;
|
|
|
|
|
mBirthList->addItem(birth.mName, it->first);
|
|
|
|
|
if (boost::iequals(it->first, mCurrentBirthId))
|
|
|
|
|
mBirthList->addItem(it2->second->mName, it2->first);
|
|
|
|
|
if (boost::iequals(it2->first, mCurrentBirthId))
|
|
|
|
|
mBirthList->setIndexSelected(index);
|
|
|
|
|
++index;
|
|
|
|
|
}
|
|
|
|
|