source: network-game/common/Projectile.h@ 1f6233e

Last change on this file since 1f6233e was e6c26b8, checked in by Dmitry Portnoy <dportnoy@…>, 11 years ago

The client dynamically allocates memory for players and passes around a map with player pointers and some includes are now in individual files instead of in Common.h

  • Property mode set to 100644
File size: 890 bytes
Line 
1#ifndef _PROJECTILE_H
2#define _PROJECTILE_H
3
4#include <string>
5#include <map>
6
7#include "Common.h"
8#include "WorldMap.h"
9#include "Player.h"
10
11using namespace std;
12
13class Projectile {
14public:
15
16 Projectile();
17 Projectile(const Projectile& p);
18 Projectile(int x, int y, int targetId, int damage);
19
20 ~Projectile();
21
22 void setId(int id);
23
24 void serialize(char* buffer);
25 void deserialize(char* buffer);
26
27 // returns true if it reached the target and should be deleted
28 bool move(map<unsigned int, Player*>& mapPlayers);
29
30 /*
31 * target should become a Player*. When this object gets serialized, the player's id should be sent.
32 * Deserialization in this case might be tricky since it will require a playerMap to turn the id into a Plauyer*
33 */
34
35 int id;
36 POSITION pos;
37 int target;
38 int speed;
39 int damage;
40 unsigned long long timeLastUpdated;
41};
42
43#endif
Note: See TracBrowser for help on using the repository browser.