source: network-game/common/Game.h@ 1e250bf

Last change on this file since 1e250bf was 7f884ea, checked in by dportnoy <dmp1488@…>, 11 years ago

Map-related structs are now outside of the WorldMap class

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#ifndef _GAME_H
2#define _GAME_H
3
4#include "Compiler.h"
5
6#include <string>
7#include <map>
8
9#ifdef WINDOWS
10 #define WIN32_LEAN_AND_MEAN
11#endif
12
13#include "Player.h"
14#include "WorldMap.h"
15#include "Projectile.h"
16#include "MessageProcessor.h"
17
18using namespace std;
19
20class Game {
21private:
22 unsigned int id;
23 string name;
24 map<unsigned int, Player*> players;
25 map<unsigned int, Projectile> projectiles;
26 WorldMap* worldMap;
27 unsigned int blueScore;
28 unsigned int redScore;
29 unsigned int unusedProjectileId;
30 MessageProcessor* msgProcessor;
31
32public:
33 Game();
34 Game(string name, string filepath, MessageProcessor* msgProcessor);
35
36 ~Game();
37
38 string getName();
39 int getNumPlayers();
40 unsigned int getBlueScore();
41 unsigned int getRedScore();
42 WorldMap* getMap();
43
44 void setId(unsigned int id);
45 void setBlueScore(unsigned int score);
46 void setRedScore(unsigned int score);
47
48 void addObjectToMap(ObjectType objectType, int x, int y);
49
50 map<unsigned int, Player*>& getPlayers();
51 bool addPlayer(Player* p);
52 bool removePlayer(unsigned int id);
53
54 map<unsigned int, Projectile>& getProjectiles();
55 bool addProjectile(Projectile p);
56 bool removeProjectile(unsigned int id);
57
58 bool startPlayerMovement(unsigned int id, int x, int y);
59 bool processPlayerMovement(Player* p, FLOAT_POSITION oldPos);
60 int processFlagPickupRequest(Player* p);
61 void dealDamageToPlayer(Player* p, int damage);
62
63 bool handleGameEvents();
64 bool handlePlayerEvents(Player* p);
65
66 void assignProjectileId(Projectile* p);
67 void updateUnusedProjectileId();
68};
69
70#endif
Note: See TracBrowser for help on using the repository browser.