diff options
Diffstat (limited to 'src/SMAPI/Utilities')
-rw-r--r-- | src/SMAPI/Utilities/SDate.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/SMAPI/Utilities/SDate.cs b/src/SMAPI/Utilities/SDate.cs index ec54f84a..0ab37aa0 100644 --- a/src/SMAPI/Utilities/SDate.cs +++ b/src/SMAPI/Utilities/SDate.cs @@ -86,7 +86,7 @@ namespace StardewModdingAPI.Utilities seasonIndex %= 4; // get year - int year = hashCode / (this.Seasons.Length * this.DaysInSeason) + 1; + int year = (int)Math.Ceiling(hashCode / (this.Seasons.Length * this.DaysInSeason * 1m)); // create date return new SDate(day, this.Seasons[seasonIndex], year); @@ -192,12 +192,12 @@ namespace StardewModdingAPI.Utilities throw new ArgumentException($"Unknown season '{season}', must be one of [{string.Join(", ", this.Seasons)}]."); if (day < 0 || day > this.DaysInSeason) throw new ArgumentException($"Invalid day '{day}', must be a value from 1 to {this.DaysInSeason}."); - if(day == 0 && !(allowDayZero && this.IsDayZero(day, season, year))) + if (day == 0 && !(allowDayZero && this.IsDayZero(day, season, year))) throw new ArgumentException($"Invalid day '{day}', must be a value from 1 to {this.DaysInSeason}."); if (year < 1) throw new ArgumentException($"Invalid year '{year}', must be at least 1."); - // initialise + // initialize this.Day = day; this.Season = season; this.Year = year; @@ -256,12 +256,12 @@ namespace StardewModdingAPI.Utilities /// <summary>Get a season index.</summary> /// <param name="season">The season name.</param> - /// <exception cref="InvalidOperationException">The current season wasn't recognised.</exception> + /// <exception cref="InvalidOperationException">The current season wasn't recognized.</exception> private int GetSeasonIndex(string season) { int index = Array.IndexOf(this.Seasons, season); if (index == -1) - throw new InvalidOperationException($"The season '{season}' wasn't recognised."); + throw new InvalidOperationException($"The season '{season}' wasn't recognized."); return index; } } |