When adding a cheat, if it already exists, update the existing instead of doing nothing!

This commit is contained in:
adelikat 2013-11-05 19:53:49 +00:00
parent 76de0c4bdd
commit 92f8f9982c
2 changed files with 15 additions and 3 deletions

View File

@ -199,6 +199,11 @@ namespace BizHawk.Client.Common
return false;
}
public bool HasCheat(Cheat cheat)
{
return _cheatList.FirstOrDefault(x => x.Domain == cheat.Domain && x.Address == cheat.Address) != null;
}
public void SaveOnClose()
{
if (Global.Config.CheatsAutoSaveOnClose)

View File

@ -222,9 +222,16 @@ namespace BizHawk.Client.EmuHawk
private void AddCheat()
{
Global.CheatList.Add(CheatEditor.Cheat);
UpdateListView();
UpdateMessageLabel();
if (Global.CheatList.HasCheat(CheatEditor.Cheat))
{
EditCheat();
}
else
{
Global.CheatList.Add(CheatEditor.Cheat);
UpdateListView();
UpdateMessageLabel();
}
}
private void EditCheat()