changed camera to show more of what's above tux
[supertux.git] / src / main.cpp
index 3907d4e..950da90 100644 (file)
@@ -97,27 +97,31 @@ static void find_directories()
   }
 
   // Detect datadir with some linux magic
-#ifndef WIN32
   if(datadir.empty()) {
+    std::string exedir;
+#ifdef WIN32
+    exedir = ".";
+#else
     char exe_file[PATH_MAX];
-    if(readlink("/proc/self/exe", exe_file, PATH_MAX) < 0) {
+    if(readlink("/proc/self/exe", exe_file, PATH_MAX) >= 0) {
+      exedir = std::string(dirname(exe_file));
+    } else {
 #ifdef DEBUG
       std::cerr << "Couldn't read /proc/self/exe \n";
 #endif
-    } else {
-      std::string exedir = std::string(dirname(exe_file)) + "/";
-      std::string testdir = exedir + "./data/";
-      if(access(testdir.c_str(), F_OK) == 0) {
-        datadir = testdir;
-      }
-      
-      testdir = exedir + "../share/supertux/";
-      if(datadir.empty() && access(testdir.c_str(), F_OK) == 0) {
-        datadir = testdir;
-      }
-    }  
-  }
+      exedir = ".";
+    }
 #endif
+    std::string testdir = exedir + "/data/";
+    if(access(testdir.c_str(), F_OK) == 0) {
+      datadir = testdir;
+    }
+    
+    testdir = exedir + "/../share/supertux/";
+    if(datadir.empty() && access(testdir.c_str(), F_OK) == 0) {
+      datadir = testdir;
+    }
+  }  
   
 #ifdef DATA_PREFIX
   // use default location
@@ -133,7 +137,7 @@ static void find_directories()
 static void init_tinygettext()
 {
   dictionary_manager.add_directory(datadir + "/locale");
-  dictionary_manager.set_charset("iso8859-1");
+  dictionary_manager.set_charset("UTF-8");
 }
 
 static void print_usage(const char* argv0)
@@ -281,14 +285,14 @@ void init_video()
 
   // set icon
   SDL_Surface* icon = IMG_Load(
-    get_resource_filename("images/supertux.xpm").c_str());
+    get_resource_filename("images/engine/icons/supertux.xpm").c_str());
   if(icon != 0) {
     SDL_WM_SetIcon(icon, 0);
     SDL_FreeSurface(icon);
   }
 #ifdef DEBUG
   else {
-    std::cerr << "Warning: Couldn't find icon 'images/supertux.xpm'.\n";
+    std::cerr << "Warning: Couldn't find icon 'images/engine/icons/supertux.xpm'.\n";
   }
 #endif