source: network-game/common/Player.h@ d436ac4

Last change on this file since d436ac4 was d436ac4, checked in by dportnoy <dmp1488@…>, 12 years ago

Modified the player class to include the team and whether the player has either of the flags

  • Property mode set to 100644
File size: 921 bytes
RevLine 
[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]18using namespace std;
19
[8e540f4]20class Player {
[2488852]21public:
[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
[d436ac4]34 void draw(POSITION pos, bool curPlayer);
[227baaa]35 bool move(WorldMap *map);
[60017fc]36
[d436ac4]37 void takeFlag(int flag, WorldMap *map);
38 void dropFlag(int flag, WorldMap *map);
39
[01d0d00]40 int id;
[8e540f4]41 string name;
[59061f6]42 string password;
[8e540f4]43 sockaddr_in addr;
[60017fc]44 FLOAT_POSITION pos;
45 POSITION target;
[8f85180]46 unsigned long long timeLastUpdated;
[d436ac4]47
48 int team; // 0 is blue, 1 is red
49 bool hasBlueFlag;
50 bool hasRedFlag;
[2488852]51};
52
53#endif
Note: See TracBrowser for help on using the repository browser.