mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 11:23:51 +00:00
Race dialog uses the ID of the race object instead of the name when referencing it.
This commit is contained in:
parent
0dafd30dfc
commit
850b8eb6a7
3 changed files with 17 additions and 17 deletions
|
@ -92,14 +92,14 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment, bool showNext)
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::setRace(const std::string &race)
|
void RaceDialog::setRaceId(const std::string &raceId)
|
||||||
{
|
{
|
||||||
currentRace = race;
|
currentRaceId = raceId;
|
||||||
raceList->setIndexSelected(MyGUI::ITEM_NONE);
|
raceList->setIndexSelected(MyGUI::ITEM_NONE);
|
||||||
size_t count = raceList->getItemCount();
|
size_t count = raceList->getItemCount();
|
||||||
for (size_t i = 0; i < count; ++i)
|
for (size_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (boost::iequals(raceList->getItem(i), race))
|
if (boost::iequals(raceList->getItem(i), raceId))
|
||||||
{
|
{
|
||||||
raceList->setIndexSelected(i);
|
raceList->setIndexSelected(i);
|
||||||
break;
|
break;
|
||||||
|
@ -172,11 +172,11 @@ void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index)
|
||||||
if (_index == MyGUI::ITEM_NONE)
|
if (_index == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::string race = raceList->getItem(_index);
|
const std::string *raceId = raceList->getItemDataAt<std::string>(_index);
|
||||||
if (boost::iequals(currentRace, race))
|
if (boost::iequals(currentRaceId, *raceId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
currentRace = race;
|
currentRaceId = *raceId;
|
||||||
updateSkills();
|
updateSkills();
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
}
|
}
|
||||||
|
@ -199,8 +199,8 @@ void RaceDialog::updateRaces()
|
||||||
if (!playable) // Only display playable races
|
if (!playable) // Only display playable races
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
raceList->addItem(race.name);
|
raceList->addItem(race.name, it->first);
|
||||||
if (boost::iequals(race.name, currentRace))
|
if (boost::iequals(race.name, currentRaceId))
|
||||||
raceList->setIndexSelected(index);
|
raceList->setIndexSelected(index);
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void RaceDialog::updateSkills()
|
||||||
}
|
}
|
||||||
skillItems.clear();
|
skillItems.clear();
|
||||||
|
|
||||||
if (currentRace.empty())
|
if (currentRaceId.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::StaticTextPtr skillNameWidget, skillBonusWidget;
|
MyGUI::StaticTextPtr skillNameWidget, skillBonusWidget;
|
||||||
|
@ -223,7 +223,7 @@ void RaceDialog::updateSkills()
|
||||||
MyGUI::IntCoord coord2(coord1.left + coord1.width, 0, 40, 18);
|
MyGUI::IntCoord coord2(coord1.left + coord1.width, 0, 40, 18);
|
||||||
|
|
||||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||||
const ESM::Race *race = store.races.find(currentRace);
|
const ESM::Race *race = store.races.find(currentRaceId);
|
||||||
int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
|
int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +257,7 @@ void RaceDialog::updateSpellPowers()
|
||||||
}
|
}
|
||||||
spellPowerItems.clear();
|
spellPowerItems.clear();
|
||||||
|
|
||||||
if (currentRace.empty())
|
if (currentRaceId.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::StaticTextPtr spellPowerWidget;
|
MyGUI::StaticTextPtr spellPowerWidget;
|
||||||
|
@ -265,7 +265,7 @@ void RaceDialog::updateSpellPowers()
|
||||||
MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18);
|
MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18);
|
||||||
|
|
||||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||||
const ESM::Race *race = store.races.find(currentRace);
|
const ESM::Race *race = store.races.find(currentRaceId);
|
||||||
|
|
||||||
std::vector<std::string>::const_iterator it = race->powers.list.begin();
|
std::vector<std::string>::const_iterator it = race->powers.list.begin();
|
||||||
std::vector<std::string>::const_iterator end = race->powers.list.end();
|
std::vector<std::string>::const_iterator end = race->powers.list.end();
|
||||||
|
|
|
@ -34,12 +34,12 @@ namespace MWGui
|
||||||
GM_Female
|
GM_Female
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string &getRace() const { return currentRace; }
|
const std::string &getRaceId() const { return currentRaceId; }
|
||||||
Gender getGender() const { return genderIndex == 0 ? GM_Male : GM_Female; }
|
Gender getGender() const { return genderIndex == 0 ? GM_Male : GM_Female; }
|
||||||
// getFace()
|
// getFace()
|
||||||
// getHair()
|
// getHair()
|
||||||
|
|
||||||
void setRace(const std::string &race);
|
void setRaceId(const std::string &raceId);
|
||||||
void setGender(Gender gender) { genderIndex = gender == GM_Male ? 0 : 1; }
|
void setGender(Gender gender) { genderIndex = gender == GM_Male ? 0 : 1; }
|
||||||
// setFace()
|
// setFace()
|
||||||
// setHair()
|
// setHair()
|
||||||
|
@ -93,7 +93,7 @@ namespace MWGui
|
||||||
int genderIndex, faceIndex, hairIndex;
|
int genderIndex, faceIndex, hairIndex;
|
||||||
int faceCount, hairCount;
|
int faceCount, hairCount;
|
||||||
|
|
||||||
std::string currentRace;
|
std::string currentRaceId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -201,7 +201,7 @@ void WindowManager::onRaceDialogDone()
|
||||||
if (raceDialog)
|
if (raceDialog)
|
||||||
{
|
{
|
||||||
raceDialog->setVisible(false);
|
raceDialog->setVisible(false);
|
||||||
environment.mMechanicsManager->setPlayerRace(raceDialog->getRace(), raceDialog->getGender() == RaceDialog::GM_Male);
|
environment.mMechanicsManager->setPlayerRace(raceDialog->getRaceId(), raceDialog->getGender() == RaceDialog::GM_Male);
|
||||||
}
|
}
|
||||||
delete raceDialog;
|
delete raceDialog;
|
||||||
raceDialog = nullptr;
|
raceDialog = nullptr;
|
||||||
|
@ -219,7 +219,7 @@ void WindowManager::onRaceDialogBack()
|
||||||
if (raceDialog)
|
if (raceDialog)
|
||||||
{
|
{
|
||||||
raceDialog->setVisible(false);
|
raceDialog->setVisible(false);
|
||||||
environment.mMechanicsManager->setPlayerRace(raceDialog->getRace(), raceDialog->getGender() == RaceDialog::GM_Male);
|
environment.mMechanicsManager->setPlayerRace(raceDialog->getRaceId(), raceDialog->getGender() == RaceDialog::GM_Male);
|
||||||
}
|
}
|
||||||
delete raceDialog;
|
delete raceDialog;
|
||||||
raceDialog = nullptr;
|
raceDialog = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue