source: network-game/common/Game.h@ 7f884ea

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