Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ClientProtocol.cpp
Package: zhou_NetworkGame-JunQi.rar [view]
Upload User: bsw_2008
Upload Date: 2013-07-09
Package Size: 2446k
Code Size: 3k
Category:
Chess Poker games
Development Platform:
Visual C++
- // ClientProtocol.cpp: implementation of the CClientProtocol class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "cgamehallframe.h"
- #include "ClientProtocol.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CClientProtocol::CClientProtocol()
- {
- }
- CClientProtocol::~CClientProtocol()
- {
- }
- char CClientProtocol::Anaysys(CString str)
- {
- char k=' ',ch;int i=0,i1,i2,i3;
- ch=str.GetAt(i);
- if(ch!=char(20))
- return k;
- k=str.GetAt(++i);
- name.Empty();
- switch(k)
- {
- case 'M':
- ch=str.GetAt(++i);
- while(ch!=' '&&ch!=char(20))
- {
- name+=ch;
- ch=str.GetAt(++i);
- }
- break;
- case 'O':
- ch=str.GetAt(++i);
- if(ch=='1')
- {
- right=1;
- for(i1=0;i1<4;i1++)
- for(i2=0;i2<4;i2++)
- for(i3=0;i3<4;i3++)
- {
- ch=str.GetAt(++i);
- table[i1][i2].d[i3]=(int)(ch-'0');
- }
- }
- else
- right=0;
- break;
- case 'B':
- case 'P':
- desk=0;
- ch=str.GetAt(++i);
- while(ch!=' '&&ch!=char(20))
- {
- desk=desk*10+(int)(ch-'0');
- ch=str.GetAt(++i);
- }
- ch=str.GetAt(++i);
- direct=(int)(ch-'0');
- break;
- case 'Q':
- for(i1=0;i1<4;i1++)
- {
- ch=str.GetAt(++i);
- if(ch=='1')
- {
- user.ID[i1]=1;
- i++;
- ch=str.GetAt(++i);user.name[i1].Empty();
- while(ch!=' '&&ch!=char(20))
- {
- user.name[i1]+=ch;
- ch=str.GetAt(++i);
- }
- ch=str.GetAt(++i);
- user.sex[i1].Empty();
- while(ch!=' '&&ch!=char(20))
- {
- user.sex[i1]+=ch;
- ch=str.GetAt(++i);
- }
- ch=str.GetAt(++i);
- user.score[i1].Empty();
- while(ch!=' '&&ch!=char(20))
- {
- user.score[i1]+=ch;
- ch=str.GetAt(++i);
- }
- }else
- {
- user.ID[i1]=0;
- ch=str.GetAt(++i);
- }
- }
- break;
- case 'A':
- ch=str.GetAt(++i);chat.Empty();
- while(ch!=char(20))
- {
- chat+=ch;
- ch=str.GetAt(++i);
- }
- break;
- case 'D':
- ch=str.GetAt(++i);
- if(ch=='2')
- war_kind=TRUE;
- else
- war_kind=FALSE;
- ch=str.GetAt(++i);
- r=(int)(ch-'0');
- break;
- case 'G':
- case 'R':
- case 'F':
- case 'H':
- ch=str.GetAt(++i);from.x=0;
- while(ch!=' '&&ch!=char(20))
- {
- from.x=from.x*10+(int)(ch-'0');
- ch=str.GetAt(++i);
- }
- ch=str.GetAt(++i);from.y=0;
- while(ch!=' '&&ch!=char(20))
- {
- from.y=from.y*10+(int)(ch-'0');
- ch=str.GetAt(++i);
- }
- ch=str.GetAt(++i);to.x=0;
- while(ch!=' '&&ch!=char(20))
- {
- to.x=to.x*10+(int)(ch-'0');
- ch=str.GetAt(++i);
- }
- ch=str.GetAt(++i);to.y=0;
- while(ch!=' '&&ch!=char(20))
- {
- to.y=to.y*10+(int)(ch-'0');
- ch=str.GetAt(++i);
- }
- ch=str.GetAt(++i);
- r=(int)(ch-'0');
- break;
- case 'I':
- ch=str.GetAt(++i);
- direct=(int)(ch-'0');
- r=-1;
- break;
- }
- return k;
- }