- Timestamp:
- Jan 20, 2014, 4:59:34 PM (11 years ago)
- Branches:
- master
- Children:
- 949cf70
- Parents:
- d998572
- Location:
- common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Player.cpp
rd998572 r9ba9b96 100 100 } 101 101 102 void Player::setId( int id)102 void Player::setId(unsigned int id) 103 103 { 104 104 this->id = id; -
common/Player.h
rd998572 r9ba9b96 41 41 ~Player(); 42 42 43 void setId( int id);43 void setId(unsigned int id); 44 44 void setAddr(sockaddr_in addr); 45 45 void setClass(PlayerClass c); … … 52 52 void takeDamage(int damage); 53 53 54 void takeFlag( int flag, WorldMap* map);55 void dropFlag( int flag, WorldMap* map);54 void takeFlag(unsigned int flag, WorldMap* map); 55 void dropFlag(unsigned int flag, WorldMap* map); 56 56 57 int id;57 unsigned int id; 58 58 string name; 59 59 string password; … … 66 66 bool isChasing; 67 67 bool isAttacking; 68 int targetPlayer;68 unsigned int targetPlayer; 69 69 bool isDead; 70 70 -
common/Projectile.cpp
rd998572 r9ba9b96 45 45 } 46 46 47 void Projectile::setId( int id)47 void Projectile::setId(unsigned int id) 48 48 { 49 49 this->id = id; -
common/Projectile.h
rd998572 r9ba9b96 13 13 class Projectile { 14 14 public: 15 unsigned int id; 16 POSITION pos; 17 unsigned int target; 18 int speed; 19 int damage; 20 unsigned long long timeLastUpdated; 15 21 16 22 Projectile(); … … 20 26 ~Projectile(); 21 27 22 void setId( int id);28 void setId(unsigned int id); 23 29 24 30 void serialize(char* buffer); 25 31 void deserialize(char* buffer); 26 32 27 // returns true if itreached the target and should be deleted33 // returns true if the projectile reached the target and should be deleted 28 34 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 35 }; 42 36 -
common/WorldMap.cpp
rd998572 r9ba9b96 102 102 // used by the server to create new objects 103 103 void WorldMap::addObject(WorldMap::ObjectType t, int x, int y) { 104 int id;104 unsigned int id; 105 105 vector<WorldMap::Object>::iterator it; 106 106 … … 111 111 } 112 112 113 if (it == vctObjects->end()) // if no objects with this id exist s113 if (it == vctObjects->end()) // if no objects with this id exist 114 114 break; 115 115 } … … 120 120 121 121 // used by the client to update object positions or create objects it has not seen before 122 void WorldMap::updateObject( int id, WorldMap::ObjectType t, int x, int y) {122 void WorldMap::updateObject(unsigned int id, WorldMap::ObjectType t, int x, int y) { 123 123 vector<WorldMap::Object>::iterator it; 124 124 bool foundObject = false; … … 157 157 } 158 158 159 bool WorldMap::removeObject( int id) {159 bool WorldMap::removeObject(unsigned int id) { 160 160 vector<WorldMap::Object>::iterator it; 161 161 … … 316 316 /*** Functions for Object ***/ 317 317 318 WorldMap::Object::Object( int id, ObjectType type, int x, int y) {318 WorldMap::Object::Object(unsigned int id, ObjectType type, int x, int y) { 319 319 this->type = type; 320 320 this->id = id; … … 323 323 } 324 324 325 WorldMap::Object::Object( int id, ObjectType type, POSITION pos) {325 WorldMap::Object::Object(unsigned int id, ObjectType type, POSITION pos) { 326 326 this->type = type; 327 327 this->id = id; -
common/WorldMap.h
rd998572 r9ba9b96 32 32 class Object { 33 33 public: 34 int id;34 unsigned int id; 35 35 ObjectType type; 36 36 POSITION pos; 37 37 38 Object( int id, ObjectType type, int x, int y);39 Object( int id, ObjectType type, POSITION pos);38 Object(unsigned int id, ObjectType type, int x, int y); 39 Object(unsigned int id, ObjectType type, POSITION pos); 40 40 41 41 ~Object(); … … 65 65 66 66 void addObject(ObjectType type, int x, int y); 67 void updateObject( int id, WorldMap::ObjectType t, int x, int y);68 bool removeObject( int id);67 void updateObject(unsigned int id, WorldMap::ObjectType t, int x, int y); 68 bool removeObject(unsigned int id); 69 69 70 70 static WorldMap* createDefaultMap();
Note:
See TracChangeset
for help on using the changeset viewer.