From 2758cf4e3b65129ce1c03a4e7aae5d1edb371ce5 Mon Sep 17 00:00:00 2001 From: driAn Date: Tue, 26 Aug 2008 16:48:01 +0000 Subject: [PATCH] highprocesspriority cmd git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2390 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/main.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/source/src/main.cpp b/source/src/main.cpp index e5cc779a..ed1133f9 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -127,6 +127,24 @@ void writeinitcfg() fclose(f); } +void setpriority(bool high) +{ + #ifdef WIN32 + if(SetPriorityClass(GetCurrentProcess(), high ? HIGH_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS)) + { + conoutf("changed priority to '%s'", high ? "high" : "normal"); + } + else + { + conoutf("could not change process priority"); + } + #else + conoutf("changing process priority is not supported on your platform"); + #endif +}; + +VARFP(highprocesspriority, 0, 0, 1, setpriority(highprocesspriority > 0)); + void screenshot(char *imagepath) { SDL_Surface *image = SDL_CreateRGBSurface(SDL_SWSURFACE, screen->w, screen->h, 24, 0x0000FF, 0x00FF00, 0xFF0000, 0); @@ -510,10 +528,6 @@ int main(int argc, char **argv) } initing = NOT_INITING; - //#ifdef WIN32 - //SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS); - //#endif - initlog("sdl"); int par = 0; #ifdef _DEBUG