SmaugWizDoc.h
SmaugWizard/Src/SmaugWizDoc.h · 4.2 KB
From the archive SmaugWiz203.zip
Download the archive « Back to the archive contents
/****************************************************************************
* [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame | *
* -----------------------------------------------------------| \\._.// *
* SmaugWizard (C) 1998 by Russ Pillsbury (Windows NT version)| (0...0) *
* -----------------------------------------------------------| ).:.( *
* SMAUG (C) 1994, 1995, 1996 by Derek Snider | {o o} *
* -----------------------------------------------------------| / ' ' \ *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus, |~'~.VxvxV.~'~*
* Scryn, Swordbearer, Rennard, Tricops, and Gorog. | *
* ------------------------------------------------------------------------ *
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik Staerfeldt, Tom Madsen, and Katja Nyboe. *
* ------------------------------------------------------------------------ *
* SmaugWizDoc Interface file *
****************************************************************************/
#ifndef SMAUGWIZDOC_H
#define SMAUGWIZDOC_H
#include "swtime.h"
#include "log.h"
void ResendExitMsg (); // global function to end app
#define MAX_EXCEPTIONS 200
#define LINE_LEN 128
#define MAX_LINES 120
class CSmaugWizDoc : public CDocument {
protected: // create from serialization only
CSmaugWizDoc();
DECLARE_DYNCREATE(CSmaugWizDoc)
// Attributes
public:
CSmaugSocket* m_pControl;
CLog* m_pLog; // standard error log
CPtrList m_DList;
BOOL m_bReboot;
BOOL m_bInLoop;
int m_ScrPos;
BOOL m_bShuttingDown;
BOOL m_bDenyNewPlayers;
char m_ScrBuf [MAX_LINES][LINE_LEN];
CString m_CurrentDir;
CSwTime m_StartTime;
CSwTime m_RebootTime, m_BootTime;
int m_TimeTilStart;
int m_ExceptionCount;
// Operations
public:
void gettimeofday (struct timeval *tp, void *tzp = NULL)
{ tp->tv_sec = time (NULL); tp->tv_usec = 0; }
CString GetTimeString (CTime& t)
{ return t.Format ("%a %b %d %Y %H:%M:%S"); }
CString GetTimeString (time_t& t)
{ return GetTimeString ((CTime) t); }
CString GetCurrentTimeString ()
{ CTime t = CTime::GetCurrentTime ();
return GetTimeString (t); }
void LogString (const char *str, LogTypes type = LOG_NORMAL,
short level = LEVEL_LOG);
void LogStringf (LogTypes type, short level, char *fmt, ...);
BOOL IsReboot () { return m_bReboot; }
void SetReboot () { m_bReboot = TRUE; }
BOOL BootAndStart ();
void GameLoop (CDC* pDC);
void LogToScreen (LogTypes type, const char* msg);
char* GetData (int row);
int GetLineCount () { return m_ScrPos; }
BOOL CloseAllDescriptors (BOOL bForce = FALSE);
void SetStartTime ();
void SetBootTime ();
void SetTitle ();
void ShutSmaugDown ();
BOOL IsShuttingDown () { return m_bShuttingDown; }
void DoEmergencyReboot ();
CString GetRegisteredSmaugWizPath (const char* name);
void SetRegisteredSmaugWizPath (const char* name, CString& path);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSmaugWizDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSmaugWizDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CSmaugWizDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//#define n_DEBUG
#ifdef n_DEBUG
#ifdef SMAUGSERVER_CPP
CMemoryState oldMemState, newMemState, diffMemState;
#endif
extern CMemoryState oldMemState;
extern CMemoryState newMemState;
extern CMemoryState diffMemState;
#endif
#endif // SMAUGWIZDOC_H