More fixes to the cheats system

This commit is contained in:
adelikat 2013-10-14 02:26:06 +00:00
parent 0a0b8ac173
commit 0e934d5454
3 changed files with 20 additions and 13 deletions

View File

@ -217,6 +217,7 @@ namespace BizHawk.MultiClient
if (!IsSeparator)
{
_val++;
Pulse();
}
}
@ -225,6 +226,7 @@ namespace BizHawk.MultiClient
if (!IsSeparator)
{
_val--;
Pulse();
}
}

View File

@ -94,25 +94,30 @@ namespace BizHawk.MultiClient
{
if (_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address))
{
var cheat = _cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address);
cheat.Enable();
_cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address).Enable();
}
else
{
_changes = true;
_cheatList.Add(c);
ToolHelpers.UpdateCheatRelatedTools();
}
_changes = true;
ToolHelpers.UpdateCheatRelatedTools();
}
public void Insert(int index, Cheat c)
{
if (!_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address))
if (_cheatList.Any(x => x.Domain == c.Domain && x.Address == c.Address))
{
_changes = true;
_cheatList.Insert(index, c);
ToolHelpers.UpdateCheatRelatedTools();
_cheatList.FirstOrDefault(x => x.Domain == c.Domain && x.Address == c.Address).Enable();
}
else
{
_cheatList.Insert(index, c);
}
_changes = true;
ToolHelpers.UpdateCheatRelatedTools();
}
public void Remove(Cheat c)
@ -545,7 +550,7 @@ namespace BizHawk.MultiClient
sb
.Append(cheat.AddressStr).Append('\t')
.Append(cheat.ValueStr).Append('\t')
.Append(cheat.Compare.HasValue ? cheat.Compare.Value : 'N').Append('\t')
.Append(cheat.Compare.HasValue ? cheat.Compare.Value.ToString() : "N").Append('\t')
.Append(cheat.Domain != null ? cheat.Domain.Name : String.Empty).Append('\t')
.Append(cheat.Enabled ? '1' : '0').Append('\t')
.Append(cheat.Name).Append('\t')

View File

@ -1692,8 +1692,8 @@ namespace BizHawk.MultiClient
{
if (Global.CheatList.IsActive(Domain, address))
{
var cheat = Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address);
cheat.Increment();
Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Increment();
Global.CheatList.FlagChanges();
}
else
{
@ -1730,8 +1730,8 @@ namespace BizHawk.MultiClient
{
if (Global.CheatList.IsActive(Domain, address))
{
var cheat = Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address);
cheat.Decrement();
Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Decrement();
Global.CheatList.FlagChanges();
}
else
{