struct.h
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:1k
- #ifndef _PLAYER_H
- #define _PLAYER_H
- #define OP_READ 0
- #define OP_WRITE 1
- #define OP_ACCEPT 2
- #define DEFBUFFERSIZE 64
- #define MAXTABLE 2
- #define MAXPLAYER 4
- #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
- #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)= NULL; } }
- #define INCSCOPE(x,min,max) (++(x)>=(max))?((x)=(min)):(x)
- #define DESSCOPE(x,min,max) (--(x)<=(min))?((x)=(max)):(x)
- // JUDGE
- // PLAYER
- typedef struct _PLAYER {
- DWORD status;
- SOCKET socket;
- // _PLAYER *prev;
- _PLAYER *next;
- LPVOID table;
- int seat;
- } PLAYER, * LPPLAYER;
- // OVERLAPPEDEX
- typedef struct _OVERLAPPEDEX {
- OVERLAPPED ol;
- SOCKET socket;
- int op;
- WSABUF wbuf;
- char buf[DEFBUFFERSIZE];
- DWORD bytes;
- LPPLAYER ppla;
- } OVERLAPPEDEX, * LPOVERLAPPEDEX;
- // FOOD
- typedef struct _FOOD {
- bool exsit;
- DWORD existnum;
- DWORD notexistnum;
- DWORD counter;
- } FOOD, * LPFOOD;
- // GROUP
- typedef struct _GAMETABLE {
- DWORD status;
- PLAYER *players[MAXPLAYER];
- FOOD food;
- int max;
- int current;
- int counter;
- } GAMETABLE, * LPGAMETABLE;
- #define DEFFOODEXFRAME 450 // 30fps * 15sec
- #define DEFFOODNOTEXFRAME 150 // 30fps * 5sec
- enum FoodType { FOOD_SHIP, FOOD_KEEPBASE, FOOD_POWERUP, FOOD_BLOODUP,
- FOOD_SPEEDUP, FOOD_MAX };
- #endif // _PLAYER_H