diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-06-09 16:26:01 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2019-09-14 18:03:11 -0400 |
commit | b47329d5b83db3b5ec2338af1f17d628610b05f2 (patch) | |
tree | 204fa958ef5a6eb4ab1406f3710d3260959e2e4a /src/SMAPI | |
parent | c28c3ff0818928ee611f885541c2c1ddaaac2536 (diff) | |
download | SMAPI-b47329d5b83db3b5ec2338af1f17d628610b05f2.tar.gz SMAPI-b47329d5b83db3b5ec2338af1f17d628610b05f2.tar.bz2 SMAPI-b47329d5b83db3b5ec2338af1f17d628610b05f2.zip |
fix year edge case in date calculations
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Utilities/SDate.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/SMAPI/Utilities/SDate.cs b/src/SMAPI/Utilities/SDate.cs index ec54f84a..9ea4f370 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,7 +192,7 @@ 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."); |