Fixed an NAN error and glitching the interface logic.

This commit is contained in:
2017-12-12 01:19:41 -08:00
parent b7c76ee0d6
commit 34d072e7a4
4 changed files with 28 additions and 2 deletions

View File

@ -21,5 +21,10 @@ namespace StardustCore
{
return args.Contains(obj);
}
public static bool HasValue(this double value)
{
return !Double.IsNaN(value) && !Double.IsInfinity(value);
}
}
}

View File

@ -19,13 +19,13 @@ namespace StarAI.InterfaceCore
//WindowsInput.InputSimulator.SimulateKeyUp(WindowsInput.VirtualKeyCode.ESCAPE);
ModCore.CoreMonitor.Log(Game1.activeClickableMenu.ToString());
while(Game1.activeClickableMenu is StardewValley.Menus.DialogueBox)
if(Game1.activeClickableMenu is StardewValley.Menus.DialogueBox)
{
Game1.activeClickableMenu.exitThisMenu(true);
ModCore.CoreMonitor.Log("BYE");
}
while (Game1.activeClickableMenu is StardewValley.Menus.ShippingMenu)
if (Game1.activeClickableMenu is StardewValley.Menus.ShippingMenu)
{
//(Game1.activeClickableMenu as StardewValley.Menus.ShippingMenu).readyToClose
//Game1.activeClickableMenu.exitThisMenu(true);

View File

@ -79,6 +79,19 @@ namespace StarAI
private void SaveEvents_BeforeSave(object sender, EventArgs e)
{
List<TileNode> removalList = new List<TileNode>();
foreach(var v in StardustCore.ModCore.SerializationManager.trackedObjectList)
{
if(v.getCategoryName()=="Tile Node")
{
//StardustCore.ModCore.SerializationManager.trackedObjectList.Remove(v);
removalList.Add((v as TileNode));
}
}
foreach(var v in removalList)
{
StardustCore.ModCore.SerializationManager.trackedObjectList.Remove(v);
}
Stack<IClickableMenu> menus = new Stack<IClickableMenu>();

View File

@ -113,6 +113,14 @@ namespace StarAI.UtilityCore
foreach (var v in CropSeedUtilityDictionary)
{
if (StardustCore.StaticExtentions.HasValue(CropSeedUtilityDictionary[v.Key]) == false)
{
CropSeedUtilityDictionary[v.Key] = 0;
}
if (StardustCore.StaticExtentions.HasValue(UserCropSeedUtilityDictionary[v.Key]) == false)
{
UserCropSeedUtilityDictionary[v.Key] = 0;
}
float scale = CropSeedUtilityDictionary[v.Key] + UserCropSeedUtilityDictionary[v.Key];
if (scale <= 0)
{