|
Revision 1, 1.7 kB
(checked in by poillubo, 2 years ago)
|
* initial import
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
#ifndef PLAYER_HH |
|---|
| 22 |
#define PLAYER_HH |
|---|
| 23 |
|
|---|
| 24 |
#include <string> |
|---|
| 25 |
#include <set> |
|---|
| 26 |
#include <vector> |
|---|
| 27 |
|
|---|
| 28 |
#include "item.hh" |
|---|
| 29 |
#include "resource.hh" |
|---|
| 30 |
|
|---|
| 31 |
using namespace std; |
|---|
| 32 |
|
|---|
| 33 |
class Player |
|---|
| 34 |
{ |
|---|
| 35 |
|
|---|
| 36 |
private: |
|---|
| 37 |
#ifdef SERVER |
|---|
| 38 |
static uint8 maxId; |
|---|
| 39 |
#endif |
|---|
| 40 |
uint8 id; |
|---|
| 41 |
int socket; |
|---|
| 42 |
set<Item *> selectedItems; |
|---|
| 43 |
string playerName; |
|---|
| 44 |
vector<Resource> resources; |
|---|
| 45 |
|
|---|
| 46 |
public: |
|---|
| 47 |
#ifdef SERVER |
|---|
| 48 |
Player(int socket, string playerName = "Marvin"); |
|---|
| 49 |
#endif |
|---|
| 50 |
#ifdef CLIENT |
|---|
| 51 |
Player(uint8 id, int socket, string playerName = "Marvin"); |
|---|
| 52 |
#endif |
|---|
| 53 |
void addSelectedItem(Item * item); |
|---|
| 54 |
void removeSelectedItem(Item * item); |
|---|
| 55 |
void clearSelectedItem(); |
|---|
| 56 |
set<Item *> getSelectedItem(); |
|---|
| 57 |
bool isSelectedItem(Item * item); |
|---|
| 58 |
uint8 getId(); |
|---|
| 59 |
int getSocket(); |
|---|
| 60 |
void setSocket(int socket); |
|---|
| 61 |
string getPlayerName(); |
|---|
| 62 |
void setPlayerName(string playername); |
|---|
| 63 |
uint32 getResource(ResourceName r); |
|---|
| 64 |
void setResource(ResourceName r, uint32 quantity); |
|---|
| 65 |
}; |
|---|
| 66 |
|
|---|
| 67 |
#endif |
|---|