Codechange: Split GetGroup into GetGroup/GetOrCreateGroup.

This follows the pattern used for GetItem/GetOrCreateItem, and allows use
of references where we know the group must exist.
This commit is contained in:
Peter Nelson
2023-10-10 19:25:58 +01:00
committed by Peter Nelson
parent 54b1a067eb
commit 6ce7195ef1
4 changed files with 36 additions and 26 deletions

View File

@@ -292,9 +292,9 @@ void HotkeyList::Load(IniFile &ini)
*/
void HotkeyList::Save(IniFile &ini) const
{
IniGroup *group = ini.GetGroup(this->ini_group);
IniGroup &group = ini.GetOrCreateGroup(this->ini_group);
for (const Hotkey &hotkey : this->items) {
IniItem &item = group->GetOrCreateItem(hotkey.name);
IniItem &item = group.GetOrCreateItem(hotkey.name);
item.SetValue(SaveKeycodes(hotkey));
}
}