// ctcls.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "ctcls.h"

#pragma data_seg(".SHARED_DATA")
// all data in this section must be INITIALIZED!!!!!!!!!!!!!
int g_nApplType = _EAT_None;
int g_nApplState = _EAS_None;
int g_nGameState = _EGS_None;
int g_nGameTime = -1;
int g_nGameIsServer = 2;
#pragma data_seg()
#pragma comment(linker, "/section:.SHARED_DATA,RWS")

BOOL APIENTRY DllMain(HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
    switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
		case DLL_THREAD_ATTACH:
		case DLL_THREAD_DETACH:
            break;
		case DLL_PROCESS_DETACH:
            CTCL_SetGameState(_EGS_None);
            CTCL_SetApplState(_EAS_None);
            CTCL_SetApplType(_EAT_None);
			break;
    }
    return TRUE;
}

CTCLS_API DWORD CTCL_GetVersion()
{
    return CTCL_VERSION;
}

CTCLS_API int CTCL_GetApplType()
{
    return g_nApplType;
}

CTCLS_API void CTCL_SetApplType(int nApplType)
{
    g_nApplType = nApplType;
}

CTCLS_API int CTCL_GetApplState()
{
    return g_nApplState;
}

CTCLS_API void CTCL_SetApplState(int nApplState)
{
    g_nApplState = nApplState;
}

CTCLS_API int CTCL_GetGameState()
{
    return g_nGameState;
}

CTCLS_API void CTCL_SetGameState(int nGameState)
{
    g_nGameState = nGameState;
}

CTCLS_API int CTCL_GetGameTime()
{
    return g_nGameTime;
}

CTCLS_API void CTCL_SetGameTime(int nGameTime)
{
    g_nGameTime = nGameTime;
}

CTCLS_API int CTCL_GetGameIsServer()
{
    return g_nGameIsServer;
}

CTCLS_API void CTCL_SetGameIsServer(int nGameIsServer)
{
    g_nGameIsServer = nGameIsServer;
}
