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()); _cheatList.ForEach(x => x.Pulse());
} }
public void Add(Cheat c) public void Add(Cheat cheat)
{ {
c.Changed += CheatChanged; if (!cheat.IsSeparator)
if (_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address))
{ {
_cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address).Enable(); cheat.Changed += CheatChanged;
} if (_cheatList.Any(x => x.Domain == cheat.Domain && x.Address == cheat.Address))
else {
{ _cheatList.FirstOrDefault(x => x.Domain == cheat.Domain && x.Address == cheat.Address).Enable();
_cheatList.Add(c); }
else
{
_cheatList.Add(cheat);
}
} }
_cheatList.Add(cheat);
Changes = true; Changes = true;
} }