source:
network-game/common/Player.h@
e4a5786
| Last change on this file since e4a5786 was 74b8e79, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 874 bytes | |
| Rev | Line | |
|---|---|---|
| [2488852] | 1 | #ifndef _PLAYER_H |
| 2 | #define _PLAYER_H | |
| 3 | ||
| [4c202e0] | 4 | #include "Compiler.h" |
| 5 | ||
| 6 | #if defined WINDOWS | |
| 7 | #include <winsock2.h> | |
| 8 | #include <WS2tcpip.h> | |
| 9 | #elif defined LINUX | |
| 10 | #include <netinet/in.h> | |
| 11 | #endif | |
| 12 | ||
| [2488852] | 13 | #include <string> |
| 14 | ||
| [edfd1d0] | 15 | #include "Common.h" |
| [a1a3bd5] | 16 | #include "WorldMap.h" |
| [edfd1d0] | 17 | |
| [2488852] | 18 | using namespace std; |
| 19 | ||
| [8e540f4] | 20 | class Player { |
| [2488852] | 21 | public: |
| [01d0d00] | 22 | Player(); |
| 23 | Player(const Player& p); | |
| [59061f6] | 24 | Player(string name, string password); |
| [01d0d00] | 25 | |
| [8e540f4] | 26 | ~Player(); |
| [2488852] | 27 | |
| [3b8adee] | 28 | void serialize(char* buffer); |
| 29 | void deserialize(char* buffer); | |
| 30 | ||
| [01d0d00] | 31 | void setId(int id); |
| [59061f6] | 32 | void setAddr(sockaddr_in addr); |
| 33 | ||
| [227baaa] | 34 | bool move(WorldMap *map); |
| [60017fc] | 35 | |
| [d436ac4] | 36 | void takeFlag(int flag, WorldMap *map); |
| 37 | void dropFlag(int flag, WorldMap *map); | |
| 38 | ||
| [01d0d00] | 39 | int id; |
| [8e540f4] | 40 | string name; |
| [59061f6] | 41 | string password; |
| [8e540f4] | 42 | sockaddr_in addr; |
| [60017fc] | 43 | FLOAT_POSITION pos; |
| 44 | POSITION target; | |
| [8f85180] | 45 | unsigned long long timeLastUpdated; |
| [d436ac4] | 46 | |
| 47 | int team; // 0 is blue, 1 is red | |
| [74b8e79] | 48 | bool hasBlueFlag; |
| [d436ac4] | 49 | bool hasRedFlag; |
| [2488852] | 50 | }; |
| 51 | ||
| 52 | #endif |
Note:
See TracBrowser
for help on using the repository browser.
![(please configure the [header_logo] section in trac.ini)](/medieval/chrome/site/your_project_logo.png)