OpenXcom
1.0
Open-source clone of the original X-Com
|
Stores the current ingame time/date according to GMT. More...
#include <GameTime.h>
Public Member Functions | |
GameTime (int weekday, int day, int month, int year, int hour, int minute, int second) | |
Creates a new ingame time at a certain point. More... | |
~GameTime () | |
Cleans up the ingame time. | |
void | load (const YAML::Node &node) |
Loads the time from YAML. More... | |
YAML::Node | save () const |
Saves the time to YAML. More... | |
TimeTrigger | advance () |
Advances the time by 5 seconds. More... | |
int | getSecond () const |
Gets the ingame second. More... | |
int | getMinute () const |
Gets the ingame minute. More... | |
int | getHour () const |
Gets the ingame hour. More... | |
int | getWeekday () const |
Gets the ingame weekday. More... | |
std::string | getWeekdayString () const |
Returns a localizable-string representation of the current ingame weekday. More... | |
int | getDay () const |
Gets the ingame day. More... | |
std::wstring | getDayString (Language *lang) const |
Returns the localized representation of the current ingame day with the cardinal operator. More... | |
int | getMonth () const |
Gets the ingame month. More... | |
std::string | getMonthString () const |
Returns a localizable-string representation of the current ingame month. More... | |
int | getYear () const |
Gets the ingame year. More... | |
double | getDaylight () const |
Gets the position of the daylight according to the ingame time. More... | |
Stores the current ingame time/date according to GMT.
Takes care of managing and representing each component, as well as common time operations.
OpenXcom::GameTime::GameTime | ( | int | weekday, |
int | day, | ||
int | month, | ||
int | year, | ||
int | hour, | ||
int | minute, | ||
int | second | ||
) |
Creates a new ingame time at a certain point.
Initializes a new ingame time with a certain starting point.
weekday | Starting weekday. |
day | Starting day. |
month | Starting month. |
year | Starting year. |
hour | Starting hour. |
minute | Starting minute. |
second | Starting second. |
TimeTrigger OpenXcom::GameTime::advance | ( | ) |
Advances the time by 5 seconds.
Advances the ingame time by 5 seconds, automatically correcting the other components when necessary and sending out a trigger when a certain time span has elapsed for time-dependent events.
int OpenXcom::GameTime::getDay | ( | ) | const |
Gets the ingame day.
Returns the current ingame day.
double OpenXcom::GameTime::getDaylight | ( | ) | const |
Gets the position of the daylight according to the ingame time.
Returns the current position of the daylight emitted on the globe according to the current ingame time, so the value is 0 when the light starts at 0º longitude (6h) and 1 when the light ends at 0º longitude (18h).
std::wstring OpenXcom::GameTime::getDayString | ( | Language * | lang | ) | const |
Returns the localized representation of the current ingame day with the cardinal operator.
lang | Pointer to current language. |
int OpenXcom::GameTime::getHour | ( | ) | const |
Gets the ingame hour.
Returns the current ingame hour.
int OpenXcom::GameTime::getMinute | ( | ) | const |
Gets the ingame minute.
Returns the current ingame minute.
int OpenXcom::GameTime::getMonth | ( | ) | const |
Gets the ingame month.
Returns the current ingame month.
std::string OpenXcom::GameTime::getMonthString | ( | ) | const |
Returns a localizable-string representation of the current ingame month.
int OpenXcom::GameTime::getSecond | ( | ) | const |
Gets the ingame second.
Returns the current ingame second.
int OpenXcom::GameTime::getWeekday | ( | ) | const |
Gets the ingame weekday.
Returns the current ingame weekday.
std::string OpenXcom::GameTime::getWeekdayString | ( | ) | const |
Returns a localizable-string representation of the current ingame weekday.
int OpenXcom::GameTime::getYear | ( | ) | const |
Gets the ingame year.
Returns the current ingame year.
void OpenXcom::GameTime::load | ( | const YAML::Node & | node | ) |
Loads the time from YAML.
Loads the time from a YAML file.
node | YAML node. |
YAML::Node OpenXcom::GameTime::save | ( | ) | const |
Saves the time to YAML.
Saves the time to a YAML file.