Add constructor for CSetting and use emplace_back

This commit is contained in:
Robert Müller 2023-07-22 16:30:10 +02:00
parent 1170add71e
commit d8c05115c9
2 changed files with 6 additions and 3 deletions

View file

@ -442,6 +442,11 @@ public:
struct CSetting
{
char m_aCommand[256];
CSetting(const char *pCommand)
{
str_copy(m_aCommand, pCommand);
}
};
std::vector<CSetting> m_vSettings;

View file

@ -502,9 +502,7 @@ bool CEditorMap::Load(const char *pFileName, int StorageType, const std::functio
while(pNext < pSettings + Size)
{
int StrSize = str_length(pNext) + 1;
CSetting Setting;
str_copy(Setting.m_aCommand, pNext);
m_vSettings.push_back(Setting);
m_vSettings.emplace_back(pNext);
pNext += StrSize;
}
}