/* **********************************************************************************************************************
   Included Header Files
   **********************************************************************************************************************/

#include <stdlib.h>
#include <crtdbg.h>
#include "MysticRealms.h"



// this will only work for the new in main
#define _CRTDBG_MAP_ALLOC
#ifdef _DEBUG
    #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif  // _DEBUG



/* **********************************************************************************************************************
   WinMain
   -------
   Entry point of the program.
   **********************************************************************************************************************/

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreviousInstance, LPSTR lpCommandLine, int nCommandShow) {
    MysticRealms* game = NULL;

    // set the game to run on only one processor (CPU 0)
    DWORD_PTR mask = 1;
    SetThreadAffinityMask(GetCurrentThread(), mask);

    // satisfy the compiler
    hPreviousInstance;
    lpCommandLine;
    nCommandShow;

    // start Mystic Realms
    game = new MysticRealms();
    game->Run(hInstance);

    // free memory
    delete game;
    game = NULL;

    // check for memory leaks
    _CrtDumpMemoryLeaks();

    return EXIT_SUCCESS;
};