CServerFrameView.cpp
上传用户:bsw_2008
上传日期:2013-07-09
资源大小:2446k
文件大小:17k
- // CServerFrameView.cpp : implementation of the CCServerFrameView class
- //
- #include "stdafx.h"
- #include "CServerFrame.h"
- #include "CServerFrameSet.h"
- #include "CServerFrameDoc.h"
- #include "CServerFrameView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #include "winsock.h"
- /////////////////////////////////////////////////////////////////////////////
- // CCServerFrameView
- char CH1=char(20);
- char ch=(char)13,ch1=(char)10;
- int BOARD[17][17]={
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-2,0,0,0,0,0,-2,-1,-1,-1,-1,-1},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,-1,0,-1,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
- {-1,-1,-1,-1,-1,-2,0,0,0,0,0,-2,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- {-1,-1,-1,-1,-1,-1,0,0,0,0,0,-1,-1,-1,-1,-1,-1},
- };
- IMPLEMENT_DYNCREATE(CCServerFrameView, CRecordView)
- BEGIN_MESSAGE_MAP(CCServerFrameView, CRecordView)
- //{{AFX_MSG_MAP(CCServerFrameView)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
- ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
- ON_MESSAGE(SER_MESSAGE,OnServerMessage)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CCServerFrameView construction/destruction
- CCServerFrameView::CCServerFrameView()
- : CRecordView(CCServerFrameView::IDD)
- {
- //{{AFX_DATA_INIT(CCServerFrameView)
- m_pSet = NULL;
- m_sShowText = _T("");
- //}}AFX_DATA_INIT
- // TODO: add construction code here
- }
- CCServerFrameView::~CCServerFrameView()
- {
- }
- void CCServerFrameView::DoDataExchange(CDataExchange* pDX)
- {
- CRecordView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CCServerFrameView)
- DDX_Control(pDX, IDC_ONLINELIST, m_OnlineList);
- DDX_Control(pDX, IDC_SHOWTEXT, m_output);
- DDX_Control(pDX, IDC_USERLIST, m_UserList);
- DDX_Text(pDX, IDC_SHOWTEXT, m_sShowText);
- //}}AFX_DATA_MAP
- }
- BOOL CCServerFrameView::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CRecordView::PreCreateWindow(cs);
- }
- void CCServerFrameView::OnInitialUpdate()
- {
- m_pSet = &GetDocument()->m_cServerFrameSet;
- CRecordView::OnInitialUpdate();
- GetParentFrame()->RecalcLayout();
- ResizeParentToFit();
- DWORD dwExStyle = LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP | LVS_EX_TRACKSELECT;
- m_UserList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
- LV_COLUMN lvColumn;
- lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
- lvColumn.fmt = LVCFMT_LEFT;
- lvColumn.cx = 67;
- lvColumn.pszText = "用户名";
- m_UserList.InsertColumn(0,&lvColumn);
- m_OnlineList.InsertColumn(0,&lvColumn);
- lvColumn.pszText = "姓别";
- m_UserList.InsertColumn(1,&lvColumn);
- m_OnlineList.InsertColumn(1,&lvColumn);
- lvColumn.pszText = "积分";
- m_UserList.InsertColumn(2,&lvColumn);
- m_OnlineList.InsertColumn(2,&lvColumn);
-
- if(m_pSet->IsOpen()==TRUE)
- m_pSet->Close();
- m_pSet->Open();
- CString str;
- if(m_pSet->GetRecordCount()>0)
- {
- m_pSet->MoveFirst();
- while(m_pSet->IsEOF()==FALSE)
- {
- str=m_pSet->m_name;
- m_UserList.InsertItem(0,str);
- str=m_pSet->m_sex;
- m_UserList.SetItemText(0,1,str);
- str.Format("%d",m_pSet->m_score);
- m_UserList.SetItemText(0,2,str);
- m_pSet->MoveNext();
- }
- }
- WSADATA wsaData;
- WORD version = MAKEWORD(2, 0);
- int ret = WSAStartup(version, &wsaData);
- if(ret != 0)
- {
- TRACE("Initilize Error!n"); //初始化失败
- AfxMessageBox("Failed in initial socket");
- }
- // m_connectionList.AssertValid();
- m_connectionList.RemoveAll();
- ASSERT(m_connectionList.GetCount()==0);
- m_bInit=FALSE;
- SetServer();
- //m_UserList.InsertItem(0,"zhou");
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCServerFrameView printing
- BOOL CCServerFrameView::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CCServerFrameView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CCServerFrameView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- LRESULT CCServerFrameView::OnServerMessage(WPARAM wParam, LPARAM lParam)
- {
- SOCKET socket;CString str;
- int length,len,i,j;char k;
- char s[1024];
- switch(lParam)
- {
- case FD_ACCEPT:
- socket= accept(m_server.m_hSocket,NULL,NULL);
- /*for(i=0;i<length;i++)
- {
- //ts=m_connectionList.GetAt(m_connectionList.FindIndex(i));
- s[0]=NULL;
- strcat(s,"一个游客进入了聊天室");
- //send(ts,s,strlen(s),0);
-
- }*/
- m_sShowText=m_sShowText+"一个游客进入了聊天室了"+ch+ch1;
- m_output.SetWindowText(m_sShowText);
- m_output.LineScroll(m_output.GetLineCount());
- m_connectionList.AddTail(socket);
- return 0;
- case FD_READ:
- length=m_connectionList.GetCount();
- for(i=0;i<length;i++)
- {
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(i));
- if(socket==wParam)
- {
- len=recv(socket,s,1024,0);
- s[len]=NULL;
- //将一个客户端发送的消息传递到其他客户端去
- /*for(j=0;j<length;j++)
- {
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(j));
- if(socket!=wParam)
- {
- send(socket,s,strlen(s),0);
- }
- }*/
- str.Empty();
- str=s;
- k=protocol.Analasys(str);
- dealMessage(k,i);
- if(k=='B'||k=='P')
- {
- for(j=0;j<length;j++)
- {
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(j));
- if(socket!=wParam)
- {
- send(socket,s,strlen(s),0);
- }
- }
- }
- m_sShowText=m_sShowText+s+ch+ch1;
- m_output.SetWindowText(m_sShowText);
- m_output.LineScroll(m_output.GetLineCount());
- return 0;
- }
- }
- return 0;
- case FD_WRITE:
- return 0;
- case FD_CLOSE:
- return 0;
- default:
- m_sShowText=m_sShowText+"An networking error has occured with a client"+ch+ch1;
- m_output.SetWindowText(m_sShowText);
- m_output.LineScroll(m_output.GetLineCount());
- return 0;
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCServerFrameView diagnostics
- #ifdef _DEBUG
- void CCServerFrameView::AssertValid() const
- {
- CRecordView::AssertValid();
- }
- void CCServerFrameView::Dump(CDumpContext& dc) const
- {
- CRecordView::Dump(dc);
- }
- CCServerFrameDoc* CCServerFrameView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCServerFrameDoc)));
- return (CCServerFrameDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CCServerFrameView database support
- CRecordset* CCServerFrameView::OnGetRecordset()
- {
- return m_pSet;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CCServerFrameView message handlers
- void CCServerFrameView::SetServer()
- {
- if(m_server.InitAndListen(this->m_hWnd,5022)==FALSE)
- {
- return;
- }
- else
- {
- m_bInit=TRUE;
- m_sShowText="服务器已建好!";
- m_sShowText+=(ch);
- m_sShowText+=(ch1);
- m_output.SetWindowText(m_sShowText);
- m_output.LineScroll(m_output.GetLineCount());
- }
- }
- void CCServerFrameView::dealMessage(char k,int i)
- {
- switch(k)
- {
- case 'A':
- ChatMessage(i);
- break;
- case 'L':
- RecordAddnew(i);
- break;
- case 'N':
- validate(i);
- break;
- case 'B':
- SitDown(i);
- break;
- case 'P':
- Leave(i);
- break;
- case 'Q':
- SendUserMessage(i);
- break;
- case 'C':
- GamerBegin(i);
- break;
- case 'E':
- play(i);
- break;
- }
- }
- void CCServerFrameView::ChatMessage(int i)
- {
- int i1,j;SOCKET socket;CString s;
- i1=protocol.desk/4;j=protocol.desk%4;
- int k;
- s=char(20);s+='A';s+=user[i].name;s+=":";s+=protocol.chat;s+=char(20);
- for(k=0;k<4;k++)
- {
- if(table[i1][j].d[k]==1)
- {
- if(table[i1][j].ID[k]!=i)
- {
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[i1][j].ID[k]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- }
- }
- }
-
- }
- void CCServerFrameView::RecordAddnew(int i)
- {
- if(!m_pSet->CanAppend())
- {
- return;
- }
- CString s;
- s.Format("%d",m_pSet->GetRecordCount()+1);
- m_pSet->MoveLast();
- m_pSet->AddNew();
- m_pSet->m_name=s;
- m_pSet->m_code=protocol.code;
- m_pSet->m_score=0;
- m_pSet->m_sex=protocol.sex;
- if(!m_pSet->Update())
- {
- AfxMessageBox("添加新记录失败!");
- return ;
- }
- m_pSet->Requery();
- m_pSet->MoveLast();
- SOCKET socket=m_connectionList.GetAt(m_connectionList.FindIndex(i));
- CString t;
- t=CH1;
- t+='M';t+=s;t+=CH1;
- send(socket,t.GetBuffer(0),t.GetLength(),0);
- }
- void CCServerFrameView::validate(int i)
- {
- m_pSet->MoveFirst();BOOL flag=FALSE;CString str,code;
- while(m_pSet->IsEOF()==FALSE)
- {
- str=m_pSet->m_name;
- if(compare(protocol.name,str))
- {
- code=m_pSet->m_code;
- if(compare(protocol.code,code))
- {
- flag=TRUE;
- user[i].name=protocol.name;user[i].sex=m_pSet->m_sex;
- user[i].sex.TrimRight();
- user[i].score=m_pSet->m_score;
- m_OnlineList.InsertItem(0,str);
- m_OnlineList.SetItemText(0,1,user[i].sex);
- str.Format("%d",user[i].score);
- m_OnlineList.SetItemText(0,2,str);
- }
- break;
- }
- m_pSet->MoveNext();
- }
- CString s=CH1;
- if(flag)
- {
- s+="O1";
- s+=TableMessage();
- }
- else
- s+="O0";
- s+=CH1;
- SOCKET socket=m_connectionList.GetAt(m_connectionList.FindIndex(i));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- }
- BOOL CCServerFrameView::compare(CString s1, CString s2)
- {
- BOOL flag=TRUE;int len=s1.GetLength();
- char ch1,ch2;int i=0;
- for(i=0;i<len;i++)
- {
- ch1=s1.GetAt(i);ch2=s2.GetAt(i);
- if(ch1!=ch2)
- {
- flag=FALSE;break;
- }
- }
- return flag;
- }
- CString CCServerFrameView::TableMessage()
- {
- CString s;s.Empty();
- int i,j,k;
- for(i=0;i<4;i++)
- for(j=0;j<4;j++)
- for(k=0;k<4;k++)
- {
- if(table[i][j].d[k]==1)
- s+='1';
- else
- s+='0';
- }
- return s;
- }
- void CCServerFrameView::SitDown(int i)
- {
- int i1,j,dr;
- i1=protocol.desk/4;j=protocol.desk%4;
- dr=protocol.direct;
- table[i1][j].d[dr]=1;
- table[i1][j].ID[dr]=i;
- }
- void CCServerFrameView::Leave(int i)
- {
- int i1,j,dr;
- i1=protocol.desk/4;j=protocol.desk%4;
- dr=protocol.direct;
- table[i1][j].d[dr]=0;
- if(table[i1][j].begin[0]==TRUE&&table[i1][j].begin[2]==TRUE||
- table[i1][j].begin[1]==TRUE&&table[i1][j].begin[3]==TRUE||
- table[i1][j].begin[0]==TRUE&&table[i1][j].begin[1]==TRUE&&
- table[i1][j].begin[2]==TRUE&&table[i1][j].begin[3]==TRUE)
- {
- dealloss(protocol.desk,protocol.direct);
- }
- }
- void CCServerFrameView::SendUserMessage(int i)
- {
- CString s,t;
- s+=char(20);s+='Q';
- int i1,j,dr,k;
- i1=protocol.desk/4;j=protocol.desk%4;
- dr=protocol.direct;
- for(k=0;k<4;k++)
- {
- if(table[i1][j].d[k]==1)
- {
- s+="1 ";
- s+=user[table[i1][j].ID[k]].name;s+=' ';
- s+=user[table[i1][j].ID[k]].sex;s+=' ';
- t.Format("%d ",user[table[i1][j].ID[k]].score);
- s+=t;
- }else
- {
- s+="0 ";
- }
- }
- s+=char(20);
- //MessageBox(s);
- SOCKET socket;
- for(k=0;k<4;k++)
- {
- if(table[i1][j].d[k]==1)
- {
- //MessageBox(s);
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[i1][j].ID[k]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- }
- }
- }
- //根据坐标和所在的方位,得到旋转后的坐标。
- POINT CCServerFrameView::rotate(POINT original,int direct)
- {
- POINT n;
- switch(direct)
- {
- case 0:
- n.x=16-original.y;
- n.y=original.x;
- break;
- case 1:
- n.x=original.x;
- n.y=original.y;
- break;
- case 2:
- n.x=original.y;
- n.y=16-original.x;
- break;
- case 3:
- n.x=16-original.x;
- n.y=16-original.y;
- break;
- }
- return n;
- }
- void CCServerFrameView::GamerBegin(int i)
- {
- POINT p,q;int i1,j,k,x1,y1,x=protocol.desk/4,y=protocol.desk%4;SOCKET socket;CString s;
- for(i1=11;i1<17;i1++)
- for(j=6;j<11;j++)
- {
- q.x=i1,q.y=j;
- p=rotate(q,protocol.direct);
- table[x][y].board[p.x][p.y]=protocol.board[i1][j];
- }
- table[x][y].begin[protocol.direct]=TRUE;
- if(table[x][y].begin[0]==TRUE&&table[x][y].d[0]==1&&
- table[x][y].begin[2]==TRUE&&table[x][y].d[2]==1&&table[x][y].d[1]!=1&&
- table[x][y].d[3]!=1)
- {
- s=char(20);s+="D20";s+=char(20);
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[x][y].ID[0]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- s=char(20);s+="D20";s+=char(20);
- for(x1=0;x1<17;x1++)
- for(y1=6;y1<11;y1++)
- table[x][y].board[x1][y1]=0;
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[x][y].ID[2]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- }else if(table[x][y].begin[1]==TRUE&&table[x][y].d[1]==1&&
- table[x][y].begin[3]==TRUE&&table[x][y].d[3]==1&&table[x][y].d[0]!=1&&
- table[x][y].d[2]!=1)
- {
- s=char(20);s+="D21";s+=char(20);
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[x][y].ID[1]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- s=char(20);s+="D21";s+=char(20);
- for(x1=6;x1<11;x1++)
- for(y1=0;y1<17;y1++)
- table[x][y].board[x1][y1]=0;
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[x][y].ID[3]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- }else if(table[x][y].begin[0]==TRUE&&table[x][y].d[0]==1&&
- table[x][y].begin[2]==TRUE&&table[x][y].d[2]==1&&
- table[x][y].begin[1]==TRUE&&table[x][y].d[1]==1&&
- table[x][y].begin[3]==TRUE&&table[x][y].d[3]==1)
- {
- s=char(20);s+="D40";s+=char(20);
- for(x1=6;x1<11;x1++)
- for(y1=6;y1<11;y1++)
- table[x][y].board[x1][y1]=0;
- for(k=0;k<4;k++)
- {
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[x][y].ID[k]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- }
- }
- }
- void CCServerFrameView::play(int i)
- {
- POINT p,q,T;CString s,t;SOCKET socket;int x,y,k,k1;
- x=protocol.desk/4;y=protocol.desk%4;
- T.x=protocol.from.x;T.y=protocol.from.y;
- p=rotate(T,protocol.direct);
- T.x=protocol.to.x;T.y=protocol.to.y;
- q=rotate(T,protocol.direct);
- //t.Format("%d %d",table[x][y].board[p.x][p.y],table[x][y].board[q.x][q.y]);
- //MessageBox(t);
- if(table[x][y].board[q.x][q.y]==12)
- {
- s=char(20);s+='I';t.Format("%d ",protocol.direct);
- s+=t;
- dealloss(protocol.desk,protocol.direct);
- }else if(table[x][y].board[p.x][p.y]==10&&table[x][y].board[q.x][q.y]>0
- ||table[x][y].board[q.x][q.y]==10&&table[x][y].board[p.x][p.y]>0)
- {
- s=char(20);s+='H';t.Format("%d %d %d %d ",p.x,p.y,q.x,q.y);
- s+=t;
- table[x][y].board[p.x][p.y]=0;
- table[x][y].board[q.x][q.y]=0;
- }else if(table[x][y].board[q.x][q.y]>table[x][y].board[p.x][p.y]&&!(
- table[x][y].board[p.x][p.y]==1&&table[x][y].board[q.x][q.y]==11))
- {
- s=char(20);s+='G';t.Format("%d %d %d %d ",p.x,p.y,q.x,q.y);
- s+=t;
- table[x][y].board[p.x][p.y]=0;
- }else if(table[x][y].board[q.x][q.y]==table[x][y].board[p.x][p.y])
- {
- s=char(20);s+='R';t.Format("%d %d %d %d ",p.x,p.y,q.x,q.y);
- s+=t;
- table[x][y].board[p.x][p.y]=0;
- table[x][y].board[q.x][q.y]=0;
- }else
- {
- s=char(20);s+='F';t.Format("%d %d %d %d ",p.x,p.y,q.x,q.y);
- s+=t;
- table[x][y].board[q.x][q.y]=table[x][y].board[p.x][p.y];
- table[x][y].board[p.x][p.y]=0;
- }
- for(k=0;k<4;k++)
- {
- if(table[x][y].ID[k]==i)
- {
- k1=k;break;
- }
- }
- k1=(k1-1+4)%4;
- if(table[x][y].d[k1]!=1)
- k1=(k1-1+4)%4;
- s+=char(k1+'0');
- s+=char(20);
- //CString st;
- //st.Format("%d ",k1);
- //MessageBox(st);
- for(k=0;k<4;k++)
- {
- if(table[x][y].d[k]==1)
- {
- socket=m_connectionList.GetAt(m_connectionList.FindIndex(table[x][y].ID[k]));
- send(socket,s.GetBuffer(0),s.GetLength(),0);
- }
- }
- }
- void CCServerFrameView::dealloss(int desk,int direct)
- {
- int i,j,k,f=0;
- i=desk/4;j=desk%4;
- for(k=0;k<4;k++)
- {
- if(table[i][j].begin[k]==TRUE)
- f++;
- }
- if(f==2)
- {
- for(k=0;k<4;k++)
- {
- if(table[i][j].begin[k]==TRUE)
- {
- if(k==direct)
- RecordModify(table[i][j].ID[k],-2);
- else
- RecordModify(table[i][j].ID[k],2);
- }
- }
- }else if(f==4)
- {
- for(k=0;k<4;k++)
- {
- if(k==direct&&((k+2)%4)==direct)
- {
- RecordModify(table[i][j].ID[k],-2);
- }else
- {
- RecordModify(table[i][j].ID[k],2);
- }
- }
- }
- for(k=0;k<4;k++)
- {
- table[i][j].begin[k]=FALSE;
- }
- }
- void CCServerFrameView::RecordModify(int i,int score)
- {
- if(!m_pSet->CanUpdate())
- {
- return;
- }
- m_pSet->MoveFirst();BOOL flag=FALSE;CString str;
- while(m_pSet->IsEOF()==FALSE)
- {
- str=m_pSet->m_name;
- if(compare(user[i].name,str))
- {
- break;
- }
- m_pSet->MoveNext();
- }
- m_pSet->Edit();
- m_pSet->m_score=user[i].score+score;
- user[i].score+=score;
- if(!m_pSet->Update())
- {
- AfxMessageBox("修改记录失败!");
- }
- m_pSet->Requery();
- }