pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2955 - branches/pingus_sdl/src


From: jsalmon3
Subject: [Pingus-CVS] r2955 - branches/pingus_sdl/src
Date: Thu, 16 Aug 2007 08:25:51 +0200

Author: jsalmon3
Date: 2007-08-16 08:25:47 +0200 (Thu, 16 Aug 2007)
New Revision: 2955

Modified:
   branches/pingus_sdl/src/plf_res_mgr.cpp
   branches/pingus_sdl/src/plf_res_mgr.hpp
   branches/pingus_sdl/src/system.cpp
   branches/pingus_sdl/src/system.hpp
Log:
Added get_mtime for windows

Modified: branches/pingus_sdl/src/plf_res_mgr.cpp
===================================================================
--- branches/pingus_sdl/src/plf_res_mgr.cpp     2007-08-16 04:43:35 UTC (rev 
2954)
+++ branches/pingus_sdl/src/plf_res_mgr.cpp     2007-08-16 06:25:47 UTC (rev 
2955)
@@ -53,7 +53,7 @@
     }
   else
     {
-      unsigned int current_mtime = System::get_mtime(filename);
+      uint64_t current_mtime = System::get_mtime(filename);
       if (current_mtime != i->second.mtime)
         {
           pout(PINGUS_DEBUG_LOADING) << "PLFResMgr: level changed on DISK, 
reloading: '" << res_name << "' -> '" << filename << "'" << std::endl;

Modified: branches/pingus_sdl/src/plf_res_mgr.hpp
===================================================================
--- branches/pingus_sdl/src/plf_res_mgr.hpp     2007-08-16 04:43:35 UTC (rev 
2954)
+++ branches/pingus_sdl/src/plf_res_mgr.hpp     2007-08-16 06:25:47 UTC (rev 
2955)
@@ -21,6 +21,7 @@
 #define HEADER_PINGUS_PLF_RES_MGR_HXX
 
 #include "pingus_level.hpp"
+#include "SDL.h"
 
 
 /** */
@@ -29,7 +30,7 @@
 private:
   struct PLFEntry {
     PingusLevel plf;
-    unsigned int mtime;
+    uint64_t mtime;
   };
 
   typedef std::map<std::string, PLFEntry> PLFMap;

Modified: branches/pingus_sdl/src/system.cpp
===================================================================
--- branches/pingus_sdl/src/system.cpp  2007-08-16 04:43:35 UTC (rev 2954)
+++ branches/pingus_sdl/src/system.cpp  2007-08-16 06:25:47 UTC (rev 2955)
@@ -32,6 +32,8 @@
 #  include <windows.h>
 #  include <direct.h>
 #  include <fstream>
+#  include <sys/stat.h>
+#  include <sys/types.h>
 #endif
 
 #include <iostream>
@@ -484,7 +486,7 @@
 }
 
 
-unsigned int
+uint64_t
 System::get_mtime(const std::string& filename)
 {
 #ifndef WIN32
@@ -496,7 +498,13 @@
     return 0;
 
 #else
+
+  struct _stat stat_buf;
+  if (_stat(filename.c_str(), &stat_buf) == 0)
+    return stat_buf.st_mtime;
+  else
     return 0;
+
 #endif
 }
 

Modified: branches/pingus_sdl/src/system.hpp
===================================================================
--- branches/pingus_sdl/src/system.hpp  2007-08-16 04:43:35 UTC (rev 2954)
+++ branches/pingus_sdl/src/system.hpp  2007-08-16 06:25:47 UTC (rev 2955)
@@ -25,6 +25,7 @@
 #include <string>
 #include <list>
 #include <map>
+#include "SDL.h"
 
 
 /** A wrapper class around some system dependend functions (mostly
@@ -111,7 +112,7 @@
   static std::string get_language();
 
   /** Return the modification time of a file */
-  static unsigned int get_mtime(const std::string& filename);
+  static uint64_t get_mtime(const std::string& filename);
 
   /** Choose the correct translation out of the map, if there is none
       present, fall back to the default language */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]