mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-14 00:15:11 -05:00
Fix Adventure Start Time editing
Previously only date was editable and the time was not considered. New logic takes first datetime, removes seconds, then adds the second datetime's seconds. Since the second datetime's date is 2000, 1, 1, the resulting value is just totalseconds (since midnight) regardless of date (which is the first datetime).
This commit is contained in:
@@ -446,7 +446,7 @@ private void getTextBoxes()
|
||||
CAL_LastSavedDate.Value = new DateTime(SAV.LastSavedYear, SAV.LastSavedMonth, SAV.LastSavedDay);
|
||||
CAL_LastSavedTime.Value = new DateTime(2000, 1, 1, SAV.LastSavedHour, SAV.LastSavedMinute, 0);
|
||||
CAL_AdventureStartDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart);
|
||||
CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart% 86400);
|
||||
CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart % 86400);
|
||||
}
|
||||
private void save()
|
||||
{
|
||||
@@ -528,7 +528,10 @@ private void save()
|
||||
// Vivillon
|
||||
SAV.Vivillon = CB_Vivillon.SelectedIndex;
|
||||
|
||||
SAV.SecondsToStart = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;
|
||||
int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;
|
||||
seconds -= seconds%86400;
|
||||
seconds += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
|
||||
SAV.SecondsToStart = seconds;
|
||||
|
||||
SAV.LastSavedYear = CAL_LastSavedDate.Value.Year;
|
||||
SAV.LastSavedMonth = CAL_LastSavedDate.Value.Month;
|
||||
|
||||
Reference in New Issue
Block a user