- Timestamp:
- Dec 25, 2012, 6:27:14 PM (12 years ago)
- Branches:
- master
- Children:
- 4c202e0
- Parents:
- baaf6c8
- Location:
- common
- Files:
-
- 1 added
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
common/Common.h
rbaaf6c8 redfd1d0 2 2 #define _COMMON_H 3 3 4 void set_nonblock(int sock) 4 #include <fcntl.h> 5 #include <assert.h> 6 7 void set_nonblock(int sock); 8 9 typedef struct 5 10 { 6 #ifdef WIN32 7 unsigned long mode = 1; 8 ioctlsocket(sock, FIONBIO, &mode); 9 #else 10 int flags; 11 flags = fcntl(sock, F_GETFL,0); 12 assert(flags != -1); 13 fcntl(sock, F_SETFL, flags | O_NONBLOCK); 14 #endif 15 } 11 int x; 12 int y; 13 } PLAYER_POS; 16 14 17 15 #endif -
common/Message.h
rbaaf6c8 redfd1d0 6 6 #define MSG_TYPE_LOGOUT 3 7 7 #define MSG_TYPE_CHAT 4 8 #define MSG_TYPE_PLAYER 5 8 9 9 10 typedef struct -
common/Player.cpp
rbaaf6c8 redfd1d0 10 10 this->name = name; 11 11 this->password = password; 12 this->pos.x = 200; 13 this->pos.y = 200; 12 14 13 15 cout << "Created new player: " << this->name << endl; … … 18 20 this->name = name; 19 21 this->password = ""; 22 this->pos.x = 200; 23 this->pos.y = 200; 20 24 this->addr = addr; 21 25 … … 31 35 this->addr = addr; 32 36 } 37 38 void Player::clearSensitiveInfo() 39 { 40 this->password = ""; 41 this->addr.sin_family = 0; 42 this->addr.sin_port = 0; 43 this->addr.sin_addr.s_addr = 0; 44 } -
common/Player.h
rbaaf6c8 redfd1d0 4 4 #include <netinet/in.h> 5 5 #include <string> 6 7 #include "Common.h" 6 8 7 9 using namespace std; … … 14 16 15 17 void setAddr(sockaddr_in addr); 18 void clearSensitiveInfo(); 16 19 17 20 string name; 18 21 string password; 19 22 sockaddr_in addr; 23 PLAYER_POS pos; 20 24 }; 21 25
Note:
See TracChangeset
for help on using the changeset viewer.