1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 09:53:50 +00:00

Merge branch 'find_char' into 'master'

Use a char instead of a string in find() where possible

See merge request OpenMW/openmw!781
This commit is contained in:
Alexei Dobrohotov 2021-04-25 21:29:47 +00:00
commit 6b41bdf7b4
3 changed files with 5 additions and 4 deletions

View file

@ -273,7 +273,7 @@ namespace MWGui
std::string widgetName = userStringPair.first.substr(underscorePos+1, userStringPair.first.size()-(underscorePos+1)); std::string widgetName = userStringPair.first.substr(underscorePos+1, userStringPair.first.size()-(underscorePos+1));
type = "Property"; type = "Property";
size_t caretPos = key.find("^"); size_t caretPos = key.find('^');
if (caretPos != std::string::npos) if (caretPos != std::string::npos)
{ {
type = key.substr(0, caretPos); type = key.substr(0, caretPos);

View file

@ -1017,8 +1017,9 @@ namespace MWGui
if(tag.compare(0, MyGuiPrefixLength, MyGuiPrefix) == 0) if(tag.compare(0, MyGuiPrefixLength, MyGuiPrefix) == 0)
{ {
tag = tag.substr(MyGuiPrefixLength, tag.length()); tag = tag.substr(MyGuiPrefixLength, tag.length());
std::string settingSection = tag.substr(0, tag.find(",")); size_t comma_pos = tag.find(',');
std::string settingTag = tag.substr(tag.find(",")+1, tag.length()); std::string settingSection = tag.substr(0, comma_pos);
std::string settingTag = tag.substr(comma_pos+1, tag.length());
_result = Settings::Manager::getString(settingTag, settingSection); _result = Settings::Manager::getString(settingTag, settingSection);
} }

View file

@ -966,7 +966,7 @@ void CharacterController::handleTextKey(const std::string &groupname, SceneUtil:
// The event can optionally contain volume and pitch modifiers // The event can optionally contain volume and pitch modifiers
float volume=1.f, pitch=1.f; float volume=1.f, pitch=1.f;
if (soundgen.find(" ") != std::string::npos) if (soundgen.find(' ') != std::string::npos)
{ {
std::vector<std::string> tokens; std::vector<std::string> tokens;
split(soundgen, ' ', tokens); split(soundgen, ' ', tokens);