Functions related to dates. More...
#include "date_type.h"
Go to the source code of this file.
Functions | |
void | SetDate (Date date, DateFract fract) |
Set the date. | |
void | ConvertDateToYMD (Date date, YearMonthDay *ymd) |
Converts a Date to a Year, Month & Day. | |
Date | ConvertYMDToDate (Year year, Month month, Day day) |
Converts a tupe of Year, Month and Day to a Date. | |
static bool | IsLeapYear (Year yr) |
Variables | |
Year | _cur_year |
Current year, starting at 0. | |
Month | _cur_month |
Current month (0..11). | |
Date | _date |
Current date in days (day counter). | |
DateFract | _date_fract |
uint16 | _tick_counter |
Ever incrementing (and sometimes wrapping) tick counter for setting off various events. |
Functions related to dates.
Definition in file date_func.h.
void ConvertDateToYMD | ( | Date | date, | |
YearMonthDay * | ymd | |||
) |
Converts a Date to a Year, Month & Day.
date | the date to convert from | |
ymd | the year, month and day to write to |
Definition at line 91 of file date.cpp.
References YearMonthDay::day, DAYS_IN_LEAP_YEAR, DAYS_IN_YEAR, YearMonthDay::month, and YearMonthDay::year.
Referenced by ClickChangeDateCheat(), NetworkGameWindow::DrawServerLine(), DrawVehiclePurchaseInfo(), SubsidyListWindow::DrawWidget(), CrashLog::FillCrashLog(), AIDate::GetDayOfMonth(), GetGlobalVariable(), AIDate::GetMonth(), GetSnowLine(), AIDate::GetYear(), IncreaseDate(), SetDate(), SetDateWindow::SetDateWindow(), and SetYearEngineAgingStops().
Converts a tupe of Year, Month and Day to a Date.
year | is a number between 0..MAX_YEAR | |
month | is a number between 0..11 | |
day | is a number between 1..31 |
Definition at line 146 of file date.cpp.
References _accum_days_for_month, and DAYS_TILL.
Referenced by ClickChangeDateCheat(), ScenarioEditorToolbarWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), FixTTOEngines(), AIDate::GetDate(), GetGlobalVariable(), SetDateWindow::OnClick(), ScenarioEditorToolbarWindow::OnQueryTextFinished(), NetworkUDPSocketHandler::ReceiveNetworkGameInfo(), CreateScenarioWindow::SetStringParameters(), GenerateLandscapeWindow::SetStringParameters(), ScenarioEditorToolbarWindow::UpdateWidgetSize(), MessageHistoryWindow::UpdateWidgetSize(), CreateScenarioWindow::UpdateWidgetSize(), GenerateLandscapeWindow::UpdateWidgetSize(), and CheatWindow::UpdateWidgetSize().
Set the date.
date | New date | |
fract | The number of ticks that have passed on this date. |
Definition at line 34 of file date.cpp.
References _cur_month, _cur_year, _date, ConvertDateToYMD(), DAY_TICKS, YearMonthDay::month, and YearMonthDay::year.
Referenced by AfterLoadGame(), ClickChangeDateCheat(), and ScenarioEditorToolbarWindow::OnQueryTextFinished().