Incorrect times on days with no train
Suntooth opened this issue ยท 4 comments
On some days where no train is expected, notifications will show up saying times like "1:80pm" and "2:60pm". I've attached a save file from a day it was happening (the day before this supposed train at 1:80pm), along with the SMAPI log from that play session.
I think what's happening here is, the base game generates a pseudo-random number representing the time that a train will show up, and then every time the clock advances, one of the things it does is "if it's that time, then have a train show up". But it doesn't check whether the number is a value that the clock will actually ever hit (i.e. if the minutes part is 60 or more). So the mod should check for such numbers and skip displaying a message. (I adopted the Public Access TV mod which included this type of "skip making this prediction" logic, though I haven't dug into the base game code to confirm that I'm understanding it correctly.)
Another occurence of this bug, if it helps - this one said "11:70am".
Thanks @emurphy42! I think that was the problem. Just need to check if the "minutes" portion is less than 60 otherwise ignore it.