fix an oops in last commit, and fix adding cheats via Cheats cheat form

This commit is contained in:
adelikat 2013-11-05 17:07:34 +00:00
parent 5c22d7433c
commit 9bbd8a07a6
2 changed files with 11 additions and 4 deletions

View File

@ -103,7 +103,11 @@ namespace BizHawk.Client.Common
public void Add(Cheat cheat)
{
if (!cheat.IsSeparator)
if (cheat.IsSeparator)
{
_cheatList.Add(cheat);
}
else
{
cheat.Changed += CheatChanged;
if (_cheatList.Any(x => x.Domain == cheat.Domain && x.Address == cheat.Address))
@ -116,7 +120,6 @@ namespace BizHawk.Client.Common
}
}
_cheatList.Add(cheat);
Changes = true;
}

View File

@ -266,7 +266,7 @@ namespace BizHawk.Client.EmuHawk
{
get
{
Watch w = Watch.GenerateWatch(
Watch watch = Watch.GenerateWatch(
ToolHelpers.DomainByName(DomainDropDown.SelectedItem.ToString()),
AddressBox.ToRawInt(),
GetCurrentSize(),
@ -274,7 +274,11 @@ namespace BizHawk.Client.EmuHawk
NameBox.Text,
BigEndianCheckBox.Checked);
return new Cheat(w, CompareBox.ToRawInt(), enabled: true);
return new Cheat(
watch,
ValueBox.ToRawInt(),
!String.IsNullOrWhiteSpace(CompareBox.Text) ? CompareBox.ToRawInt() : (int?)null
);
}
}