When adding a cheat, if it already exists, update the existing instead of doing nothing!
This commit is contained in:
parent
76de0c4bdd
commit
92f8f9982c
|
@ -199,6 +199,11 @@ namespace BizHawk.Client.Common
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasCheat(Cheat cheat)
|
||||||
|
{
|
||||||
|
return _cheatList.FirstOrDefault(x => x.Domain == cheat.Domain && x.Address == cheat.Address) != null;
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveOnClose()
|
public void SaveOnClose()
|
||||||
{
|
{
|
||||||
if (Global.Config.CheatsAutoSaveOnClose)
|
if (Global.Config.CheatsAutoSaveOnClose)
|
||||||
|
|
|
@ -222,9 +222,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void AddCheat()
|
private void AddCheat()
|
||||||
{
|
{
|
||||||
Global.CheatList.Add(CheatEditor.Cheat);
|
if (Global.CheatList.HasCheat(CheatEditor.Cheat))
|
||||||
UpdateListView();
|
{
|
||||||
UpdateMessageLabel();
|
EditCheat();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Global.CheatList.Add(CheatEditor.Cheat);
|
||||||
|
UpdateListView();
|
||||||
|
UpdateMessageLabel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditCheat()
|
private void EditCheat()
|
||||||
|
|
Loading…
Reference in New Issue