Changeset d998572 in network-game
- Timestamp:
- Jan 19, 2014, 8:19:18 PM (11 years ago)
- Branches:
- master
- Children:
- 9ba9b96
- Parents:
- 1f6233e
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Player.cpp
r1f6233e rd998572 217 217 } 218 218 219 bool Player::updateTarget( map<unsigned int, Player*>& mapPlayers) {219 bool Player::updateTarget(const Player* targetPlayer) { 220 220 if (this->isChasing) { 221 this->target.x = mapPlayers[this->targetPlayer]->pos.x;222 this->target.y = mapPlayers[this->targetPlayer]->pos.y;221 this->target.x = targetPlayer->pos.x; 222 this->target.y = targetPlayer->pos.y; 223 223 224 224 if (posDistance(this->pos, this->target.toFloat()) <= this->range) { -
common/Player.h
r1f6233e rd998572 48 48 void deserialize(char* buffer); 49 49 50 bool updateTarget( map<unsigned int, Player*>& mapPlayers);50 bool updateTarget(const Player* targetPlayer); 51 51 bool move(WorldMap *map); 52 52 void takeDamage(int damage); -
server/server.cpp
r1f6233e rd998572 171 171 if (p->currentGame != NULL) { 172 172 map<unsigned int, Player*> playersInGame = p->currentGame->getPlayers(); 173 if (p->updateTarget(playersInGame ))173 if (p->updateTarget(playersInGame[p->targetPlayer])) 174 174 { 175 175 serverMsg.type = MSG_TYPE_PLAYER;
Note:
See TracChangeset
for help on using the changeset viewer.