Lianzhong Upgrade Agreement Analysis Continued Article (5) Cloud Network (Jimzj@21cn.com) Connecting to the 5th, the card order is so much, and now finally, the most important part of all agreement analysis; records each player Out of the card information, you can analyze what kind of card remaining.
0x0000 0D 20 00 00 38 00 00 00-00 00 00 00 01 00 00 00. ..8 ........... 0x0010 00 00 00 00 00 00 00 00-01 00 00 00 00 00 00 00 .............. 0x0020 3C 00 00 00 2F 00 00 00 00 00 00 00 00 00 00 <... / ........ 0x0030 00 00 00 00 00 00 00 00 00 ................
In the information of the card, you should include the number of the card number, the next birth card number, the number of cards, the number of colors of the card, and this information. I understand this information. The data is not problematic, with the command word, and other content is easy to understand. In addition, through the analysis of the protocol, a round of duct marks, current score, huh, this is sent by the server, and some difficult L. For score, this is to answer a few such instructions can be seen, because the first few generals are generally zero, so they can't see it. So you want to display the remaining points on the plug-in can also use this proofreading. The data structure of the card is defined as follows (because there are multiple cards, so loop)
Typedef strund_tagshjisndcard {// Outporate Char ccurout; // Current Outper Char cflag0; char cflag1; char coutCount; // Visit Zhang CHAR CFLAG3; char cflag4; char cflag5;
Int nshuaipai; int nflag4;
CHAR CNEXTOUT; / / The next discretion Char cflag6; char cflag7; char cflag8;
CHAR CENDFLAG; // End Sign Char cflag9; char cflag10; char cflag11;
Int nscore; // Current score} shjisndcard, * lpshjisndcard;
TypedEf struct, {// card information int nposition; // card location information char ccolor; // brand color (0-square, 1-grass flower, 2-red peach, 3-黑) char cflag0; char cflag1; char cflag2 CHAR ccard; // Out of the brand char cflag3; char cflag4; char cflag5;
INT nflag6; int NFLAG7; int NFLAG9;} shjicardinfo, * lpshjicardinfo; Most of the data structures that you have seen are divided into two parts, because a package contains multiple cycles, so don't have to be Duplicate parts to define the same structure, only loop it. With the above structure, you can get the information of the player's card, as shown below:
Void __fastcall tfrmmain :: revSendcard (char * ppackcontent) {shjisndcard * Pinfo = (shjisndcard *) PPackContent
For (int i = 0; i
If (i == 0) // Contrast the first card, if it is the same, return {if (m_lastcard.ecolor == (gamecardcolor) pcard-> ccolor && m_lastcard.card == pcard-> ccard && m_lastcard.ncardpos = = Pinfo-> ccurout) return;
IF (m_curcolor.btstatus == 1) // Settings You can check the no brand status flag {m_curcolor.rcurcolor = (gamecardcolor) PCard-> ccolor; m_curcolor.btstatus = 2; m_curcolor.ccard = pcard-> ccard;}}
SetsendCardPic (Pinfo-> CCUROUT, PINFO-> CNEXTOUT, PINFO-> NSCORE, (GameCardColor) PCard-> CCOLOR, PCARD-> CCard);
IF (i == 0) {m_lastcard.ecolor = (GameCardColor) PCard-> ccolor; m_lastcard.ccard = pcard-> ccard; m_lastcard.ncardpos = pinfo-> ccurout;
IF (m_curcolor.btstatus == 2) // Detection whether the current user does not have the primary IF of the card (PCard-> ccard == m_cdaji || pcard-> ccard == 0x34 || PCard- > cCard == 0x35 || (GAMECARDCOLOR) pCard-> cColor == m_eZhuColor) {if ((m_CurColor.cCard == m_cDaJi || m_CurColor.cCard == 0x34 || m_CurColor.cCard == 0x35 || m_CurColor.rCurColor = = m_ezhucolor) == false) {setColorHave (Pinfo-> ccurout, m_ezhucolor); // This kind of card has no}} else if (gamecardcolor) PCard-> ccolor! = m_curcolor.rcurcolor) {setColorHave (Pinfo-> CCUROUT, M_CURCOLOR.RCURCOLOR); // This brand is not}}} After the information of each player is collected, you can determine what kind of card he has based on the card information now. The results of the analysis are displayed directly on the plug-in interface. Let your users know what cards are of others, knowing that they have known each other, hehe, huh J