/// <summary> /// Helper for transferring objects between <c>GameLocation</c>s such as Sheds. /// Beware this is destructive to the <paramref name="destination"/> location's contents. /// This does not remove the objects from the <paramref name="source"/>, merely copies their references. /// </summary> public static void TransferObjects(GameLocation source, GameLocation destination) { // Saved objects that should persist ClearAndAdd(source.resourceClumps, destination.resourceClumps); destination.terrainFeatures.Clear(); foreach (var tfpair in source.terrainFeatures.Pairs) { destination.terrainFeatures.Add(tfpair.Key, tfpair.Value); } ClearAndAdd(source.largeTerrainFeatures, destination.largeTerrainFeatures); destination.objects.Clear(); SDVUtility.transferPlacedObjectsFromOneLocationToAnother(source, destination); ClearAndAdd(source.characters, destination.characters); ClearAndAdd(source.furniture, destination.furniture); // Unsaved objects that should persist if (source.IsOutdoors) { ClearAndAdd(source.critters, destination.critters); } ClearAndAdd(source.debris, destination.debris); source.numberOfSpawnedObjectsOnMap = destination.numberOfSpawnedObjectsOnMap; }