From 9caff9dac3ca65e92626ce8263a637f83cfbe18b Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 27 Sep 2011 07:01:08 +0000 Subject: [PATCH] - in headless mode avoid init of sdl's video surface so that we stay in console window (no graphics window shown) --- source/glest_game/graphics/renderer.cpp | 14 +- source/glest_game/main/main.cpp | 1 + source/glest_game/type_instances/unit.cpp | 28 ++- source/glest_game/world/unit_updater.cpp | 8 +- .../shared_lib/include/platform/sdl/window.h | 5 + .../sources/platform/sdl/gl_wrap.cpp | 72 ++++---- .../sources/platform/sdl/window.cpp | 173 +++++++++--------- 7 files changed, 169 insertions(+), 132 deletions(-) diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index d204781e..28ba5b38 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -325,6 +325,10 @@ void Renderer::init() { Config &config= Config::getInstance(); loadConfig(); + if(this->masterserverMode == true) { + return; + } + if(config.getBool("CheckGlCaps")){ checkGlCaps(); } @@ -335,10 +339,6 @@ void Renderer::init() { config.save(); } - if(this->masterserverMode == true) { - return; - } - modelManager[rsGlobal]->init(); textureManager[rsGlobal]->init(); fontManager[rsGlobal]->init(); @@ -364,9 +364,6 @@ void Renderer::initGame(const Game *game){ this->game= game; //worldToScreenPosCache.clear(); - //check gl caps - checkGlOptionalCaps(); - //vars shadowMapFrame= 0; waterAnim= 0; @@ -377,6 +374,9 @@ void Renderer::initGame(const Game *game){ return; } + //check gl caps + checkGlOptionalCaps(); + //shadows if(shadows == sProjected || shadows == sShadowMapping) { static_cast(modelRenderer)->setSecondaryTexCoordUnit(2); diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index f3b1d4c5..f277e28f 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -2431,6 +2431,7 @@ int glestMain(int argc, char** argv) { if( hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) { isMasterServerModeEnabled = true; + Window::setMasterserverMode(isMasterServerModeEnabled); } //off_t fileSize = getFileSize(argv[0]); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index bc9ec152..bd90541b 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -798,7 +798,9 @@ void Unit::setCurrSkill(const SkillType *currSkill) { UnitParticleSystem *ups = new UnitParticleSystem(200); (*it)->setValues(ups); ups->setPos(getCurrVector()); - ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(getFaction()->getTexture()) { + ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } unitParticleSystems.push_back(ups); Renderer::getInstance().manageParticleSystem(ups, rsGame); } @@ -1446,7 +1448,9 @@ void Unit::updateTimedParticles() { UnitParticleSystem *ups = new UnitParticleSystem(200); pst->setValues(ups); ups->setPos(getCurrVector()); - ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(getFaction()->getTexture()) { + ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } unitParticleSystems.push_back(ups); Renderer::getInstance().manageParticleSystem(ups, rsGame); @@ -1682,7 +1686,9 @@ bool Unit::update() { currentAttackBoostOriginatorEffect.currentAppliedEffect->ups = new UnitParticleSystem(200); currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrVector()); - currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(getFaction()->getTexture()) { + currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } Renderer::getInstance().manageParticleSystem(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups, rsGame); //printf("+ #1 APPLY ATTACK BOOST SELF PARTICLE to unit [%s - %d]\n",this->getType()->getName().c_str(),this->getId()); @@ -1736,7 +1742,9 @@ bool Unit::update() { currentAttackBoostOriginatorEffect.currentAppliedEffect->ups = new UnitParticleSystem(200); currentAttackBoostOriginatorEffect.currentAppliedEffect->upst->setValues(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups); currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setPos(getCurrVector()); - currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(getFaction()->getTexture()) { + currentAttackBoostOriginatorEffect.currentAppliedEffect->ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } Renderer::getInstance().manageParticleSystem(currentAttackBoostOriginatorEffect.currentAppliedEffect->ups, rsGame); //printf("+ #2 APPLY ATTACK BOOST SELF PARTICLE to unit [%s - %d]\n",this->getType()->getName().c_str(),this->getId()); @@ -1834,7 +1842,9 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) { effect->ups = new UnitParticleSystem(200); effect->upst->setValues(effect->ups); effect->ups->setPos(getCurrVector()); - effect->ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(getFaction()->getTexture()) { + effect->ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } Renderer::getInstance().manageParticleSystem(effect->ups, rsGame); } } @@ -2725,7 +2735,9 @@ void Unit::checkCustomizedParticleTriggers(bool force) { UnitParticleSystem *ups = new UnitParticleSystem(200); pst->setValues(ups); ups->setPos(getCurrVector()); - ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(getFaction()->getTexture()) { + ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } damageParticleSystems.push_back(ups); damageParticleSystemsInUse[i] = ups; Renderer::getInstance().manageParticleSystem(ups, rsGame); @@ -2746,7 +2758,9 @@ void Unit::startDamageParticles() { UnitParticleSystem *ups = new UnitParticleSystem(200); pst->setValues(ups); ups->setPos(getCurrVector()); - ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(getFaction()->getTexture()) { + ups->setFactionColor(getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } damageParticleSystems.push_back(ups); damageParticleSystemsInUse[i] = ups; Renderer::getInstance().manageParticleSystem(ups, rsGame); diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index a5b6fa47..344e45ce 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -2041,7 +2041,9 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){ psProj->setPath(startPos, endPos); psProj->setObserver(new ParticleDamager(unit, this, gameCamera)); psProj->setVisible(visible); - psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(unit->getFaction()->getTexture()) { + psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } renderer.manageParticleSystem(psProj, rsGame); } else{ @@ -2053,7 +2055,9 @@ void UnitUpdater::startAttackParticleSystem(Unit *unit){ psSplash= pstSplash->create(); psSplash->setPos(endPos); psSplash->setVisible(visible); - psSplash->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + if(unit->getFaction()->getTexture()) { + psSplash->setFactionColor(unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0)); + } renderer.manageParticleSystem(psSplash, rsGame); if(pstProj!=NULL){ psProj->link(psSplash); diff --git a/source/shared_lib/include/platform/sdl/window.h b/source/shared_lib/include/platform/sdl/window.h index d3640b7c..850f3ad8 100644 --- a/source/shared_lib/include/platform/sdl/window.h +++ b/source/shared_lib/include/platform/sdl/window.h @@ -111,6 +111,8 @@ private: static void setKeystate(SDL_keysym state) { keystate = state; } + static bool masterserverMode; + protected: int w, h; static bool isActive; @@ -130,6 +132,9 @@ public: Window(); virtual ~Window(); + static void setMasterserverMode(bool value) { Window::masterserverMode = value;} + static bool getMasterserverMode() { return Window::masterserverMode;} + static bool getTryVSynch() { return tryVSynch; } static void setTryVSynch(bool value) { tryVSynch = value; } diff --git a/source/shared_lib/sources/platform/sdl/gl_wrap.cpp b/source/shared_lib/sources/platform/sdl/gl_wrap.cpp index 8a113fd9..3c1fb156 100644 --- a/source/shared_lib/sources/platform/sdl/gl_wrap.cpp +++ b/source/shared_lib/sources/platform/sdl/gl_wrap.cpp @@ -113,50 +113,52 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool screen = NULL; } - screen = SDL_SetVideoMode(resW, resH, colorBits, flags); - if(screen == 0) { - std::ostringstream msg; - msg << "Couldn't set video mode " - << resW << "x" << resH << " (" << colorBits - << "bpp " << stencilBits << " stencil " - << depthBits << " depth-buffer). SDL Error is: " << SDL_GetError(); - - if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); - - for(int i = 32; i >= 8; i-=8) { - // try different color bits - screen = SDL_SetVideoMode(resW, resH, i, flags); - if(screen != 0) { - break; - } - } - + if(Window::getMasterserverMode() == false) { + screen = SDL_SetVideoMode(resW, resH, colorBits, flags); if(screen == 0) { + std::ostringstream msg; + msg << "Couldn't set video mode " + << resW << "x" << resH << " (" << colorBits + << "bpp " << stencilBits << " stencil " + << depthBits << " depth-buffer). SDL Error is: " << SDL_GetError(); + + if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); + for(int i = 32; i >= 8; i-=8) { - // try to revert to 800x600 - screen = SDL_SetVideoMode(800, 600, i, flags); + // try different color bits + screen = SDL_SetVideoMode(resW, resH, i, flags); if(screen != 0) { break; } } - } - if(screen == 0) { - for(int i = 32; i >= 8; i-=8) { - // try to revert to 640x480 - screen = SDL_SetVideoMode(640, 480, i, flags); - if(screen != 0) { - break; + + if(screen == 0) { + for(int i = 32; i >= 8; i-=8) { + // try to revert to 800x600 + screen = SDL_SetVideoMode(800, 600, i, flags); + if(screen != 0) { + break; + } } } + if(screen == 0) { + for(int i = 32; i >= 8; i-=8) { + // try to revert to 640x480 + screen = SDL_SetVideoMode(640, 480, i, flags); + if(screen != 0) { + break; + } + } + } + + if(screen == 0) { + throw std::runtime_error(msg.str()); + } } - if(screen == 0) { - throw std::runtime_error(msg.str()); - } + SDL_WM_GrabInput(SDL_GRAB_OFF); } - - SDL_WM_GrabInput(SDL_GRAB_OFF); } void PlatformContextGl::end() { @@ -185,7 +187,9 @@ void PlatformContextGl::makeCurrent() { } void PlatformContextGl::swapBuffers() { - SDL_GL_SwapBuffers(); + if(Window::getMasterserverMode() == false) { + SDL_GL_SwapBuffers(); + } } diff --git a/source/shared_lib/sources/platform/sdl/window.cpp b/source/shared_lib/sources/platform/sdl/window.cpp index 0646dccf..78e0fc1a 100644 --- a/source/shared_lib/sources/platform/sdl/window.cpp +++ b/source/shared_lib/sources/platform/sdl/window.cpp @@ -60,6 +60,8 @@ int Window::lastShowMouseState = 0; bool Window::tryVSynch = false; +bool Window::masterserverMode = false; + // ========== PUBLIC ========== Window::Window() { @@ -356,39 +358,41 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a if(stencilBits >= 0) newStencilBits = stencilBits; - if(fullscreen_anti_aliasing == true) { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); - } - if(hardware_acceleration == true) { - SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); - } - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, newStencilBits); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, newDepthBits); + if(Window::masterserverMode == false) { + if(fullscreen_anti_aliasing == true) { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); + } + if(hardware_acceleration == true) { + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); + } + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, newStencilBits); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, newDepthBits); - //const SDL_VideoInfo *info = SDL_GetVideoInfo(); -#ifdef SDL_GL_SWAP_CONTROL - if(Window::tryVSynch == true) { - /* we want vsync for smooth scrolling */ - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); - } -#endif + //const SDL_VideoInfo *info = SDL_GetVideoInfo(); + #ifdef SDL_GL_SWAP_CONTROL + if(Window::tryVSynch == true) { + /* we want vsync for smooth scrolling */ + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); + } + #endif - // setup LOD bias factor - //const float lodBias = std::max(std::min( configHandler->Get("TextureLODBias", 0.0f) , 4.0f), -4.0f); - const float lodBias = max(min(0.0f,4.0f),-4.0f); - //if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",__FILE__,__FUNCTION__,__LINE__,lodBias); -#ifdef USE_STREFLOP - if (streflop::fabs(lodBias) > 0.01f) { -#else - if (fabs(lodBias) > 0.01f) { -#endif - glTexEnvf(GL_TEXTURE_FILTER_CONTROL,GL_TEXTURE_LOD_BIAS, lodBias ); - } + // setup LOD bias factor + //const float lodBias = std::max(std::min( configHandler->Get("TextureLODBias", 0.0f) , 4.0f), -4.0f); + const float lodBias = max(min(0.0f,4.0f),-4.0f); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",__FILE__,__FUNCTION__,__LINE__,lodBias); + #ifdef USE_STREFLOP + if (streflop::fabs(lodBias) > 0.01f) { + #else + if (fabs(lodBias) > 0.01f) { + #endif + glTexEnvf(GL_TEXTURE_FILTER_CONTROL,GL_TEXTURE_LOD_BIAS, lodBias ); + } + } } #ifdef WIN32 @@ -416,59 +420,61 @@ void Window::toggleFullscreen() { Use 0 for Height, Width, and Color Depth to keep the current values. */ if(Window::allowAltEnterFullscreenToggle == true) { - SDL_Surface *cur_surface = SDL_GetVideoSurface(); - if(cur_surface != NULL) { - Window::isFullScreen = !((cur_surface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN); - } + if(this->masterserverMode == false) { + SDL_Surface *cur_surface = SDL_GetVideoSurface(); + if(cur_surface != NULL) { + Window::isFullScreen = !((cur_surface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN); + } - SDL_Surface *sf = SDL_GetVideoSurface(); - SDL_Surface **surface = &sf; - uint32 *flags = NULL; - //void *pixels = NULL; - //SDL_Color *palette = NULL; - SDL_Rect clip; - //int ncolors = 0; - Uint32 tmpflags = 0; - int w = 0; - int h = 0; - int bpp = 0; + SDL_Surface *sf = SDL_GetVideoSurface(); + SDL_Surface **surface = &sf; + uint32 *flags = NULL; + //void *pixels = NULL; + //SDL_Color *palette = NULL; + SDL_Rect clip; + //int ncolors = 0; + Uint32 tmpflags = 0; + int w = 0; + int h = 0; + int bpp = 0; - if ( (!surface) || (!(*surface)) ) // don't bother if there's no surface. - return; + if ( (!surface) || (!(*surface)) ) // don't bother if there's no surface. + return; - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); - - tmpflags = (*surface)->flags; - w = (*surface)->w; - h = (*surface)->h; - bpp = (*surface)->format->BitsPerPixel; - - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n w = %d, h = %d, bpp = %d",__FILE__,__FUNCTION__,__LINE__,w,h,bpp); - - if (flags == NULL) // use the surface's flags. - flags = &tmpflags; - - // - if ( *flags & SDL_FULLSCREEN ) - *flags &= ~SDL_FULLSCREEN; - // - else - *flags |= SDL_FULLSCREEN; - - SDL_GetClipRect(*surface, &clip); - - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); - - *surface = SDL_SetVideoMode(w, h, bpp, (*flags)); - - if (*surface == NULL) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); - *surface = SDL_SetVideoMode(w, h, bpp, tmpflags); - } // if - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + tmpflags = (*surface)->flags; + w = (*surface)->w; + h = (*surface)->h; + bpp = (*surface)->format->BitsPerPixel; - SDL_SetClipRect(*surface, &clip); + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n w = %d, h = %d, bpp = %d",__FILE__,__FUNCTION__,__LINE__,w,h,bpp); + + if (flags == NULL) // use the surface's flags. + flags = &tmpflags; + + // + if ( *flags & SDL_FULLSCREEN ) + *flags &= ~SDL_FULLSCREEN; + // + else + *flags |= SDL_FULLSCREEN; + + SDL_GetClipRect(*surface, &clip); + + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + + *surface = SDL_SetVideoMode(w, h, bpp, (*flags)); + + if (*surface == NULL) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + *surface = SDL_SetVideoMode(w, h, bpp, tmpflags); + } // if + + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + + SDL_SetClipRect(*surface, &clip); + } } else { HWND handle = GetSDLWindow(); @@ -489,10 +495,13 @@ void Window::toggleFullscreen() { #else if(Window::allowAltEnterFullscreenToggle == true) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); - SDL_Surface *cur_surface = SDL_GetVideoSurface(); - if(cur_surface != NULL) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); - SDL_WM_ToggleFullScreen(cur_surface); + + if(Window::masterserverMode == false) { + SDL_Surface *cur_surface = SDL_GetVideoSurface(); + if(cur_surface != NULL) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); + SDL_WM_ToggleFullScreen(cur_surface); + } } if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__); }