Logo Search packages:      
Sourcecode: adonthell version File versions  Download package

void print_available_games (  ) 

Displays the available games - for internal use only.

Definition at line 85 of file prefs.cc.

References game::global_data_dir().

Referenced by config::parse_arguments().

{
    struct dirent * d;
    DIR * mydir = opendir ((game::global_data_dir() + "/games").c_str()); 
    bool nogames = true; 
 
    if (!mydir) 
    {
        cerr << "Cannot open directory " << game::global_data_dir() + "/games!" << endl;
        exit (1); 
    }

    while ((d = readdir (mydir)) != NULL)
    {
        string s (d->d_name); 
        if (s != "." && s != "..")
        {
            if (nogames) 
            {
                nogames = false;
                cout << "Installed games (Suitable for the GAME parameter):\n"; 
            }
            cout << " - " << d->d_name << endl; 
        }
    }

    if (nogames) cout << "No games available.\n"; 
    
    closedir (mydir); 
}


Generated by  Doxygen 1.6.0   Back to index