summaryrefslogtreecommitdiff
path: root/StardewModdingAPI/Inheritance
diff options
context:
space:
mode:
authorCarl <slxxls92@gmail.com>2016-03-08 16:51:13 +0000
committerCarl <slxxls92@gmail.com>2016-03-08 16:51:13 +0000
commitd65c97ab48a1c015d8622e33311c7e2ea8fcd0e5 (patch)
tree2e7d130a11429bf98d1b5b5042e64d1912b43aee /StardewModdingAPI/Inheritance
parent38f59b079ec9f24c574d2681a41555038b291b03 (diff)
parent626452834fed7f15e20f2ecc0d4103be69621193 (diff)
downloadSMAPI-d65c97ab48a1c015d8622e33311c7e2ea8fcd0e5.tar.gz
SMAPI-d65c97ab48a1c015d8622e33311c7e2ea8fcd0e5.tar.bz2
SMAPI-d65c97ab48a1c015d8622e33311c7e2ea8fcd0e5.zip
Merge pull request #16 from Jtfinlay/dev
Perf improvements
Diffstat (limited to 'StardewModdingAPI/Inheritance')
-rw-r--r--StardewModdingAPI/Inheritance/SGame.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs
index cccdff23..735cd58a 100644
--- a/StardewModdingAPI/Inheritance/SGame.cs
+++ b/StardewModdingAPI/Inheritance/SGame.cs
@@ -465,12 +465,13 @@ namespace StardewModdingAPI.Inheritance
{
Events.PlayerEvents.InvokeInventoryChanged(player.items, changedItems);
PreviousItems = player.items.Where(n => n != null).ToDictionary(n => n, n => n.Stack);
- }
+ }
- if(currentLocation != null && PreviousLocationObjects != currentLocation.objects.GetHash())
+ var objectHash = currentLocation?.objects?.GetHash();
+ if(objectHash != null && PreviousLocationObjects != objectHash)
{
Events.LocationEvents.InvokeOnNewLocationObject(currentLocation.objects);
- PreviousLocationObjects = currentLocation.objects.GetHash();
+ PreviousLocationObjects = objectHash ?? -1;
}
if (timeOfDay != PreviousTimeOfDay)