[Super-tux-commit] supertux/lib/app globals.cpp,1.5,1.6 globals.h,1.5,1.6 setup.cpp,1.8,1.9 setup.h,
Brought to you by:
wkendrick
From: Tobias G. <to...@us...> - 2004-07-27 19:31:48
|
Update of /cvsroot/super-tux/supertux/lib/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2497/lib/app Modified Files: globals.cpp globals.h setup.cpp setup.h Log Message: - Cleanups - Got rid of string_list_type (caution! Bugs with the replacement solutions are likely to happen, that will be fixed) Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- setup.cpp 27 Jul 2004 09:56:14 -0000 1.8 +++ setup.cpp 27 Jul 2004 19:31:37 -0000 1.9 @@ -119,15 +119,14 @@ /* Get all names of sub-directories in a certain directory. */ /* Returns the number of sub-directories found. */ /* Note: The user has to free the allocated space. */ -string_list_type FileSystem::dsubdirs(const char *rel_path,const char* expected_file) +std::set<std::string> FileSystem::dsubdirs(const char *rel_path,const char* expected_file) { DIR *dirStructP; struct dirent *direntp; - string_list_type sdirs; + std::set<std::string> sdirs; char filename[1024]; char path[1024]; - string_list_init(&sdirs); sprintf(path,"%s/%s",st_dir,rel_path); if((dirStructP = opendir(path)) != NULL) { @@ -147,7 +146,7 @@ continue; } - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -180,7 +179,7 @@ } } - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -189,14 +188,13 @@ return sdirs; } -string_list_type FileSystem::dfiles(const char *rel_path, const char* glob, const char* exception_str) +std::set<std::string> FileSystem::dfiles(const char *rel_path, const char* glob, const char* exception_str) { DIR *dirStructP; struct dirent *direntp; - string_list_type sdirs; + std::set<std::string> sdirs; char path[1024]; - string_list_init(&sdirs); sprintf(path,"%s/%s",st_dir,rel_path); if((dirStructP = opendir(path)) != NULL) { @@ -218,7 +216,7 @@ if(strstr(direntp->d_name,glob) == NULL) continue; - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -245,7 +243,7 @@ if(strstr(direntp->d_name,glob) == NULL) continue; - string_list_add_item(&sdirs,direntp->d_name); + sdirs.insert(direntp->d_name); } } closedir(dirStructP); @@ -844,9 +842,9 @@ exit(ret); } -std::vector<std::string> FileSystem::read_directory(const std::string& pathname) +std::set<std::string> FileSystem::read_directory(const std::string& pathname) { - std::vector<std::string> dirnames; + std::set<std::string> dirnames; DIR* dir = opendir(pathname.c_str()); if (dir) @@ -855,7 +853,7 @@ while((direntp = readdir(dir))) { - dirnames.push_back(direntp->d_name); + dirnames.insert(direntp->d_name); } closedir(dir); Index: globals.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- globals.cpp 26 Jul 2004 15:48:37 -0000 1.5 +++ globals.cpp 27 Jul 2004 19:31:34 -0000 1.6 @@ -50,7 +50,6 @@ bool use_fullscreen; bool debug_mode; bool show_fps; -float game_speed = 1.0f; int joystick_num = 0; char* level_startup_file = 0; Index: setup.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/setup.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- setup.h 26 Jul 2004 15:48:37 -0000 1.6 +++ setup.h 27 Jul 2004 19:31:37 -0000 1.7 @@ -21,6 +21,7 @@ #define SUPERTUX_SETUP_H #include <vector> +#include <set> #include <string> #include "../gui/menu.h" #include "../special/base.h" @@ -33,9 +34,9 @@ static int faccessible(const char *filename); static int fcreatedir(const char* relative_dir); static int fwriteable(const char *filename); - static std::vector<std::string> read_directory(const std::string& pathname); - static string_list_type dsubdirs(const char *rel_path, const char* expected_file); - static string_list_type dfiles(const char *rel_path, const char* glob, const char* exception_str); + static std::set<std::string> read_directory(const std::string& pathname); + static std::set<std::string> dsubdirs(const char *rel_path, const char* expected_file); + static std::set<std::string> dfiles(const char *rel_path, const char* glob, const char* exception_str); }; /// All you need to get an application up and running Index: globals.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/app/globals.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- globals.h 26 Jul 2004 15:48:37 -0000 1.5 +++ globals.h 27 Jul 2004 19:31:37 -0000 1.6 @@ -74,7 +74,6 @@ extern char* st_dir; extern char* st_save_dir; - extern float game_speed; extern SDL_Joystick * js; int wait_for_event(SDL_Event& event,unsigned int min_delay = 0, unsigned int max_delay = 0, bool empty_events = false); |