mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Disassociate metadata's SAV reference from clone
Necessary for gen3 manual overrides; the fetched properties for Metadata should refer to the cloned data that it is using, not the original reference. Closes #3582
This commit is contained in:
parent
2bbd767066
commit
c5908b2b97
3 changed files with 5 additions and 7 deletions
|
@ -32,7 +32,7 @@ public abstract class SaveFile : ITrainerInfo, IGameValueLimit, IBoxDetailWallpa
|
|||
public SaveFile Clone()
|
||||
{
|
||||
var sav = CloneInternal();
|
||||
sav.Metadata = Metadata;
|
||||
sav.Metadata = Metadata with {SAV = sav};
|
||||
return sav;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -6,10 +6,9 @@ namespace PKHeX.Core;
|
|||
/// <summary>
|
||||
/// Tracks information about where the <see cref="SAV"/> originated from, and provides logic for saving to a file.
|
||||
/// </summary>
|
||||
public sealed class SaveFileMetadata
|
||||
public sealed record SaveFileMetadata(SaveFile SAV)
|
||||
{
|
||||
private readonly SaveFile SAV;
|
||||
public SaveFileMetadata(SaveFile sav) => SAV = sav;
|
||||
public SaveFile SAV { private get; init; } = SAV;
|
||||
|
||||
/// <summary>
|
||||
/// Full path where the <see cref="SAV"/> originated from.
|
||||
|
|
|
@ -738,6 +738,7 @@ public partial class Main : Form
|
|||
|
||||
PKME_Tabs.Focus(); // flush any pending changes
|
||||
StoreLegalSaveGameData(sav);
|
||||
ParseSettings.InitFromSaveFileData(sav); // physical GB, no longer used in logic
|
||||
RecentTrainerCache.SetRecentTrainer(sav);
|
||||
SpriteUtil.Initialize(sav); // refresh sprite generator
|
||||
dragout.Size = new Size(SpriteUtil.Spriter.Width, SpriteUtil.Spriter.Height);
|
||||
|
@ -877,8 +878,6 @@ public partial class Main : Form
|
|||
|
||||
private static bool SanityCheckSAV(ref SaveFile sav)
|
||||
{
|
||||
ParseSettings.InitFromSaveFileData(sav); // physical GB, no longer used in logic
|
||||
|
||||
if (sav.State.Exportable && sav is SAV3 s3)
|
||||
{
|
||||
if (ModifierKeys == Keys.Control || s3.IsCorruptPokedexFF())
|
||||
|
|
Loading…
Reference in a new issue