#include <stdexcept>
#include <sstream>
-#include <time.h>
-#include <stdlib.h>
+#include <ctime>
+#include <cstdlib>
#include <sys/stat.h>
#include <sys/types.h>
-#include <dirent.h>
#include <unistd.h>
-#include <assert.h>
#include <physfs.h>
#include <SDL.h>
#include <SDL_image.h>
}
#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;
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)
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()
{
int result = 0;
+#ifndef NO_CATCH
try {
+#endif
if(pre_parse_commandline(argc, argv))
return 0;
//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;
log_fatal << "Unexpected exception" << std::endl;
result = 1;
}
+#endif
delete main_loop;
main_loop = NULL;