summaryrefslogtreecommitdiff
path: root/src/SMAPI/Utilities/SDate.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-11-24 13:49:30 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-11-24 13:49:30 -0500
commita3f21685049cabf2d824c8060dc0b1de47e9449e (patch)
treead9add30e9da2a50e0ea0245f1546b7378f0d282 /src/SMAPI/Utilities/SDate.cs
parent6521df7b131924835eb797251c1e956fae0d6e13 (diff)
parent277bf082675b98b95bf6184fe3c7a45b969c7ac2 (diff)
downloadSMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.tar.gz
SMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.tar.bz2
SMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Utilities/SDate.cs')
-rw-r--r--src/SMAPI/Utilities/SDate.cs10
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;
}
}