Fix a minor bug where cloned items lost the last ID. Broke all sorts of things.
This commit is contained in:
parent
71f43c4f24
commit
61aa50044e
@ -96,6 +96,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
public static void Clone(Network source, Network dest)
|
||||
{
|
||||
int lastID = 0;
|
||||
dest.AlreadyDisplayedMessage = false;
|
||||
dest.DefaultTimeout = source.DefaultTimeout;
|
||||
dest.HintsToDisplay = source.HintsToDisplay;
|
||||
@ -103,9 +104,12 @@ namespace EduNetworkBuilder
|
||||
dest.Level = source.Level;
|
||||
dest.myHeight = source.myHeight;
|
||||
dest.myWidth = source.myWidth;
|
||||
dest.UniqueIdentifier = source.UniqueIdentifier;
|
||||
|
||||
//dest.NetComponents
|
||||
foreach(NetworkComponent NC in source.NetComponents)
|
||||
foreach (NetworkComponent NC in source.NetComponents)
|
||||
{
|
||||
if (NC.GetUniqueIdentifier > lastID) lastID = NC.GetUniqueIdentifier;
|
||||
dest.NetComponents.Add(NetworkComponent.Clone(NC));
|
||||
}
|
||||
//dest.NetTests
|
||||
@ -121,6 +125,9 @@ namespace EduNetworkBuilder
|
||||
dest.NetMessage = new LanguageStrings(source.NetMessage);
|
||||
dest.WhatFrom = source.WhatFrom; //We remember the schoolwork class we came from.
|
||||
dest.PuzzleIsSolved = source.PuzzleIsSolved;
|
||||
//In case the number was incorrect. Fix it.
|
||||
if (lastID >= dest.UniqueIdentifier) dest.UniqueIdentifier = lastID + 1;
|
||||
|
||||
}
|
||||
|
||||
public Network Clone()
|
||||
|
Loading…
Reference in New Issue
Block a user