diff --git a/stardew-access/Features/TileInfo.cs b/stardew-access/Features/TileInfo.cs index 51c78d6..8c1dfa6 100644 --- a/stardew-access/Features/TileInfo.cs +++ b/stardew-access/Features/TileInfo.cs @@ -158,26 +158,33 @@ namespace stardew_access.Features #region Track dropped items if (MainClass.Config.TrackDroppedItems) { - NetCollection droppedItems = Game1.currentLocation.debris; - if (droppedItems.Count() > 0) + try { - foreach (var item in droppedItems) + NetCollection droppedItems = Game1.currentLocation.debris; + if (droppedItems.Count() > 0) { - int xPos = ((int)item.Chunks[0].position.Value.X / Game1.tileSize) + 1; - int yPos = ((int)item.Chunks[0].position.Value.Y / Game1.tileSize) + 1; - if (xPos != x || yPos != y) continue; + foreach (var item in droppedItems) + { + int xPos = ((int)item.Chunks[0].position.Value.X / Game1.tileSize) + 1; + int yPos = ((int)item.Chunks[0].position.Value.Y / Game1.tileSize) + 1; + if (xPos != x || yPos != y) continue; - if (item.item == null) continue; + if (item.item == null) continue; - string name = item.item.DisplayName; - int count = item.item.Stack; + string name = item.item.DisplayName; + int count = item.item.Stack; - if (toReturn == "") - return ($"Dropped Item: {count} {name}", CATEGORY.DroppedItems); - else - toReturn = $"{toReturn}, Dropped Item: {count} {name}"; + if (toReturn == "") + return ($"Dropped Item: {count} {name}", CATEGORY.DroppedItems); + else + toReturn = $"{toReturn}, Dropped Item: {count} {name}"; + } } } + catch (Exception e) + { + MainClass.ErrorLog($"An error occured while detecting dropped items:\n{e.Message}"); + } } #endregion diff --git a/stardew-access/ScreenReader/ScreenReaderWindows.cs b/stardew-access/ScreenReader/ScreenReaderWindows.cs index 33035ce..d9b2dbc 100644 --- a/stardew-access/ScreenReader/ScreenReaderWindows.cs +++ b/stardew-access/ScreenReader/ScreenReaderWindows.cs @@ -16,6 +16,7 @@ namespace stardew_access.ScreenReader public void InitializeScreenReader() { MainClass.InfoLog("Initializing Tolk..."); + Tolk.TrySAPI(true); Tolk.Load(); MainClass.InfoLog("Querying for the active screen reader driver...");