1
0
Fork 0

(svn r24592) -Codechange [FS#5241]: Set up the new date completely before calling various daily or monthly processings. (dihedral)

release/1.3
frosch 2012-10-14 14:50:20 +00:00
parent 7f80642aa7
commit b5a485825b
1 changed files with 15 additions and 11 deletions

View File

@ -277,24 +277,28 @@ void IncreaseDate()
if (_date_fract < DAY_TICKS) return; if (_date_fract < DAY_TICKS) return;
_date_fract = 0; _date_fract = 0;
/* increase day counter and call various daily loops */ /* increase day counter */
_date++; _date++;
OnNewDay();
YearMonthDay ymd; YearMonthDay ymd;
ConvertDateToYMD(_date, &ymd);
/* check if we entered a new month? */ /* check if we entered a new month? */
ConvertDateToYMD(_date, &ymd); bool new_month = ymd.month != _cur_month;
if (ymd.month == _cur_month) return;
/* yes, call various monthly loops */
_cur_month = ymd.month;
OnNewMonth();
/* check if we entered a new year? */ /* check if we entered a new year? */
if (ymd.year == _cur_year) return; bool new_year = ymd.year != _cur_year;
/* update internal variables before calling the daily/monthly/yearly loops */
_cur_month = ymd.month;
_cur_year = ymd.year;
/* yes, call various daily loops */
OnNewDay();
/* yes, call various monthly loops */
if (new_month) OnNewMonth();
/* yes, call various yearly loops */ /* yes, call various yearly loops */
_cur_year = ymd.year; if (new_year) OnNewYear();
OnNewYear();
} }