Code Documentation Guidelines

Total Page:16

File Type:pdf, Size:1020Kb

Code Documentation Guidelines

PROGRAM HEADER

/////////////////////////////////////////////////////////////////////////////////// //------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. // // // ///////////////////////////////////////////////////////////////////////////////////

FUNCTION HEADER

/////////////////////////////////////////////////////////////////////////////////// //------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)/////////////////////////// {

/////////////////// // function code // ///////////////////

} // 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; }

// return the new game state return(current_state);

} // end ChangeState()

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;

Recommended publications