From ed3bf29600d3e8e7cb88629bfe6da9db6339c6a8 Mon Sep 17 00:00:00 2001 From: ClxS Date: Fri, 4 Mar 2016 22:21:16 +0000 Subject: A few small clean ups and removed a lot of the readme until I think of what to put there --- StardewModdingAPI/Inheritance/SGame.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'StardewModdingAPI/Inheritance') diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index 36f905f7..69439209 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -66,8 +66,15 @@ namespace StardewModdingAPI.Inheritance public Farmer PreviousFarmer { get; private set; } + private static SGame instance; + public static SGame Instance { get { return instance; } } + + public Farmer CurrentFarmer { get { return player; } } + public SGame() { + instance = this; + if (Program.debug) { SaveGame.serializer = new XmlSerializer(typeof (SaveGame), new Type[28] @@ -195,11 +202,7 @@ namespace StardewModdingAPI.Inheritance public static SGameLocation GetLocationFromName(String name) { - if (ModLocations.Any(x => x.name == name)) - { - return ModLocations[ModLocations.IndexOf(ModLocations.First(x => x.name == name))]; - } - return null; + return ModLocations.FirstOrDefault(n => n.name == name); } public static SGameLocation LoadOrCreateSGameLocationFromName(String name) -- cgit