gamedate Class Reference

Keeps track of the time the player spent within the game so far. More...

#include <gamedate.h>

List of all members.

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.


Detailed Description

Keeps track of the time the player spent within the game so far.

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.


Member Function Documentation

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.

Returns:
gametime in 1/10 minutes since start of the game.

Definition at line 60 of file gamedate.h.

u_int16 gamedate::weekday (  )  [static]

Get the current weekday.

Returns:
weekday as a number between 0 and DAYS_PER_WEEK - 1

Definition at line 73 of file gamedate.cc.

u_int16 gamedate::day (  )  [static]

Returns the current day in the gameworld.

Returns:
number of days spent in the gameworld, beginning with day 0.

Definition at line 79 of file gamedate.cc.

u_int16 gamedate::hour (  )  [static]

Return the hour of the current day.

Returns:
hour of the current day between 0 and HOURS_PER_DAY - 1

Definition at line 88 of file gamedate.cc.

u_int16 gamedate::minute (  )  [static]

Return the minute of the current hour.

Returns:
minute of the current hour between 0 and 59.

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".

Parameters:
time The time format string.
Returns:
The time represented by the string in minutes.

Definition at line 100 of file gamedate.cc.

bool gamedate::get_state ( igzstream in  )  [static]

Load the state of the gamedate class from disk.

Parameters:
in stream to read the state from
Returns:
true if the state was successfully retrieved, false otherwise.

Definition at line 57 of file gamedate.cc.

void gamedate::put_state ( ogzstream out  )  [static]

Save the state of the gamedate class to disk.

Parameters:
out stream to write the state to

Definition at line 66 of file gamedate.cc.


The documentation for this class was generated from the following files:

Generated on Wed Jun 18 16:27:23 2008 for Adonthell by  doxygen 1.5.6