game Class Reference

Holds information about global settings. More...

#include <game.h>

Collaboration diagram for game:

Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static void init (string game_dir)
 Initialise the game framework.
static void set_game_data_dir (string game_dir)
 Specify an additional data directory containing game data.
static string user_data_dir ()
 Returns the absolute path to the user data directory (usually ~/.adonthell).
static string global_data_dir ()
 Returns the absolute path to the global data directory.
static string game_data_dir ()
 Returns the absolute path to the current game's directory (if any).
static string find_file (const string &fname)
 Finds a file in the directories hierarchy, starting searching from game_data_dir(), then global_data_dir() and finally user_data_dir().
static string find_directory (const string &dirname)
 Finds a directory in the directories hierarchy, starting searching from game_data_dir(), then global_data_dir() and finally user_data_dir().

Static Public Attributes

static string User_data_dir
static string Global_data_dir
static string Game_data_dir


Detailed Description

Holds information about global settings.

This static class should be the first to be initialised in your application, because many others depends on it's correct settings.

Definition at line 47 of file game.h.


Member Function Documentation

void game::init ( string  game_dir  )  [static]

Initialise the game framework.

Parameters:
game_dir Global data directory.

Definition at line 38 of file game.cc.

void game::set_game_data_dir ( string  game_dir  )  [static]

Specify an additional data directory containing game data.

Parameters:
game_dir Game data directory.

Definition at line 49 of file game.cc.

static string game::user_data_dir (  )  [inline, static]

Returns the absolute path to the user data directory (usually ~/.adonthell).

Returns:
user data directory

Definition at line 75 of file game.h.

static string game::global_data_dir (  )  [inline, static]

Returns the absolute path to the global data directory.

Returns:
global data directory

Definition at line 86 of file game.h.

static string game::game_data_dir (  )  [inline, static]

Returns the absolute path to the current game's directory (if any).

Returns:
current game data directory, or empty string if none set.

Definition at line 97 of file game.h.

string game::find_file ( const string &  fname  )  [static]

Finds a file in the directories hierarchy, starting searching from game_data_dir(), then global_data_dir() and finally user_data_dir().

If a matching file is found, the full absolute path is returned, else an empty string "" is returned. If the path was already absolute, it is returned immediatly.

Parameters:
fname name of the find to search for.
Returns:
complete absolute path to the file if found, passed string if the given path was already absolute, or "" if the file wasn't found.

Definition at line 80 of file game.cc.

string game::find_directory ( const string &  dirname  )  [static]

Finds a directory in the directories hierarchy, starting searching from game_data_dir(), then global_data_dir() and finally user_data_dir().

If a matching directory is found, the full absolute path is returned, else an empty string "" is returned. If the path was already absolute, it is returned immediatly.

Parameters:
fname name of the find to search for.
Returns:
complete absolute path to the directory if found, passed string if the given path was already absolute, or "" if the directory wasn't found.

Definition at line 102 of file game.cc.


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

Generated on Wed Jun 18 16:29:49 2008 for Adonthell by  doxygen 1.5.6