#include <gamedate.h>
Static Public Member Functions | |
static void | update () |
Update the game date. | |
static u_int32 | time () |
Get the current gametime. | |
static u_int16 | weekday () |
Get the current weekday. | |
static u_int16 | day () |
Returns the current day in the gameworld. | |
static u_int16 | hour () |
Return the hour of the current day. | |
static u_int16 | minute () |
Return the minute of the current hour. | |
static u_int32 | parse_time (const std::string &time) |
convert the time string to gametime minutes. | |
static bool | get_state (igzstream &in) |
Load the state of the gamedate class from disk. | |
static void | put_state (ogzstream &out) |
Save the state of the gamedate class to disk. |
This time span is given in game time minutes, not real time. gamedate further includes functions to retrieve those minutes as day, weekday, hour and minute values.
Definition at line 45 of file gamedate.h.
void gamedate::update | ( | ) | [static] |
Update the game date.
Whenever a minute of gametime has passed, a time event will be raised. This function needs to be called from the main loop and uses
Definition at line 36 of file gamedate.cc.
static u_int32 gamedate::time | ( | ) | [inline, static] |
Get the current gametime.
Definition at line 60 of file gamedate.h.
u_int16 gamedate::weekday | ( | ) | [static] |
Get the current weekday.
Definition at line 73 of file gamedate.cc.
u_int16 gamedate::day | ( | ) | [static] |
Returns the current day in the gameworld.
Definition at line 79 of file gamedate.cc.
u_int16 gamedate::hour | ( | ) | [static] |
Return the hour of the current day.
Definition at line 88 of file gamedate.cc.
u_int16 gamedate::minute | ( | ) | [static] |
Return the minute of the current hour.
Definition at line 94 of file gamedate.cc.
u_int32 gamedate::parse_time | ( | const std::string & | time | ) | [static] |
convert the time string to gametime minutes.
The time string has the format "<number>X", where X may be (w)eek, (d)ay, (h)our, (m)inute or (t)enth minute. Several such pairs can be concatenated. Valid examples are "1w1d1h", "30m1h" but also "1h1h".
time | The time format string. |
Definition at line 100 of file gamedate.cc.
bool gamedate::get_state | ( | igzstream & | in | ) | [static] |
Load the state of the gamedate class from disk.
in | stream to read the state from |
Definition at line 57 of file gamedate.cc.
void gamedate::put_state | ( | ogzstream & | out | ) | [static] |
Save the state of the gamedate class to disk.
out | stream to write the state to |
Definition at line 66 of file gamedate.cc.