www.pudn.com > 3D_OnlineGame_Humen.rar > InterNetMsg.cpp
#include "stdafx.h" #include "XMudClient.h" #include "InterNetMsg.h" #include "InitInternet.h" #include "CommunicateMsg.h" #include "MenuCreateNew.h" #include "MenuLoadOldPlay.h" #include "MapInfo.h" extern int g_nGameState; extern int g_nReceiveMsgState; extern CMenuCreateNew m_MenuCreateNew; extern CMenuLoadOldPlay m_MenuLoadOldPlay; extern HANDLE gSendToSvrThread; //extern CString g_csSendToServerMsg; extern SOCKET hLCltForRSvrSock; //extern int nRecTimes; //接收到的信息次數 extern char szSendBuf[]; // guanhua 2000/09/29 +1 extern CListplayerlist; CString lastRcvBuf; BOOL ExplainSvrMsg(char *szBuf) { CString strtmp; static BOOL bRcvFrist = TRUE; // DWORD dwSendSvr; char tmptmp[10]; switch(g_nReceiveMsgState) { /*cary case MAINSRVMSG_SYSLOG: if(!MainSrvLogReceive()) g_nReceiveMsgState = SVRMSG_NOTHING; break; end*/ case SVRMSG_SYSLOG: UserSignReceive(szBuf); g_nReceiveMsgState=SVRMSG_NOTHING; break; case SVRMSG_CREATENEW: { strtmp = szBuf; if(bRcvFrist) { if(strcmp(strtmp.Left(2),"OK")) { lastRcvBuf = strtmp; m_MenuCreateNew.UsreCreateNewPlayerReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; //cary wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); //end } else { m_MenuCreateNew.CreateSaveFile(); if(!strcmp(strtmp.Right(13),"'MAPDATAEND'\t")) { lastRcvBuf = strtmp; m_MenuCreateNew.UsreCreateNewPlayerReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; //cary wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); //end } else { bRcvFrist = FALSE; // nRecTimes ++; lastRcvBuf = strtmp; strtmp.Empty(); itoa(lastRcvBuf.GetLength(),tmptmp,10); //cary wsprintf(szSendBuf,"%s %s",SZGETMISSBUF,tmptmp); Send(); //end } } } else { if(!strcmp(strtmp.Left(5),SZSENDMISSBUF)){ lastRcvBuf += strtmp.Right(strtmp.GetLength() - 5); if(!strcmp(lastRcvBuf.Right(13),"'MAPDATAEND'\t")){ bRcvFrist = TRUE; m_MenuCreateNew.UsreCreateNewPlayerReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); }else{ itoa(strtmp.GetLength() - 5, tmptmp, 10); wsprintf(szSendBuf,"%s %s",SZGETMISSBUF,tmptmp); Send(); } } } } break; case SVRMSG_LOADOLD: { strtmp = szBuf; if(bRcvFrist){ if(strcmp(strtmp.Left(2),"OK")){ lastRcvBuf = strtmp; m_MenuLoadOldPlay.UsreLoadOldPlayerReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); }else{ if(!strcmp(strtmp.Right(13),"'MAPDATAEND'\t")){ lastRcvBuf = strtmp; m_MenuLoadOldPlay.UsreLoadOldPlayerReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); }else{ bRcvFrist = FALSE; lastRcvBuf = strtmp; strtmp.Empty(); itoa(lastRcvBuf.GetLength(),tmptmp,10); wsprintf(szSendBuf,"%s %s",SZGETMISSBUF,tmptmp); Send(); } } }else{ if(!strcmp(strtmp.Left(5),SZSENDMISSBUF)){ lastRcvBuf += strtmp.Right(strtmp.GetLength() - 5); if(!strcmp(lastRcvBuf.Right(13),"'MAPDATAEND'\t")){ bRcvFrist = TRUE; m_MenuLoadOldPlay.UsreLoadOldPlayerReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); }else{ itoa(strtmp.GetLength() - 5, tmptmp, 10); wsprintf(szSendBuf,"%s %s",SZGETMISSBUF,tmptmp); Send(); } } } } break; case SVRMSG_CHANGEMAP: { strtmp = szBuf; if(bRcvFrist) { if(!strcmp(strtmp,"CHANGEMAP Fight")){ g_nGameState = GAME_MAIN; g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); break; } if(strcmp(strtmp,"OK")){ lastRcvBuf = strtmp; ChangeMapReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); }else { if(!strcmp(strtmp.Right(13),"'MAPDATAEND'\t")){ lastRcvBuf = strtmp; ChangeMapReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); CPlayerInfo *lpPlayerInfo = playerlist.GetHead(); lpPlayerInfo->m_nEscapeNow = 0; }else{ bRcvFrist = FALSE; lastRcvBuf = strtmp; strtmp.Empty(); itoa(lastRcvBuf.GetLength(),tmptmp,10); wsprintf(szSendBuf,"%s %s",SZGETMISSBUF,tmptmp); Send(); } } }else{ if(!strcmp(strtmp.Left(5),SZSENDMISSBUF)){ lastRcvBuf += strtmp.Right(strtmp.GetLength() - 5); if(!strcmp(lastRcvBuf.Right(13),"'MAPDATAEND'\t")){ bRcvFrist = TRUE; ChangeMapReceive(); lastRcvBuf.Empty(); g_nReceiveMsgState = SVRMSG_NOTHING; wsprintf(szSendBuf,"%s",SZCANHEALING); Send(); }else{ itoa(strtmp.GetLength() - 5, tmptmp, 10); wsprintf(szSendBuf,"%s %s",SZGETMISSBUF,tmptmp); Send(); } } } } break; default: return FALSE; break; } return TRUE; }