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
RevLine 
[2488852]1#ifndef _PLAYER_H
2#define _PLAYER_H
3
4#include <string>
[ff2133a]5#include <map>
[2488852]6
[edfd1d0]7#include "Common.h"
[a1a3bd5]8#include "WorldMap.h"
[edfd1d0]9
[2488852]10using namespace std;
11
[f41a7f9]12//forward declaration
13class Game;
14
[8e540f4]15class Player {
[2488852]16public:
[07c73fa]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
[01d0d00]30 Player();
31 Player(const Player& p);
[59061f6]32 Player(string name, string password);
[01d0d00]33
[8e540f4]34 ~Player();
[2488852]35
[01d0d00]36 void setId(int id);
[59061f6]37 void setAddr(sockaddr_in addr);
[46fa35a]38 void setClass(PlayerClass c);
39
40 void serialize(char* buffer);
41 void deserialize(char* buffer);
[59061f6]42
[5b1e31e]43 bool updateTarget(map<unsigned int, Player>& mapPlayers);
[227baaa]44 bool move(WorldMap *map);
[60017fc]45
[ff2133a]46 void takeFlag(int flag, WorldMap* map);
47 void dropFlag(int flag, WorldMap* map);
[d436ac4]48
[01d0d00]49 int id;
[8e540f4]50 string name;
[59061f6]51 string password;
[8e540f4]52 sockaddr_in addr;
[60017fc]53 FLOAT_POSITION pos;
54 POSITION target;
[8f85180]55 unsigned long long timeLastUpdated;
[8dad966]56 unsigned long long timeAttackStarted;
[c76134b]57 unsigned long long timeDied;
[11d21ee]58 bool isChasing;
[8dad966]59 bool isAttacking;
60 int targetPlayer;
[c76134b]61 bool isDead;
[d436ac4]62
[07c73fa]63 int playerClass;
64 int maxHealth;
65 int health;
66 int attackType;
67 int damage;
[11d21ee]68 int range;
[8dad966]69 unsigned long long attackCooldown;
[d436ac4]70 int team; // 0 is blue, 1 is red
[74b8e79]71 bool hasBlueFlag;
[d436ac4]72 bool hasRedFlag;
[f41a7f9]73
74 Game* currentGame;
[2488852]75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.