3
|
1 |
#ifndef GAMESTATE_HH
|
|
2 |
#define GAMESTATE_HH
|
|
3 |
|
|
4 |
class GameState {
|
|
5 |
public:
|
|
6 |
Dimension map_dimensions;
|
|
7 |
std::list<Player> player_list;
|
|
8 |
|
|
9 |
LocalPlayer &getLocalPlayer (void) {
|
|
10 |
// XXX: jotain
|
|
11 |
}
|
|
12 |
};
|
|
13 |
|
|
14 |
enum PlayerType {
|
|
15 |
PLAYER_LOCAL = 0x01;
|
|
16 |
PLAYER_REMOTE = 0x02;
|
|
17 |
};
|
|
18 |
|
|
19 |
class Player {
|
|
20 |
private:
|
|
21 |
Coordinate position;
|
|
22 |
|
|
23 |
public:
|
|
24 |
PlayerType type;
|
|
25 |
Dimensions dimensions;
|
|
26 |
|
|
27 |
Coordinate getPosition (void) {
|
|
28 |
return this->position;
|
|
29 |
}
|
|
30 |
};
|
|
31 |
|
|
32 |
class LocalPlayer : public Player {
|
|
33 |
public:
|
|
34 |
void doMovement (PositionDelta d) {
|
|
35 |
this->position += d;
|
|
36 |
|
|
37 |
// XXX: notify server
|
|
38 |
}
|
|
39 |
};
|
|
40 |
|
|
41 |
class RemotePlayer : public Player {
|
|
42 |
public:
|
|
43 |
void updatePosition (Position p) {
|
|
44 |
this->position = p;
|
|
45 |
}
|
|
46 |
}
|
|
47 |
|
|
48 |
#endif
|