From 4e26cb7abc6fb699f0df9ddf1d50bc3ef2fe01c6 Mon Sep 17 00:00:00 2001 From: ClxS Date: Thu, 3 Mar 2016 18:50:22 +0000 Subject: Resolved static analysis issues Standardised event handlers so there's less hassle with future changes --- StardewModdingAPI/Inheritance/SGame.cs | 42 ++++++++++++++++---------------- StardewModdingAPI/Inheritance/SObject.cs | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'StardewModdingAPI/Inheritance') diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index bed57e34..21fbea70 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -170,14 +170,14 @@ namespace StardewModdingAPI.Inheritance { return ModItems.ElementAt(id).Value.Clone(); } - Program.LogError("ModItem Dictionary does not contain index: " + id); + Program.LogError("ModItem Dictionary does not contain index: " + id.ToString()); return null; } if (ModItems.ContainsKey(id)) { return ModItems[id].Clone(); } - Program.LogError("ModItem Dictionary does not contain ID: " + id); + Program.LogError("ModItem Dictionary does not contain ID: " + id.ToString()); return null; } @@ -226,62 +226,62 @@ namespace StardewModdingAPI.Inheritance Events.InvokeKeyPressed(k); if (KStateNow != KStatePrior) - { - Events.InvokeKeyboardChanged(KStateNow); + { + Events.InvokeKeyboardChanged(KStatePrior, KStateNow); KStatePrior = KStateNow; } if (MStateNow != MStatePrior) - { - Events.InvokeMouseChanged(MStateNow); + { + Events.InvokeMouseChanged(MStatePrior, MStateNow); MStatePrior = MStateNow; } if (activeClickableMenu != null && activeClickableMenu != PreviousActiveMenu) - { - Events.InvokeMenuChanged(activeClickableMenu); + { + Events.InvokeMenuChanged(PreviousActiveMenu, activeClickableMenu); PreviousActiveMenu = activeClickableMenu; } if (locations.GetHash() != PreviousGameLocations) - { + { Events.InvokeLocationsChanged(locations); PreviousGameLocations = locations.GetHash(); } if (currentLocation != PreviousGameLocation) - { - Events.InvokeCurrentLocationChanged(currentLocation); + { + Events.InvokeCurrentLocationChanged(PreviousGameLocation, currentLocation); PreviousGameLocation = currentLocation; } if (player != null && player != PreviousFarmer) - { - Events.InvokeFarmerChanged(player); + { + Events.InvokeFarmerChanged(PreviousFarmer, player); PreviousFarmer = player; } if (timeOfDay != PreviousTimeOfDay) - { - Events.InvokeTimeOfDayChanged(timeOfDay); + { + Events.InvokeTimeOfDayChanged(PreviousTimeOfDay, timeOfDay); PreviousTimeOfDay = timeOfDay; } if (dayOfMonth != PreviousDayOfMonth) - { - Events.InvokeDayOfMonthChanged(dayOfMonth); + { + Events.InvokeDayOfMonthChanged(PreviousDayOfMonth, dayOfMonth); PreviousDayOfMonth = dayOfMonth; } if (currentSeason != PreviousSeasonOfYear) - { - Events.InvokeSeasonOfYearChanged(currentSeason); + { + Events.InvokeSeasonOfYearChanged(PreviousSeasonOfYear, currentSeason); PreviousSeasonOfYear = currentSeason; } if (year != PreviousYearOfGame) - { - Events.InvokeYearOfGameChanged(year); + { + Events.InvokeYearOfGameChanged(PreviousYearOfGame, year); PreviousYearOfGame = year; } } diff --git a/StardewModdingAPI/Inheritance/SObject.cs b/StardewModdingAPI/Inheritance/SObject.cs index 023106b8..25cdb26e 100644 --- a/StardewModdingAPI/Inheritance/SObject.cs +++ b/StardewModdingAPI/Inheritance/SObject.cs @@ -132,7 +132,7 @@ namespace StardewModdingAPI.Inheritance if (drawStackNumber) { float scale = 0.5f + scaleSize; - Game1.drawWithBorder(string.Concat(this.stack), Color.Black, Color.White, location + new Vector2((float) Game1.tileSize - Game1.tinyFont.MeasureString(string.Concat(this.stack)).X * scale, (float) Game1.tileSize - (float) ((double) Game1.tinyFont.MeasureString(string.Concat(this.stack)).Y * 3.0f / 4.0f) * scale), 0.0f, scale, 1f, true); + Game1.drawWithBorder(string.Concat(this.stack.ToString()), Color.Black, Color.White, location + new Vector2((float) Game1.tileSize - Game1.tinyFont.MeasureString(string.Concat(this.stack.ToString())).X * scale, (float) Game1.tileSize - (float) ((double) Game1.tinyFont.MeasureString(string.Concat(this.stack.ToString())).Y * 3.0f / 4.0f) * scale), 0.0f, scale, 1f, true); } } -- cgit