home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / rpc / mazelord / net.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-06  |  1.6 KB  |  57 lines

  1. /********************************************************************
  2. MODULE: Net.H
  3.  
  4. This module contains the definitions required for network packets, including
  5. specialized structures, network message numbers, and so on.
  6. ********************************************************************/
  7.  
  8. #ifndef _NET_H_INC_
  9. #define _NET_H_INC_
  10.  
  11. #define NP_NEWPLAYER        1
  12. #define NP_REQUESTIDENTITY  2
  13. #define NP_MOVETO           3
  14. #define NP_SHOTFIRED        4
  15. #define NP_LEAVINGGAME      5
  16. #define NP_HITCONFIRM       6
  17. #define NP_SCORE            7
  18. #define NP_INTONE           8
  19.  
  20. #define MAX_PACKET_SIZE                400
  21. #ifndef MAX_COMPUTERNAME_LENGTH
  22. #define MAX_COMPUTERNAME_LENGTH         32
  23. #endif
  24. #define MAX_USERNAME_LENGTH             32
  25.  
  26.                 /* A network packet is all crunched together, leading directly
  27.                    from the header on into data. We make cData the last element
  28.                    of the header, then take a pointer to it, and viola!
  29.                    beginning of message-specific information.
  30.                  */
  31. struct _s_NetPacketType {
  32.   unsigned long ulSender;
  33.   unsigned long ulDest;
  34.   DWORD dwPacketType;
  35.   char cData;           // We'll take a pointer to this for start of info.
  36.   };
  37. typedef struct _s_NetPacketType NetPacketType;
  38.  
  39.  
  40. struct _s_PlayerInfoType {
  41.   unsigned long ulID;
  42.   DWORD dwPID;
  43.   char cUserName[MAX_USERNAME_LENGTH];
  44.   char cComputerName[MAX_COMPUTERNAME_LENGTH];
  45.   int ix, iy;
  46.   BYTE bFacing;
  47.   int iScore;
  48.   int iPicNum;
  49.   int iGridNum;
  50.   POINT pGridLoc;
  51.   };
  52.  
  53. typedef struct _s_PlayerInfoType PlayerInfoType;
  54.  
  55.  
  56. #endif
  57.