Code Documentation Guidelines

Code Documentation Guidelines

<p>PROGRAM HEADER</p><p>/////////////////////////////////////////////////////////////////////////////////// //------WinSock.cpp------// // v 1.2 // // // // This program will initialize WinSock and then attempt to open a socket and // // send info to the other computer. This is the client portion of the client- // // server model. After the data has been sent, the program will close the socket // // and save the data to a file // // // // Created by: Drew Sikora // // Created on: 9.24.00 // // // //------Notes------// // // // The file save feature has not yet been implemented in this version. Also, we // // are trying to trace a bug in the send/receive section. Sometimes the packets // // are dropped for no apparent reason (not net congestion). Just re-run the // // program. // // // ///////////////////////////////////////////////////////////////////////////////////</p><p>FUNCTION HEADER</p><p>/////////////////////////////////////////////////////////////////////////////////// //------MakeWindow()------// // // // This function will take in parameters usually sent to a CreateWindow() // // function and use them to make the call to CreateWindow(). This is so the user // // can make many windows without having to type out a new CreateWindow() // // function call with most of the same parameters // // // //------Variables------// // // // hwnd - the window handle // // lpTitle - the string to appear in the title bar // // style - window style flags // // // HWND MakeWindow(HWND hwnd, LPCTSTR lpTitle, DWORD style)/////////////////////////// {</p><p>/////////////////// // function code // ///////////////////</p><p>} // end MakeWindow() INTERNAL FUNCTION COMMENTS STATE ChangeState(int current_state, int change_state)///////////////////////////// { // use a switch statement to decide whether or not to end the game switch(change_state) { case DEAD: { // change the current state so that the game is over current_state = GAME_END; } break; case ALIVE: { // change the current state so that the game goes on current_state = GAME_CONT; } break; }</p><p>// return the new game state return(current_state);</p><p>} // end ChangeState()</p><p>INTERNAL TYPDEF COMMENTS // define the structure to hold our packet header, which is sent to the client and // // and then sent to the other players, and contains game information // user pos, weapon, etc) typedef struct IP_HEADER { char packinfo[80]; // any text message sent GAME_STATS gamedata; // structure to hold player info WCHAR packname; // used for client ID on the server int packsize; // in bytes ADDR_HEADER packaddr; // structure for packet addr, to and from UINT packstyle; // any flags – see PacketS.h } IP_HEADER;</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us