mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 08:09:46 +00:00
Use static constexpr string_view for hardcoded ids
This commit is contained in:
parent
d5954aba68
commit
e1f580e7a0
1 changed files with 15 additions and 20 deletions
|
@ -107,17 +107,16 @@ void CSMDoc::Document::addOptionalGmsts()
|
||||||
|
|
||||||
void CSMDoc::Document::addOptionalGlobals()
|
void CSMDoc::Document::addOptionalGlobals()
|
||||||
{
|
{
|
||||||
static const char* sGlobals[] = {
|
static constexpr std::string_view globals[] = {
|
||||||
"DaysPassed",
|
"DaysPassed",
|
||||||
"PCWerewolf",
|
"PCWerewolf",
|
||||||
"PCYear",
|
"PCYear",
|
||||||
nullptr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; sGlobals[i]; ++i)
|
for (std::size_t i = 0; i < std::size(globals); ++i)
|
||||||
{
|
{
|
||||||
ESM::Global global;
|
ESM::Global global;
|
||||||
global.mId = ESM::RefId::stringRefId(sGlobals[i]);
|
global.mId = ESM::RefId::stringRefId(globals[i]);
|
||||||
global.blank();
|
global.blank();
|
||||||
global.mValue.setType(ESM::VT_Long);
|
global.mValue.setType(ESM::VT_Long);
|
||||||
|
|
||||||
|
@ -176,7 +175,7 @@ void CSMDoc::Document::addOptionalMagicEffect(const ESM::MagicEffect& magicEffec
|
||||||
|
|
||||||
void CSMDoc::Document::createBase()
|
void CSMDoc::Document::createBase()
|
||||||
{
|
{
|
||||||
static const char* sGlobals[] = {
|
static constexpr std::string_view globals[] = {
|
||||||
"Day",
|
"Day",
|
||||||
"DaysPassed",
|
"DaysPassed",
|
||||||
"GameHour",
|
"GameHour",
|
||||||
|
@ -185,13 +184,12 @@ void CSMDoc::Document::createBase()
|
||||||
"PCVampire",
|
"PCVampire",
|
||||||
"PCWerewolf",
|
"PCWerewolf",
|
||||||
"PCYear",
|
"PCYear",
|
||||||
nullptr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; sGlobals[i]; ++i)
|
for (std::size_t i = 0; i < std::size(globals); ++i)
|
||||||
{
|
{
|
||||||
ESM::Global record;
|
ESM::Global record;
|
||||||
record.mId = ESM::RefId::stringRefId(sGlobals[i]);
|
record.mId = ESM::RefId::stringRefId(globals[i]);
|
||||||
record.mRecordFlags = 0;
|
record.mRecordFlags = 0;
|
||||||
record.mValue.setType(i == 2 ? ESM::VT_Float : ESM::VT_Long);
|
record.mValue.setType(i == 2 ? ESM::VT_Float : ESM::VT_Long);
|
||||||
|
|
||||||
|
@ -213,7 +211,7 @@ void CSMDoc::Document::createBase()
|
||||||
getData().getSkills().add(record);
|
getData().getSkills().add(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* sVoice[] = {
|
static constexpr std::string_view voices[] = {
|
||||||
"Intruder",
|
"Intruder",
|
||||||
"Attack",
|
"Attack",
|
||||||
"Hello",
|
"Hello",
|
||||||
|
@ -222,20 +220,19 @@ void CSMDoc::Document::createBase()
|
||||||
"Idle",
|
"Idle",
|
||||||
"Flee",
|
"Flee",
|
||||||
"Hit",
|
"Hit",
|
||||||
nullptr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; sVoice[i]; ++i)
|
for (const std::string_view voice : voices)
|
||||||
{
|
{
|
||||||
ESM::Dialogue record;
|
ESM::Dialogue record;
|
||||||
record.mId = ESM::RefId::stringRefId(sVoice[i]);
|
record.mId = ESM::RefId::stringRefId(voice);
|
||||||
record.mType = ESM::Dialogue::Voice;
|
record.mType = ESM::Dialogue::Voice;
|
||||||
record.blank();
|
record.blank();
|
||||||
|
|
||||||
getData().getTopics().add(record);
|
getData().getTopics().add(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* sGreetings[] = {
|
static constexpr std::string_view greetings[] = {
|
||||||
"Greeting 0",
|
"Greeting 0",
|
||||||
"Greeting 1",
|
"Greeting 1",
|
||||||
"Greeting 2",
|
"Greeting 2",
|
||||||
|
@ -246,20 +243,19 @@ void CSMDoc::Document::createBase()
|
||||||
"Greeting 7",
|
"Greeting 7",
|
||||||
"Greeting 8",
|
"Greeting 8",
|
||||||
"Greeting 9",
|
"Greeting 9",
|
||||||
nullptr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; sGreetings[i]; ++i)
|
for (const std::string_view greeting : greetings)
|
||||||
{
|
{
|
||||||
ESM::Dialogue record;
|
ESM::Dialogue record;
|
||||||
record.mId = ESM::RefId::stringRefId(sGreetings[i]);
|
record.mId = ESM::RefId::stringRefId(greeting);
|
||||||
record.mType = ESM::Dialogue::Greeting;
|
record.mType = ESM::Dialogue::Greeting;
|
||||||
record.blank();
|
record.blank();
|
||||||
|
|
||||||
getData().getTopics().add(record);
|
getData().getTopics().add(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* sPersuasion[] = {
|
static constexpr std::string_view persuasions[] = {
|
||||||
"Intimidate Success",
|
"Intimidate Success",
|
||||||
"Intimidate Fail",
|
"Intimidate Fail",
|
||||||
"Service Refusal",
|
"Service Refusal",
|
||||||
|
@ -270,13 +266,12 @@ void CSMDoc::Document::createBase()
|
||||||
"Admire Fail",
|
"Admire Fail",
|
||||||
"Taunt Fail",
|
"Taunt Fail",
|
||||||
"Bribe Fail",
|
"Bribe Fail",
|
||||||
nullptr,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; sPersuasion[i]; ++i)
|
for (const std::string_view persuasion : persuasions)
|
||||||
{
|
{
|
||||||
ESM::Dialogue record;
|
ESM::Dialogue record;
|
||||||
record.mId = ESM::RefId::stringRefId(sPersuasion[i]);
|
record.mId = ESM::RefId::stringRefId(persuasion);
|
||||||
record.mType = ESM::Dialogue::Persuasion;
|
record.mType = ESM::Dialogue::Persuasion;
|
||||||
record.blank();
|
record.blank();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue