source: network-game/common/Game.h@ b92e6a7

Last change on this file since b92e6a7 was b92e6a7, checked in by dportnoy <dmp1488@…>, 11 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
RevLine 
[f419b09]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"
[b92e6a7]17#include "WorldMap.h"
[f419b09]18
19using namespace std;
20
21class Game {
22private:
[b92e6a7]23 unsigned int id;
[c044a36]24 string name;
[b92e6a7]25 map<unsigned int, Player*> players;
26 WorldMap* worldMap;
27 int blueScore;
28 int redScore;
[f419b09]29
30public:
31 Game();
32 Game(string name);
33
34 ~Game();
35
[2ee386d]36 int getNumPlayers();
[b92e6a7]37 map<unsigned int, Player*>& getPlayers();
38 int getBlueScore();
39 int getRedScore();
40 WorldMap* getMap();
[f419b09]41
[b92e6a7]42 void setId(unsigned int id);
[f419b09]43 bool addPlayer(Player* p);
[b92e6a7]44 bool removePlayer(unsigned int id);
45 void setBlueScore(int score);
46 void setRedScore(int score);
[f419b09]47};
48
49#endif
Note: See TracBrowser for help on using the repository browser.