Cheats - fix insert separator

This commit is contained in:
adelikat 2013-11-05 16:53:24 +00:00
parent 8a2a673528
commit 5c22d7433c
1 changed files with 12 additions and 8 deletions

View File

@ -101,18 +101,22 @@ namespace BizHawk.Client.Common
_cheatList.ForEach(x => x.Pulse());
}
public void Add(Cheat c)
public void Add(Cheat cheat)
{
c.Changed += CheatChanged;
if (_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address))
if (!cheat.IsSeparator)
{
_cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address).Enable();
}
else
{
_cheatList.Add(c);
cheat.Changed += CheatChanged;
if (_cheatList.Any(x => x.Domain == cheat.Domain && x.Address == cheat.Address))
{
_cheatList.FirstOrDefault(x => x.Domain == cheat.Domain && x.Address == cheat.Address).Enable();
}
else
{
_cheatList.Add(cheat);
}
}
_cheatList.Add(cheat);
Changes = true;
}