#pragma warning (disable:4786) #include "ai test.hpp" void DoTick (void); int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) { g_hInstance = hInstance; InitGlobals (); InitSystem (); try // start our message processing, when there is now message waiting { // to our GameTick routine MSG msg; BOOL flag=TRUE; while (flag) { if (PeekMessage (&msg,NULL,0,0,PM_REMOVE)) { if (msg.message == WM_QUIT) flag = FALSE; TranslateMessage (&msg); DispatchMessage (&msg); } else { DoTick (); } } g_Quitting = true; KillSystem (); if (g_Registry) g_Registry->SaveData (); // tell the registery to save itself since we have normal exit } catch (exception except) // we had an exception so kill everything { cerr << except.what (); KillSystem (); KillGlobals (); return 1; } return 0; }