Jump to content

Recommended Posts

Hello, I have a little problem while running the game, can anyone help me?
This is what've got:

Spoiler

5937b9f762713_Vstiek2.PNG.cb84107d901b500273104835c4f67dbf.PNG

 

singleton.h script file:

Spoiler

#ifndef __INC_SINGLETON_H__
#define __INC_SINGLETON_H__

#include <assert.h>

template <typename T> class singleton 

    public: 
        static T * ms_singleton;

        singleton()
        { 
            assert(!ms_singleton);
            long offset = (long) (T*) 1 - (long) (singleton <T>*) (T*) 1; 
            ms_singleton = (T*) ((long) this + offset);
        } 

        virtual ~singleton()
        { 
            assert(ms_singleton);
            ms_singleton = 0; 
        }

        static T & instance()
        {
            assert(ms_singleton);
            return (*ms_singleton);
        }

        static T & Instance()
        {
            assert(ms_singleton);
            return (*ms_singleton);
        }

        static T * instance_ptr()
        {
            return (ms_singleton);
        }
};

template <typename T> T * singleton <T>::ms_singleton = NULL;

#endif
 

 

Link to comment
Share on other sites

  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.