diff --git a/src/include/unit.h b/src/include/unit.h index b1aacfa10..8570613bf 100644 --- a/src/include/unit.h +++ b/src/include/unit.h @@ -417,13 +417,15 @@ class CPreference public: CPreference() : ShowSightRange(false), ShowReactionRange(false), ShowAttackRange(false), ShowMessages(true), - BigScreen(false), ShowOrders(0), ShowNameDelay(0), ShowNameTime(0) {}; + BigScreen(false), PauseOnLeave(true), ShowOrders(0), ShowNameDelay(0), + ShowNameTime(0) {}; bool ShowSightRange; /// Show sight range. bool ShowReactionRange; /// Show reaction range. bool ShowAttackRange; /// Show attack range. bool ShowMessages; /// Show messages. bool BigScreen; /// If true, shows the big screen(without panels) + bool PauseOnLeave; /// If true, game pauses when cursor is gone int ShowOrders; /// How many second show orders of unit on map. int ShowNameDelay; /// How many cycles need to wait until unit's name popup will appear. diff --git a/src/tolua/unit.pkg b/src/tolua/unit.pkg index 61e996c70..e07191b96 100644 --- a/src/tolua/unit.pkg +++ b/src/tolua/unit.pkg @@ -22,6 +22,7 @@ class CPreference bool ShowAttackRange; bool ShowMessages; bool BigScreen; + bool PauseOnLeave; unsigned int ShowOrders; unsigned int ShowNameDelay; diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp index 48a97d57e..b7fe6cc3d 100644 --- a/src/video/sdl.cpp +++ b/src/video/sdl.cpp @@ -94,6 +94,7 @@ #include "sound_server.h" #include "translate.h" #include "ui.h" +#include "unit.h" #include "video.h" #include "widgets.h" @@ -860,7 +861,7 @@ static void SdlDoEvent(const EventCallback &callbacks, SDL_Event &event) } InMainWindow = (event.active.gain != 0); } - if (event.active.state & SDL_APPACTIVE || SDL_GetAppState() & SDL_APPACTIVE) { + if (Preference.PauseOnLeave && (event.active.state & SDL_APPACTIVE || SDL_GetAppState() & SDL_APPACTIVE)) { static bool DoTogglePause = false; if (IsSDLWindowVisible && !event.active.gain) {