public Data() { //Define Containers _gfs = new Dictionary <GFs, GFData>(16); _characters = new Dictionary <Characters, CharacterData>(8); _shops = new List <Shop>(20); Items = new List <Item>(198); TimePlayed = new TimeSpan(); CoordinateX = new short[3]; CoordinateY = new short[3]; TriangleID = new ushort[3]; FieldVars = new FieldVars(); //0x0D70 http://wiki.ffrtt.ru/index.php/FF8/Variables WorldMap = new Worldmap(); //br.ReadBytes(128);//0x1270 TripleTriad = new TripleTriad(); //br.ReadBytes(128);//0x12F0 ChocoboWorld = new ChocoboWorld(); //br.ReadBytes(64);//0x1370 }
/// <summary> /// preforms a Shadow Copy. Then does deep copy on any required objects. /// </summary> /// <returns></returns> public Data Clone() { Memory.Log.WriteLine($"{nameof(Saves)} :: {nameof(Data)} :: {nameof(Clone)} "); //shadow copy Data d = (Data)MemberwiseClone(); //deep copy anything that needs it here. d._characters = _characters.ToDictionary(x => x.Key, x => (CharacterData)x.Value.Clone()); d._gfs = _gfs.ToDictionary(x => x.Key, x => (GFData)x.Value.Clone()); d.ChocoboWorld = ChocoboWorld.Clone(); d.FieldVars = FieldVars.Clone(); d.WorldMap = WorldMap.Clone(); d.TripleTriad = TripleTriad.Clone(); d.LimitBreakAngeloPoints = LimitBreakAngeloPoints.ToDictionary(x => x.Key, x => x.Value); d._shops = _shops.Select(x => x.Clone()).ToList(); d.Items = Items.Select(x => x.Clone()).ToList(); return(d); }