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

Last change on this file since 6319311 was 6319311, checked in by Dmitry Portnoy <dportnoy@…>, 11 years ago

Some redfinition issues related to winsock2 are fixed and a few allegro rendering functions are now in GameRender

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#ifndef _PLAYER_H
2#define _PLAYER_H
3
4#include <string>
5#include <map>
6
7#include "Common.h"
8#include "WorldMap.h"
9
10using namespace std;
11
12//forward declaration
13class Game;
14
15class Player {
16public:
17
18 enum PlayerClass {
19 CLASS_NONE,
20 CLASS_WARRIOR,
21 CLASS_RANGER
22 };
23
24 enum AttackType {
25 ATTACK_NONE,
26 ATTACK_MELEE,
27 ATTACK_RANGED
28 };
29
30 Player();
31 Player(const Player& p);
32 Player(string name, string password);
33
34 ~Player();
35
36 void setId(int id);
37 void setAddr(sockaddr_in addr);
38 void setClass(PlayerClass c);
39
40 void serialize(char* buffer);
41 void deserialize(char* buffer);
42
43 bool updateTarget(map<unsigned int, Player>& mapPlayers);
44 bool move(WorldMap *map);
45
46 void takeFlag(int flag, WorldMap* map);
47 void dropFlag(int flag, WorldMap* map);
48
49 int id;
50 string name;
51 string password;
52 sockaddr_in addr;
53 FLOAT_POSITION pos;
54 POSITION target;
55 unsigned long long timeLastUpdated;
56 unsigned long long timeAttackStarted;
57 unsigned long long timeDied;
58 bool isChasing;
59 bool isAttacking;
60 int targetPlayer;
61 bool isDead;
62
63 int playerClass;
64 int maxHealth;
65 int health;
66 int attackType;
67 int damage;
68 int range;
69 unsigned long long attackCooldown;
70 int team; // 0 is blue, 1 is red
71 bool hasBlueFlag;
72 bool hasRedFlag;
73
74 Game* currentGame;
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.