Fixed some removal issues with the trackedTerrainFeatures List

This commit is contained in:
Joshua Navarro 2017-01-06 23:38:28 -08:00
parent 3a012cae5e
commit 749bfdb24a
3 changed files with 21 additions and 3 deletions

View File

@ -76,7 +76,7 @@ namespace Revitalize
if (Game1.player.isMoving() == true && hasLoadedTerrainList == false) if (Game1.player.isMoving() == true && hasLoadedTerrainList == false)
{ {
Lists.loadAllLists(); Lists.loadAllLists();
Log.AsyncC("CHEEZNIPS!"); // Log.AsyncC("CHEEZNIPS!");
Util.WaterAllCropsInAllLocations(); Util.WaterAllCropsInAllLocations();
} }

View File

@ -850,7 +850,25 @@ namespace Revitalize
public static void serializeTrackedTerrainDataNodeList(List<TrackedTerrainDataNode> list) public static void serializeTrackedTerrainDataNodeList(List<TrackedTerrainDataNode> list)
{ {
Lists.trackedTerrainFeaturesDummyList.Clear(); Lists.trackedTerrainFeaturesDummyList.Clear();
foreach(var v in list) List<TrackedTerrainDataNode> removalList = new List<TrackedTerrainDataNode>();
foreach (var v in Lists.trackedTerrainFeatures)
{
if ((v.terrainFeature as HoeDirt).crop == null)
{
removalList.Add(v);
// Log.AsyncR("WHY REMOVE???");
continue;
}
}
foreach(var v in removalList)
{
Lists.trackedTerrainFeatures.Remove(v);
}
removalList.Clear();
foreach (var v in list)
{ {
Lists.trackedTerrainFeaturesDummyList.Add(new TrackedTerrainDummyDataNode(v.location.name, v.position)); Lists.trackedTerrainFeaturesDummyList.Add(new TrackedTerrainDummyDataNode(v.location.name, v.position));
} }

View File

@ -706,7 +706,7 @@ namespace Revitalize
public static void WaterAllCropsInAllLocations() public static void WaterAllCropsInAllLocations()
{ {
Game1.weatherForTomorrow = Game1.weather_rain; // Game1.weatherForTomorrow = Game1.weather_rain;
List<Revitalize.Resources.DataNodes.TrackedTerrainDataNode> removalList = new List<Resources.DataNodes.TrackedTerrainDataNode>(); List<Revitalize.Resources.DataNodes.TrackedTerrainDataNode> removalList = new List<Resources.DataNodes.TrackedTerrainDataNode>();
if (Game1.isRaining) if (Game1.isRaining)