X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmain.cpp;h=3f43c6fe3c7ff7dfdc5495e26b311e5697a96cee;hb=d4b281559d45406a5d07cf04d89142cdeb90b114;hp=a8aab0649d4f044de18ccd60a8087613101f5656;hpb=b3df78c0b5dcf53a730bd4372aa11e3f5636606f;p=supertux.git diff --git a/src/main.cpp b/src/main.cpp index a8aab0649..3f43c6fe3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,13 +25,11 @@ #include #include -#include -#include +#include +#include #include #include -#include #include -#include #include #include #include @@ -176,17 +174,21 @@ static void init_physfs(const char* argv0) } #endif +#ifdef _WIN32 + PHYSFS_addToSearchPath(".\\data", 1); +#endif + if(!sourcedir) { #if defined(APPDATADIR) || defined(ENABLE_BINRELOC) std::string datadir; #ifdef ENABLE_BINRELOC char* dir; - br_init (NULL); - dir = br_find_data_dir(APPDATADIR); + br_init (NULL); + dir = br_find_data_dir(APPDATADIR); datadir = dir; datadir += "/" PACKAGE_NAME; - free(dir); + free(dir); #else datadir = APPDATADIR; @@ -201,8 +203,10 @@ static void init_physfs(const char* argv0) PHYSFS_permitSymbolicLinks(1); //show search Path - for(char** i = PHYSFS_getSearchPath(); *i != NULL; i++) + char** searchpath = PHYSFS_getSearchPath(); + for(char** i = searchpath; *i != NULL; i++) log_info << "[" << *i << "] is in the search path" << std::endl; + PHYSFS_freeList(searchpath); } static void print_usage(const char* argv0) @@ -338,11 +342,10 @@ static void init_sdl() static void init_rand() { - const char *how = config->random_seed? ", user fixed.": ", from time()."; - config->random_seed = systemRandom.srand(config->random_seed); - log_info << "Using random seed " << config->random_seed << how << std::endl; + //const char *how = config->random_seed? ", user fixed.": ", from time()."; + //log_info << "Using random seed " << config->random_seed << how << std::endl; } void init_video() @@ -500,7 +503,9 @@ int main(int argc, char** argv) { int result = 0; +#ifndef NO_CATCH try { +#endif if(pre_parse_commandline(argc, argv)) return 0; @@ -564,6 +569,7 @@ int main(int argc, char** argv) //init_rand(); PAK: this call might subsume the above 3, but I'm chicken! main_loop->run(); +#ifndef NO_CATCH } catch(std::exception& e) { log_fatal << "Unexpected exception: " << e.what() << std::endl; result = 1; @@ -571,6 +577,7 @@ int main(int argc, char** argv) log_fatal << "Unexpected exception" << std::endl; result = 1; } +#endif delete main_loop; main_loop = NULL;