- Timestamp:
- Jan 7, 2014, 1:07:36 AM (11 years ago)
- Branches:
- master
- Children:
- d05c484
- Parents:
- eb2ad4f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
reb2ad4f r6054f1e 53 53 Player *findPlayerByName(map<unsigned int, Player*> &m, string name); 54 54 Player *findPlayerByAddr(map<unsigned int, Player*> &m, const sockaddr_in &addr); 55 void damagePlayer(Player *p, int damage);56 55 57 56 void addObjectToMap(WorldMap::ObjectType objectType, int x, int y, WorldMap* gameMap, map<unsigned int, Player*>& mapPlayers, MessageProcessor &msgProcessor); … … 222 221 223 222 Player* target = game->getPlayers()[itProj->second.target]; 224 damagePlayer(target,itProj->second.damage);223 target->takeDamage(itProj->second.damage); 225 224 226 225 if (target->isDead) … … 1029 1028 1030 1029 Player* target = playersInGame[p->targetPlayer]; 1031 damagePlayer(target,p->damage);1030 target->takeDamage(p->damage); 1032 1031 1033 1032 if (target->isDead) … … 1113 1112 } 1114 1113 1115 void damagePlayer(Player *p, int damage) {1116 p->health -= damage;1117 if (p->health < 0)1118 p->health = 0;1119 if (p->health == 0) {1120 cout << "Player died" << endl;1121 p->isDead = true;1122 p->timeDied = getCurrentMillis();1123 }1124 }1125 1126 1114 void addObjectToMap(WorldMap::ObjectType objectType, int x, int y, WorldMap* gameMap, map<unsigned int, Player*>& mapPlayers, MessageProcessor &msgProcessor) { 1127 1115 NETWORK_MSG serverMsg;
Note:
See TracChangeset
for help on using the changeset viewer.