|
Last change
on this file since b92e6a7 was b92e6a7, checked in by dportnoy <dmp1488@…>, 12 years ago |
|
The Game class now has a WorldMap. When a client creates or joins a game, the server sends out all the basic game info (the map and info about all players in the game)
|
-
Property mode
set to
100644
|
|
File size:
806 bytes
|
| Line | |
|---|
| 1 | #ifndef _GAME_H
|
|---|
| 2 | #define _GAME_H
|
|---|
| 3 |
|
|---|
| 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 |
|
|---|
| 13 | #include <string>
|
|---|
| 14 | #include <map>
|
|---|
| 15 |
|
|---|
| 16 | #include "Player.h"
|
|---|
| 17 | #include "WorldMap.h"
|
|---|
| 18 |
|
|---|
| 19 | using namespace std;
|
|---|
| 20 |
|
|---|
| 21 | class Game {
|
|---|
| 22 | private:
|
|---|
| 23 | unsigned int id;
|
|---|
| 24 | string name;
|
|---|
| 25 | map<unsigned int, Player*> players;
|
|---|
| 26 | WorldMap* worldMap;
|
|---|
| 27 | int blueScore;
|
|---|
| 28 | int redScore;
|
|---|
| 29 |
|
|---|
| 30 | public:
|
|---|
| 31 | Game();
|
|---|
| 32 | Game(string name);
|
|---|
| 33 |
|
|---|
| 34 | ~Game();
|
|---|
| 35 |
|
|---|
| 36 | int getNumPlayers();
|
|---|
| 37 | map<unsigned int, Player*>& getPlayers();
|
|---|
| 38 | int getBlueScore();
|
|---|
| 39 | int getRedScore();
|
|---|
| 40 | WorldMap* getMap();
|
|---|
| 41 |
|
|---|
| 42 | void setId(unsigned int id);
|
|---|
| 43 | bool addPlayer(Player* p);
|
|---|
| 44 | bool removePlayer(unsigned int id);
|
|---|
| 45 | void setBlueScore(int score);
|
|---|
| 46 | void setRedScore(int score);
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.