* Add #ifdef WIN32 to make main.cpp compile on linux.
[matthijs/ABM2.git] / ABM2 / Engine / singleton.h
index 2e3e6e2cfbea6e65cbb33abf9ef8ae6c01dda9cb..748414ad43f9ac475bea4c13f4737d5a4f815e91 100755 (executable)
@@ -11,8 +11,10 @@ class Singleton
                        assert(!ms_singleton);\r
                        //use a cunning trick to get the singleton pointing to the start of the whole, rather than\r
                        //the start of the Singleton part of the object\r
-                       int offset = (int)(T*)1 - (int)(Singleton <T>*)(T*)1;\r
-                       ms_singleton = (T*)((int)this + offset);\r
+                       // This used to say "int" instead of long, but that breaks\r
+                       // on 64 bit linux at least\r
+                       long offset = (long)(T*)1 - (long)(Singleton <T>*)(T*)1;\r
+                       ms_singleton = (T*)((long)this + offset);\r
                }\r
                ~Singleton()\r
                {\r