Skip to content

Commit

Permalink
Added DD_IsShuttingDown()
Browse files Browse the repository at this point in the history
Hooks into the system layer to determine if an engine shutdown
is presently in progress. For use by higher level subsystems
which need to alter behavior accordingly.
  • Loading branch information
danij-deng committed Jan 16, 2012
1 parent 6edc728 commit 4033a77
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
4 changes: 4 additions & 0 deletions doomsday/engine/portable/include/dd_main.h
Expand Up @@ -59,6 +59,10 @@ extern Game* theGame;

int DD_EarlyInit(void);
int DD_Main(void);

/// @return @c true if shutdown is in progress.
boolean DD_IsShuttingDown(void);

void DD_CheckTimeDemo(void);
void DD_UpdateEngineState(void);

Expand Down
3 changes: 3 additions & 0 deletions doomsday/engine/portable/include/sys_system.h
Expand Up @@ -43,6 +43,9 @@ void Sys_Init(void);
void Sys_Shutdown(void);
void Sys_Quit(void);

/// @return @c true if shutdown is in progress.
boolean Sys_IsShuttingDown(void);

int Sys_CriticalMessage(const char* msg);
int Sys_CriticalMessagef(const char* format, ...) PRINTF_F(1,2);

Expand Down
5 changes: 5 additions & 0 deletions doomsday/engine/portable/src/dd_main.c
Expand Up @@ -1263,6 +1263,11 @@ boolean DD_ChangeGame(Game* game)
return DD_ChangeGame2(game, false);
}

boolean DD_IsShuttingDown(void)
{
return Sys_IsShuttingDown();
}

/**
* Looks for new files to autoload from the auto-load data directory.
*/
Expand Down
25 changes: 5 additions & 20 deletions doomsday/engine/portable/src/sys_system.c
Expand Up @@ -27,8 +27,6 @@
* Abstract interfaces to platform-level services.
*/

// HEADER FILES ------------------------------------------------------------

#ifdef WIN32
# include <windows.h>
# include <process.h>
Expand All @@ -47,27 +45,9 @@
#include "de_audio.h"
#include "de_misc.h"

// MACROS ------------------------------------------------------------------

// TYPES -------------------------------------------------------------------

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------

// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------

// EXTERNAL DATA DECLARATIONS ----------------------------------------------

// PUBLIC DATA DEFINITIONS -------------------------------------------------

//int systics = 0; // System tics (every game tic).
int novideo; // if true, stay in text mode for debugging

// PRIVATE DATA DEFINITIONS ------------------------------------------------

// CODE --------------------------------------------------------------------

#ifdef WIN32
/**
* Borrowed from Lee Killough.
Expand Down Expand Up @@ -135,6 +115,11 @@ void Sys_Init(void)
VERBOSE2( Con_Message("Sys_Init: Done in %.2f seconds.\n", (Sys_GetRealTime() - startTime) / 1000.0f) );
}

boolean Sys_IsShuttingDown(void)
{
return appShutdown;
}

/**
* Return to default system state.
*/
Expand Down

0 comments on commit 4033a77

Please sign in to comment.