mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 06:40:09 +00:00
Merge branch 'refactor/esmvariant-string' into 'master'
Avoid string copies for ESM::Variant::getString See merge request OpenMW/openmw!1711
This commit is contained in:
commit
a59c56e3ca
@ -368,15 +368,15 @@ namespace MWGui
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
const std::string sPersuasion = gmst.find("sPersuasion")->mValue.getString();
|
||||
const std::string sCompanionShare = gmst.find("sCompanionShare")->mValue.getString();
|
||||
const std::string sBarter = gmst.find("sBarter")->mValue.getString();
|
||||
const std::string sSpells = gmst.find("sSpells")->mValue.getString();
|
||||
const std::string sTravel = gmst.find("sTravel")->mValue.getString();
|
||||
const std::string sSpellMakingMenuTitle = gmst.find("sSpellMakingMenuTitle")->mValue.getString();
|
||||
const std::string sEnchanting = gmst.find("sEnchanting")->mValue.getString();
|
||||
const std::string sServiceTrainingTitle = gmst.find("sServiceTrainingTitle")->mValue.getString();
|
||||
const std::string sRepair = gmst.find("sRepair")->mValue.getString();
|
||||
const std::string& sPersuasion = gmst.find("sPersuasion")->mValue.getString();
|
||||
const std::string& sCompanionShare = gmst.find("sCompanionShare")->mValue.getString();
|
||||
const std::string& sBarter = gmst.find("sBarter")->mValue.getString();
|
||||
const std::string& sSpells = gmst.find("sSpells")->mValue.getString();
|
||||
const std::string& sTravel = gmst.find("sTravel")->mValue.getString();
|
||||
const std::string& sSpellMakingMenuTitle = gmst.find("sSpellMakingMenuTitle")->mValue.getString();
|
||||
const std::string& sEnchanting = gmst.find("sEnchanting")->mValue.getString();
|
||||
const std::string& sServiceTrainingTitle = gmst.find("sServiceTrainingTitle")->mValue.getString();
|
||||
const std::string& sRepair = gmst.find("sRepair")->mValue.getString();
|
||||
|
||||
if (topic != sPersuasion && topic != sCompanionShare && topic != sBarter
|
||||
&& topic != sSpells && topic != sTravel && topic != sSpellMakingMenuTitle
|
||||
@ -605,10 +605,10 @@ namespace MWGui
|
||||
Goodbye* link = new Goodbye();
|
||||
link->eventActivated += MyGUI::newDelegate(this, &DialogueWindow::onGoodbyeActivated);
|
||||
mLinks.push_back(link);
|
||||
std::string goodbye = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGoodbye")->mValue.getString();
|
||||
const std::string& goodbye = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGoodbye")->mValue.getString();
|
||||
BookTypesetter::Style* questionStyle = typesetter->createHotStyle(body, textColours.answer, textColours.answerOver,
|
||||
textColours.answerPressed,
|
||||
TypesetBook::InteractiveId(link));
|
||||
textColours.answerPressed,
|
||||
TypesetBook::InteractiveId(link));
|
||||
typesetter->lineBreak();
|
||||
typesetter->write(questionStyle, to_utf8_span(goodbye.c_str()));
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ namespace MWGui
|
||||
|
||||
for (const int& skill : skills)
|
||||
{
|
||||
std::string skillName = gmst.find(ESM::Skill::sSkillNameIds[skill])->mValue.getString();
|
||||
const std::string& skillName = gmst.find(ESM::Skill::sSkillNameIds[skill])->mValue.getString();
|
||||
int skillValue = player.getClass().getNpcStats(player).getSkill(skill).getBase();
|
||||
std::string skillMsg = gmst.find("sNotifyMessage44")->mValue.getString();
|
||||
if (skill == ESM::Skill::Sneak || skill == ESM::Skill::Security)
|
||||
|
@ -48,7 +48,7 @@ namespace
|
||||
};
|
||||
}
|
||||
|
||||
std::string ESM::Variant::getString() const
|
||||
const std::string& ESM::Variant::getString() const
|
||||
{
|
||||
return std::get<std::string>(mData);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace ESM
|
||||
|
||||
VarType getType() const { return mType; }
|
||||
|
||||
std::string getString() const;
|
||||
const std::string& getString() const;
|
||||
///< Will throw an exception, if value can not be represented as a string.
|
||||
|
||||
int getInteger() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user