Represents a specific date in the game world.
More...
#include <gamedate.h>
Represents a specific date in the game world.
◆ GameDateValue()
| GameDateValue::GameDateValue |
( |
uint16_t |
y = 2025, |
|
|
uint8_t |
m = 7, |
|
|
uint8_t |
d = 1 |
|
) |
| |
|
inlineexplicit |
Constructs a GameDateValue.
- Parameters
-
| y | Year (default 2025). |
| m | Month (default 7). |
| d | Day (default 1). |
Let's start the game from July first, so that we have the transfer window and some friendlies before starting the championship.
◆ checkPhase()
Checks the current phase of the season.
- Returns
- The current SeasonPhase.
◆ daysInMonth()
| uint8_t GameDateValue::daysInMonth |
( |
uint8_t |
m, |
|
|
uint16_t |
y |
|
) |
| |
|
staticprivate |
◆ fromString()
| GameDateValue GameDateValue::fromString |
( |
const std::string & |
str | ) |
|
|
static |
Parses a date from a string.
- Parameters
-
| str | String representation of the date. |
- Returns
- The parsed GameDateValue.
◆ isLeapYear()
| bool GameDateValue::isLeapYear |
( |
uint16_t |
y | ) |
|
|
staticprivate |
Cultural moment, I needed to lookup the formula and this is what I found:
The Gregorian calendar year is approximately 365.2425 days. If we only used the "divisible by 4" rule, we'd have too many leap years and the calendar would drift about 3 days every 400 years.
Seems like you never stop learning when writing code :P
◆ nextDay()
| void GameDateValue::nextDay |
( |
| ) |
|
Advances the date by one day.
◆ nextMonth()
| void GameDateValue::nextMonth |
( |
| ) |
|
Advances the date by one month.
◆ nextWeek()
| void GameDateValue::nextWeek |
( |
| ) |
|
Advances the date by one week.
◆ operator+()
Adds a specified number of days to the date.
- Parameters
-
- Returns
- The new date.
◆ operator-()
Subtracts a specified number of days from the date.
- Parameters
-
- Returns
- The new date.
◆ operator<()
| bool GameDateValue::operator< |
( |
const GameDateValue & |
other | ) |
const |
Checks if this date is earlier than another.
- Parameters
-
| other | The date to compare against. |
- Returns
- True if earlier, false otherwise.
◆ operator==()
| bool GameDateValue::operator== |
( |
const GameDateValue & |
other | ) |
const |
Checks if this date is equal to another.
- Parameters
-
| other | The date to compare against. |
- Returns
- True if equal, false otherwise.
◆ operator[]()
Accesses the date part by index (0=year, 1=month, 2=day).
- Parameters
-
- Returns
- The corresponding part of the date.
◆ toString()
| std::string GameDateValue::toString |
( |
| ) |
const |
Converts the date to a string representation.
- Returns
- String representation of the date.
◆ day
| uint8_t GameDateValue::day |
◆ month
| uint8_t GameDateValue::month |
◆ year
| uint16_t GameDateValue::year |
The documentation for this struct was generated from the following files: