mainwnd.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:8k
- // MainWnd.cpp : implementation file
- //
- #include "stdafx.h"
- #include "XmudOS.h"
- #include "MainWnd.h"
- #include "ShowMsg.h"
- #include "CmdPlayerLogon.h"
- #include "mapMapInfo.h"
- #include "CommandCheck.h"
- #include "CmdEmote.h"
- #include "Fight.h"
- #include "goodsgoodsGoods.h"
- #include "npcNpc.h"
- #include "wgscommon.h"
- #include "wgsDS_API.h"
- #include "skillskillskill.h"
- #include "hash.h"
- extern rmfullglobals myglobs;
- extern char g_tszPathName[256];
- extern char szDSHostName[32];
- extern int g_iActiveClientNum;
- extern SOCKET hPlayerServerSock;
- ShowMsg m_ShowMsg;
- CList <CBaseMap*,CBaseMap*>maplist;
- CList <TAdminConData *,TAdminConData* >adminsocketlist;
- CList <TClientConData *,TClientConData* >playersocketlist;
- CList <TDataUser*,TDataUser*>userlist;
- CList <TChatChannel*,TChatChannel*>chatchannellist;
- CList <CFight*,CFight*>killlist;
- CList <CFight*,CFight*>fightlist;
- /////////////////////////////////////////////////////////////////////////////
- // CMainWnd
- CMainWnd::CMainWnd()
- {
- }
- CMainWnd::~CMainWnd()
- {
- }
- BEGIN_MESSAGE_MAP(CMainWnd, CWnd)
- //{{AFX_MSG_MAP(CMainWnd)
- ON_WM_CREATE()
- ON_WM_CLOSE()
- ON_WM_DESTROY()
- ON_WM_SIZE()
- ON_COMMAND(ID_APP_EXIT, OnAppExit)
- ON_COMMAND(ID_APP_SHUTDOWN, OnAppShutdown)
- ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
- ON_WM_TIMER()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMainWnd message handlers
- int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- myglobs.hWndMain = m_hWnd;
- srand( (unsigned)time( NULL ) );
- /*
- CIPAddressCtrl m_IPAddressCtrl;
- RECT rcTmp;
- SetRect(&rcTmp,0,0,0,0);
- m_IPAddressCtrl.Create(WS_CHILD,rcTmp,this,9999);
- m_IPAddressCtrl.SetAddress(192,168,0,251);
- */
- InitializeCriticalSection(&myglobs.csAdminSocket);
- InitializeCriticalSection(&myglobs.csPlayerSocket);
- InitializeCriticalSection(&myglobs.csSentCliMsg);
- InitializeCriticalSection(&myglobs.csUserlist);
- InitializeCriticalSection(&myglobs.csMaplist);
- InitializeCriticalSection(&myglobs.csChatChannel);
- InitializeCriticalSection(&myglobs.csFightlist);
- InitializeCriticalSection(&myglobs.csRecordMsg);
- InitializeCriticalSection(&myglobs.csTalkMsg);
- InitializeCriticalSection(&myglobs.csPlayerData);
- InitializeCriticalSection(&myglobs.csUserLog);
- InitializeCriticalSection(&myglobs.csSockDataLog);
- GetClientRect(&myglobs.rcWinSize);
- m_ShowMsg.Create(ES_AUTOHSCROLL|ES_AUTOVSCROLL
- |ES_MULTILINE
- |ES_READONLY
- |ES_LEFT
- |WS_CHILD
- |WS_BORDER
- |WS_VSCROLL
- |WS_HSCROLL,
- myglobs.rcWinSize,
- this,
- IDC_EDIT_SHOWINFO);
- m_ShowMsg.ShowWindow(SW_SHOW);
- m_ShowMsg.UpdateWindow();
- FILE * cfg;
- char szFile[256];
- CTime Now=CTime::GetCurrentTime();
- sprintf(szFile,"%s\log\Info%s.log", g_tszPathName, Now.Format("%Y%m%d%H"));
- myglobs.flog = fopen(szFile,"a");
- if (myglobs.flog == NULL) {
- AfxMessageBox("Open Infolog file fail");
- exit(1);
- }else
- fprintf(myglobs.flog, "Emprise Server Started!n");
-
- //andy_re
- {
- char buf1[256];
- sprintf( buf1, "%s\playersave", g_tszPathName);
- if( CreateDir( buf1) == FALSE )
- return -1;
- }
- //弄