mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-31 19:20:26 +00:00
Use more string_view
This commit is contained in:
parent
bedfbfd594
commit
dfcd34372d
@ -163,7 +163,7 @@ namespace MWClass
|
|||||||
text += "\n#{sType} ";
|
text += "\n#{sType} ";
|
||||||
|
|
||||||
int skill = MWMechanics::getWeaponType(ref->mBase->mData.mType)->mSkill;
|
int skill = MWMechanics::getWeaponType(ref->mBase->mData.mType)->mSkill;
|
||||||
const std::string type = ESM::Skill::sSkillNameIds[skill];
|
const std::string& type = ESM::Skill::sSkillNameIds[skill];
|
||||||
std::string_view oneOrTwoHanded;
|
std::string_view oneOrTwoHanded;
|
||||||
if (weaponType->mWeaponClass == ESM::WeaponType::Melee)
|
if (weaponType->mWeaponClass == ESM::WeaponType::Melee)
|
||||||
{
|
{
|
||||||
|
@ -393,7 +393,7 @@ namespace MWGui
|
|||||||
const ESM::Spell* spell =
|
const ESM::Spell* spell =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||||
|
|
||||||
std::string spellName = spell->mName;
|
const std::string& spellName = spell->mName;
|
||||||
if (spellName != mSpellName && mSpellVisible)
|
if (spellName != mSpellName && mSpellVisible)
|
||||||
{
|
{
|
||||||
mWeaponSpellTimer = 5.0f;
|
mWeaponSpellTimer = 5.0f;
|
||||||
@ -463,7 +463,7 @@ namespace MWGui
|
|||||||
|
|
||||||
void HUD::unsetSelectedSpell()
|
void HUD::unsetSelectedSpell()
|
||||||
{
|
{
|
||||||
std::string spellName = "#{sNone}";
|
std::string_view spellName = "#{sNone}";
|
||||||
if (spellName != mSpellName && mSpellVisible)
|
if (spellName != mSpellName && mSpellVisible)
|
||||||
{
|
{
|
||||||
mWeaponSpellTimer = 5.0f;
|
mWeaponSpellTimer = 5.0f;
|
||||||
|
@ -791,7 +791,7 @@ namespace MWGui
|
|||||||
|
|
||||||
int incr = next ? 1 : -1;
|
int incr = next ? 1 : -1;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
std::string lastId;
|
std::string_view lastId;
|
||||||
if (selected != -1)
|
if (selected != -1)
|
||||||
lastId = model.getItem(selected).mBase.getCellRef().getRefId();
|
lastId = model.getItem(selected).mBase.getCellRef().getRefId();
|
||||||
ItemModel::ModelIndex cycled = selected;
|
ItemModel::ModelIndex cycled = selected;
|
||||||
|
@ -93,7 +93,7 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
|
|
||||||
std::string name = *sender->getUserData<std::string>();
|
const std::string& name = *sender->getUserData<std::string>();
|
||||||
winMgr->playSound("Menu Click");
|
winMgr->playSound("Menu Click");
|
||||||
if (name == "return")
|
if (name == "return")
|
||||||
{
|
{
|
||||||
|
@ -287,16 +287,16 @@ namespace MWGui
|
|||||||
while (mConfigArea->getChildCount() > 0)
|
while (mConfigArea->getChildCount() > 0)
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mConfigArea->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(mConfigArea->getChildAt(0));
|
||||||
|
|
||||||
mShaderInfo->setCaption("");
|
mShaderInfo->setCaption({});
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
|
||||||
const std::string NA = "#{Interface:NotAvailableShort}";
|
const std::string_view NA = "#{Interface:NotAvailableShort}";
|
||||||
const std::string endl = "\n";
|
const char endl = '\n';
|
||||||
|
|
||||||
std::string author = technique->getAuthor().empty() ? NA : std::string(technique->getAuthor());
|
std::string_view author = technique->getAuthor().empty() ? NA : technique->getAuthor();
|
||||||
std::string version = technique->getVersion().empty() ? NA : std::string(technique->getVersion());
|
std::string_view version = technique->getVersion().empty() ? NA : technique->getVersion();
|
||||||
std::string description = technique->getDescription().empty() ? NA : std::string(technique->getDescription());
|
std::string_view description = technique->getDescription().empty() ? NA : technique->getDescription();
|
||||||
|
|
||||||
auto serializeBool = [](bool value) {
|
auto serializeBool = [](bool value) {
|
||||||
return value ? "#{sYes}" : "#{sNo}";
|
return value ? "#{sYes}" : "#{sNo}";
|
||||||
|
@ -68,7 +68,7 @@ void Recharge::updateView()
|
|||||||
{
|
{
|
||||||
MWWorld::Ptr gem = *mGemIcon->getUserData<MWWorld::Ptr>();
|
MWWorld::Ptr gem = *mGemIcon->getUserData<MWWorld::Ptr>();
|
||||||
|
|
||||||
std::string soul = gem.getCellRef().getSoul();
|
const std::string& soul = gem.getCellRef().getSoul();
|
||||||
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul);
|
const ESM::Creature *creature = MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul);
|
||||||
|
|
||||||
mChargeLabel->setCaptionWithReplacing("#{sCharges} " + MyGUI::utility::toString(creature->mData.mSoul));
|
mChargeLabel->setCaptionWithReplacing("#{sCharges} " + MyGUI::utility::toString(creature->mData.mSoul));
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "../mwstate/character.hpp"
|
#include "../mwstate/character.hpp"
|
||||||
|
|
||||||
#include "confirmationdialog.hpp"
|
#include "confirmationdialog.hpp"
|
||||||
|
#include "ustring.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
@ -177,7 +178,7 @@ namespace MWGui
|
|||||||
|
|
||||||
// For a custom class, we will not find it in the store (unless we loaded the savegame first).
|
// For a custom class, we will not find it in the store (unless we loaded the savegame first).
|
||||||
// Fall back to name stored in savegame header in that case.
|
// Fall back to name stored in savegame header in that case.
|
||||||
std::string className;
|
std::string_view className;
|
||||||
if (it->getSignature().mPlayerClassId.empty())
|
if (it->getSignature().mPlayerClassId.empty())
|
||||||
className = it->getSignature().mPlayerClassName;
|
className = it->getSignature().mPlayerClassName;
|
||||||
else
|
else
|
||||||
@ -191,7 +192,7 @@ namespace MWGui
|
|||||||
className = "?"; // From an older savegame format that did not support custom classes properly.
|
className = "?"; // From an older savegame format that did not support custom classes properly.
|
||||||
}
|
}
|
||||||
|
|
||||||
title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << MyGUI::TextIterator::toTagsString(className) << ")";
|
title << " (#{sLevel} " << it->getSignature().mPlayerLevel << " " << MyGUI::TextIterator::toTagsString(toUString(className)) << ")";
|
||||||
|
|
||||||
mCharacterSelection->addItem (MyGUI::LanguageManager::getInstance().replaceTags(title.str()));
|
mCharacterSelection->addItem (MyGUI::LanguageManager::getInstance().replaceTags(title.str()));
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ namespace MWGui
|
|||||||
, mCurrentPage(-1)
|
, mCurrentPage(-1)
|
||||||
{
|
{
|
||||||
bool terrain = Settings::Manager::getBool("distant terrain", "Terrain");
|
bool terrain = Settings::Manager::getBool("distant terrain", "Terrain");
|
||||||
const std::string widgetName = terrain ? "RenderingDistanceSlider" : "LargeRenderingDistanceSlider";
|
const std::string_view widgetName = terrain ? "RenderingDistanceSlider" : "LargeRenderingDistanceSlider";
|
||||||
MyGUI::Widget* unusedSlider;
|
MyGUI::Widget* unusedSlider;
|
||||||
getWidget(unusedSlider, widgetName);
|
getWidget(unusedSlider, widgetName);
|
||||||
unusedSlider->setVisible(false);
|
unusedSlider->setVisible(false);
|
||||||
|
@ -34,10 +34,7 @@ namespace MWGui
|
|||||||
|
|
||||||
bool SpellBuyingWindow::sortSpells (const ESM::Spell* left, const ESM::Spell* right)
|
bool SpellBuyingWindow::sortSpells (const ESM::Spell* left, const ESM::Spell* right)
|
||||||
{
|
{
|
||||||
std::string leftName = Misc::StringUtils::lowerCase(left->mName);
|
return Misc::StringUtils::ciLess(left->mName, right->mName);
|
||||||
std::string rightName = Misc::StringUtils::lowerCase(right->mName);
|
|
||||||
|
|
||||||
return leftName.compare(rightName) < 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellBuyingWindow::addSpell(const ESM::Spell& spell)
|
void SpellBuyingWindow::addSpell(const ESM::Spell& spell)
|
||||||
|
@ -555,7 +555,7 @@ namespace MWGui
|
|||||||
|
|
||||||
for (const short effectId : knownEffects)
|
for (const short effectId : knownEffects)
|
||||||
{
|
{
|
||||||
std::string name = MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
|
const std::string& name = MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
|
||||||
ESM::MagicEffect::effectIdToString(effectId))->mValue.getString();
|
ESM::MagicEffect::effectIdToString(effectId))->mValue.getString();
|
||||||
MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name);
|
MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name);
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ namespace MWGui
|
|||||||
image->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon,
|
image->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon,
|
||||||
MWBase::Environment::get().getResourceSystem()->getVFS()));
|
MWBase::Environment::get().getResourceSystem()->getVFS()));
|
||||||
|
|
||||||
std::string name = ESM::MagicEffect::effectIdToString (effectId);
|
const std::string& name = ESM::MagicEffect::effectIdToString(effectId);
|
||||||
|
|
||||||
ToolTipInfo tooltipInfo;
|
ToolTipInfo tooltipInfo;
|
||||||
tooltipInfo.caption = "#{" + name + "}";
|
tooltipInfo.caption = "#{" + name + "}";
|
||||||
|
@ -147,7 +147,7 @@ namespace MWGui
|
|||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
std::string raceId = player.get<ESM::NPC>()->mBase->mRace;
|
const std::string& raceId = player.get<ESM::NPC>()->mBase->mRace;
|
||||||
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceId);
|
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceId);
|
||||||
// can't delete racial spells, birthsign spells or powers
|
// can't delete racial spells, birthsign spells or powers
|
||||||
bool isInherent = race->mPowers.exists(spell->mId) || spell->mData.mType == ESM::Spell::ST_Power;
|
bool isInherent = race->mPowers.exists(spell->mId) || spell->mData.mType == ESM::Spell::ST_Power;
|
||||||
|
@ -400,9 +400,9 @@ namespace MWGui
|
|||||||
else
|
else
|
||||||
mDynamicToolTipBox->changeWidgetSkin(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "HUD_Box_NoTransp" : "HUD_Box");
|
mDynamicToolTipBox->changeWidgetSkin(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "HUD_Box_NoTransp" : "HUD_Box");
|
||||||
|
|
||||||
std::string caption = info.caption;
|
const std::string& caption = info.caption;
|
||||||
std::string image = info.icon;
|
const std::string& image = info.icon;
|
||||||
int imageSize = (image != "") ? info.imageSize : 0;
|
int imageSize = (!image.empty()) ? info.imageSize : 0;
|
||||||
std::string text = info.text;
|
std::string text = info.text;
|
||||||
|
|
||||||
// remove the first newline (easier this way)
|
// remove the first newline (easier this way)
|
||||||
@ -411,7 +411,7 @@ namespace MWGui
|
|||||||
|
|
||||||
const ESM::Enchantment* enchant = nullptr;
|
const ESM::Enchantment* enchant = nullptr;
|
||||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
if (info.enchant != "")
|
if (!info.enchant.empty())
|
||||||
{
|
{
|
||||||
enchant = store.get<ESM::Enchantment>().search(info.enchant);
|
enchant = store.get<ESM::Enchantment>().search(info.enchant);
|
||||||
if (enchant)
|
if (enchant)
|
||||||
@ -432,8 +432,8 @@ namespace MWGui
|
|||||||
|
|
||||||
const MyGUI::IntPoint padding(8, 8);
|
const MyGUI::IntPoint padding(8, 8);
|
||||||
|
|
||||||
const int imageCaptionHPadding = (caption != "" ? 8 : 0);
|
const int imageCaptionHPadding = !caption.empty() ? 8 : 0;
|
||||||
const int imageCaptionVPadding = (caption != "" ? 4 : 0);
|
const int imageCaptionVPadding = !caption.empty() ? 4 : 0;
|
||||||
|
|
||||||
const int maximumWidth = MyGUI::RenderManager::getInstance().getViewSize().width - imageCaptionHPadding * 2;
|
const int maximumWidth = MyGUI::RenderManager::getInstance().getViewSize().width - imageCaptionHPadding * 2;
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ namespace MWGui
|
|||||||
captionWidget->setCaptionWithReplacing(caption);
|
captionWidget->setCaptionWithReplacing(caption);
|
||||||
MyGUI::IntSize captionSize = captionWidget->getTextSize();
|
MyGUI::IntSize captionSize = captionWidget->getTextSize();
|
||||||
|
|
||||||
int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize);
|
int captionHeight = std::max(!caption.empty() ? captionSize.height : 0, imageSize);
|
||||||
|
|
||||||
Gui::EditBox* textWidget = mDynamicToolTipBox->createWidget<Gui::EditBox>("SandText", MyGUI::IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), MyGUI::Align::Stretch, "ToolTipText");
|
Gui::EditBox* textWidget = mDynamicToolTipBox->createWidget<Gui::EditBox>("SandText", MyGUI::IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), MyGUI::Align::Stretch, "ToolTipText");
|
||||||
textWidget->setEditStatic(true);
|
textWidget->setEditStatic(true);
|
||||||
@ -458,8 +458,8 @@ namespace MWGui
|
|||||||
MyGUI::IntSize textSize = textWidget->getTextSize();
|
MyGUI::IntSize textSize = textWidget->getTextSize();
|
||||||
|
|
||||||
captionSize += MyGUI::IntSize(imageSize, 0); // adjust for image
|
captionSize += MyGUI::IntSize(imageSize, 0); // adjust for image
|
||||||
MyGUI::IntSize totalSize = MyGUI::IntSize( std::min(std::max(textSize.width,captionSize.width + ((image != "") ? imageCaptionHPadding : 0)),maximumWidth),
|
MyGUI::IntSize totalSize = MyGUI::IntSize( std::min(std::max(textSize.width,captionSize.width + ((!image.empty()) ? imageCaptionHPadding : 0)),maximumWidth),
|
||||||
((text != "") ? textSize.height + imageCaptionVPadding : 0) + captionHeight );
|
(!text.empty() ? textSize.height + imageCaptionVPadding : 0) + captionHeight );
|
||||||
|
|
||||||
for (const std::string& note : info.notes)
|
for (const std::string& note : info.notes)
|
||||||
{
|
{
|
||||||
@ -578,7 +578,7 @@ namespace MWGui
|
|||||||
|
|
||||||
textWidget->setPosition (textWidget->getPosition() + MyGUI::IntPoint(0, padding.top)); // only apply vertical padding, the horizontal works automatically due to Align::HCenter
|
textWidget->setPosition (textWidget->getPosition() + MyGUI::IntPoint(0, padding.top)); // only apply vertical padding, the horizontal works automatically due to Align::HCenter
|
||||||
|
|
||||||
if (image != "")
|
if (!image.empty())
|
||||||
{
|
{
|
||||||
MyGUI::ImageBox* imageWidget = mDynamicToolTipBox->createWidget<MyGUI::ImageBox>("ImageBox",
|
MyGUI::ImageBox* imageWidget = mDynamicToolTipBox->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||||
MyGUI::IntCoord((totalSize.width - captionSize.width - imageCaptionHPadding)/2, 0, imageSize, imageSize),
|
MyGUI::IntCoord((totalSize.width - captionSize.width - imageCaptionHPadding)/2, 0, imageSize, imageSize),
|
||||||
@ -611,7 +611,7 @@ namespace MWGui
|
|||||||
std::string ToolTips::getWeightString(const float weight, const std::string& prefix)
|
std::string ToolTips::getWeightString(const float weight, const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (weight == 0)
|
if (weight == 0)
|
||||||
return "";
|
return {};
|
||||||
else
|
else
|
||||||
return "\n" + prefix + ": " + toString(weight);
|
return "\n" + prefix + ": " + toString(weight);
|
||||||
}
|
}
|
||||||
@ -619,7 +619,7 @@ namespace MWGui
|
|||||||
std::string ToolTips::getPercentString(const float value, const std::string& prefix)
|
std::string ToolTips::getPercentString(const float value, const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return "";
|
return {};
|
||||||
else
|
else
|
||||||
return "\n" + prefix + ": " + toString(value*100) +"%";
|
return "\n" + prefix + ": " + toString(value*100) +"%";
|
||||||
}
|
}
|
||||||
@ -627,15 +627,15 @@ namespace MWGui
|
|||||||
std::string ToolTips::getValueString(const int value, const std::string& prefix)
|
std::string ToolTips::getValueString(const int value, const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return "";
|
return {};
|
||||||
else
|
else
|
||||||
return "\n" + prefix + ": " + toString(value);
|
return "\n" + prefix + ": " + toString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ToolTips::getMiscString(const std::string& text, const std::string& prefix)
|
std::string ToolTips::getMiscString(const std::string& text, const std::string& prefix)
|
||||||
{
|
{
|
||||||
if (text == "")
|
if (text.empty())
|
||||||
return "";
|
return {};
|
||||||
else
|
else
|
||||||
return "\n" + prefix + ": " + text;
|
return "\n" + prefix + ": " + text;
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ namespace MWGui
|
|||||||
std::string ToolTips::getCountString(const int value)
|
std::string ToolTips::getCountString(const int value)
|
||||||
{
|
{
|
||||||
if (value == 1)
|
if (value == 1)
|
||||||
return "";
|
return {};
|
||||||
else
|
else
|
||||||
return " (" + MyGUI::utility::toString(value) + ")";
|
return " (" + MyGUI::utility::toString(value) + ")";
|
||||||
}
|
}
|
||||||
@ -652,11 +652,11 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
const std::string& soul = cellref.getSoul();
|
const std::string& soul = cellref.getSoul();
|
||||||
if (soul.empty())
|
if (soul.empty())
|
||||||
return std::string();
|
return {};
|
||||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
const ESM::Creature *creature = store.get<ESM::Creature>().search(soul);
|
const ESM::Creature *creature = store.get<ESM::Creature>().search(soul);
|
||||||
if (!creature)
|
if (!creature)
|
||||||
return std::string();
|
return {};
|
||||||
if (creature->mName.empty())
|
if (creature->mName.empty())
|
||||||
return " (" + creature->mId + ")";
|
return " (" + creature->mId + ")";
|
||||||
return " (" + creature->mName + ")";
|
return " (" + creature->mName + ")";
|
||||||
@ -677,7 +677,7 @@ namespace MWGui
|
|||||||
if (cellref.getFactionRank() >= 0)
|
if (cellref.getFactionRank() >= 0)
|
||||||
{
|
{
|
||||||
int rank = cellref.getFactionRank();
|
int rank = cellref.getFactionRank();
|
||||||
const std::string rankName = fact->mRanks[rank];
|
const std::string& rankName = fact->mRanks[rank];
|
||||||
if (rankName.empty())
|
if (rankName.empty())
|
||||||
ret += getValueString(cellref.getFactionRank(), "Rank");
|
ret += getValueString(cellref.getFactionRank(), "Rank");
|
||||||
else
|
else
|
||||||
@ -802,9 +802,9 @@ namespace MWGui
|
|||||||
if (attributeId == -1)
|
if (attributeId == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string icon = ESM::Attribute::sAttributeIcons[attributeId];
|
const std::string& icon = ESM::Attribute::sAttributeIcons[attributeId];
|
||||||
std::string name = ESM::Attribute::sGmstAttributeIds[attributeId];
|
const std::string& name = ESM::Attribute::sGmstAttributeIds[attributeId];
|
||||||
std::string desc = ESM::Attribute::sGmstAttributeDescIds[attributeId];
|
const std::string& desc = ESM::Attribute::sGmstAttributeDescIds[attributeId];
|
||||||
|
|
||||||
widget->setUserString("ToolTipType", "Layout");
|
widget->setUserString("ToolTipType", "Layout");
|
||||||
widget->setUserString("ToolTipLayout", "AttributeToolTip");
|
widget->setUserString("ToolTipLayout", "AttributeToolTip");
|
||||||
@ -850,12 +850,9 @@ namespace MWGui
|
|||||||
widget->setUserString("ToolTipType", "Layout");
|
widget->setUserString("ToolTipType", "Layout");
|
||||||
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
||||||
widget->setUserString("ImageTexture_BirthSignImage", Misc::ResourceHelpers::correctTexturePath(sign->mTexture, vfs));
|
widget->setUserString("ImageTexture_BirthSignImage", Misc::ResourceHelpers::correctTexturePath(sign->mTexture, vfs));
|
||||||
std::string text;
|
std::string text = sign->mName + "\n#{fontcolourhtml=normal}" + sign->mDescription;
|
||||||
|
|
||||||
text += sign->mName;
|
std::vector<const ESM::Spell*> abilities, powers, spells;
|
||||||
text += "\n#{fontcolourhtml=normal}" + sign->mDescription;
|
|
||||||
|
|
||||||
std::vector<std::string> abilities, powers, spells;
|
|
||||||
|
|
||||||
for (const std::string& spellId : sign->mPowers.mList)
|
for (const std::string& spellId : sign->mPowers.mList)
|
||||||
{
|
{
|
||||||
@ -867,35 +864,27 @@ namespace MWGui
|
|||||||
continue; // We only want spell, ability and powers.
|
continue; // We only want spell, ability and powers.
|
||||||
|
|
||||||
if (type == ESM::Spell::ST_Ability)
|
if (type == ESM::Spell::ST_Ability)
|
||||||
abilities.push_back(spellId);
|
abilities.push_back(spell);
|
||||||
else if (type == ESM::Spell::ST_Power)
|
else if (type == ESM::Spell::ST_Power)
|
||||||
powers.push_back(spellId);
|
powers.push_back(spell);
|
||||||
else if (type == ESM::Spell::ST_Spell)
|
else if (type == ESM::Spell::ST_Spell)
|
||||||
spells.push_back(spellId);
|
spells.push_back(spell);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
using Category = std::pair<const std::vector<const ESM::Spell*>&, std::string_view>;
|
||||||
const std::vector<std::string> &spells;
|
for (const auto&[category, label] : std::initializer_list<Category>{{abilities, "sBirthsignmenu1"}, {powers, "sPowers"}, {spells, "sBirthsignmenu2"}})
|
||||||
std::string label;
|
|
||||||
}
|
|
||||||
categories[3] = {
|
|
||||||
{abilities, "sBirthsignmenu1"},
|
|
||||||
{powers, "sPowers"},
|
|
||||||
{spells, "sBirthsignmenu2"}
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int category = 0; category < 3; ++category)
|
|
||||||
{
|
{
|
||||||
bool addHeader = true;
|
bool addHeader = true;
|
||||||
for (const std::string& spellId : categories[category].spells)
|
for (const ESM::Spell* spell : category)
|
||||||
{
|
{
|
||||||
if (addHeader)
|
if (addHeader)
|
||||||
{
|
{
|
||||||
text += std::string("\n\n#{fontcolourhtml=header}") + std::string("#{") + categories[category].label + "}";
|
text += "\n\n#{fontcolourhtml=header}#{";
|
||||||
|
text += label;
|
||||||
|
text += '}';
|
||||||
addHeader = false;
|
addHeader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellId);
|
|
||||||
text += "\n#{fontcolourhtml=normal}" + spell->mName;
|
text += "\n#{fontcolourhtml=normal}" + spell->mName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ void MWMechanics::AiPackage::openDoors(const MWWorld::Ptr& actor)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string keyId = door.getCellRef().getKey();
|
const std::string& keyId = door.getCellRef().getKey();
|
||||||
if (keyId.empty())
|
if (keyId.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ namespace MWMechanics
|
|||||||
actor.getClass().getCreatureStats(actor).getSpells().add(spell);
|
actor.getClass().getCreatureStats(actor).getSpells().add(spell);
|
||||||
MWBase::Environment::get().getWorld()->applyLoopingParticles(actor);
|
MWBase::Environment::get().getWorld()->applyLoopingParticles(actor);
|
||||||
|
|
||||||
std::string msg = "sMagicContractDisease";
|
std::string msg = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sMagicContractDisease")->mValue.getString();
|
||||||
msg = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(msg)->mValue.getString();
|
|
||||||
msg = Misc::StringUtils::format(msg, spell->mName);
|
msg = Misc::StringUtils::format(msg, spell->mName);
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox(msg);
|
MWBase::Environment::get().getWindowManager()->messageBox(msg);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto& target = getTarget();
|
const auto& target = getTarget();
|
||||||
const std::string targetSoul = target.getCellRef().getSoul();
|
const std::string& targetSoul = target.getCellRef().getSoul();
|
||||||
|
|
||||||
if (targetSoul.empty())
|
if (targetSoul.empty())
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ void MWWorld::ContainerStore::storeStates (const CellRefList<T>& collection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string MWWorld::ContainerStore::sGoldId = "gold_001";
|
const std::string_view MWWorld::ContainerStore::sGoldId = "gold_001";
|
||||||
|
|
||||||
MWWorld::ContainerStore::ContainerStore()
|
MWWorld::ContainerStore::ContainerStore()
|
||||||
: mListener(nullptr)
|
: mListener(nullptr)
|
||||||
|
@ -90,7 +90,7 @@ namespace MWWorld
|
|||||||
|
|
||||||
static constexpr int Type_All = 0xffff;
|
static constexpr int Type_All = 0xffff;
|
||||||
|
|
||||||
static const std::string sGoldId;
|
static const std::string_view sGoldId;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ContainerStoreListener* mListener;
|
ContainerStoreListener* mListener;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user