Changeset 5b1e31e in network-game for common


Ignore:
Timestamp:
Jun 16, 2013, 11:12:31 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
032e550, d3e8f60
Parents:
ff2133a
Message:

Fix some bugs related to player attack and movement

Location:
common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • common/Player.cpp

    rff2133a r5b1e31e  
    142142   memcpy(buffer+44, &this->hasBlueFlag, 1);
    143143   memcpy(buffer+45, &this->hasRedFlag, 1);
     144   memcpy(buffer+46, &this->range, 4);
    144145
    145146   strcpy(buffer+46, this->name.c_str());
     
    162163   memcpy(&this->hasBlueFlag, buffer+44, 1);
    163164   memcpy(&this->hasRedFlag, buffer+45, 1);
     165   memcpy(&this->range, buffer+46, 4);
    164166
    165167   this->name.assign(buffer+46);
     
    192194}
    193195
    194 void Player::updateTarget(map<unsigned int, Player>& mapPlayers) {
     196bool Player::updateTarget(map<unsigned int, Player>& mapPlayers) {
    195197   if (this->isChasing) {
    196198      this->target.x = mapPlayers[this->targetPlayer].pos.x;
     
    204206         this->isAttacking = true;
    205207         this->timeAttackStarted = getCurrentMillis();
     208
     209         return true;
    206210      }
    207211   }
    208 }
     212
     213   return false;
     214}
  • common/Player.h

    rff2133a r5b1e31e  
    4747   void deserialize(char* buffer);
    4848
    49    void updateTarget(map<unsigned int, Player>& mapPlayers);
     49   bool updateTarget(map<unsigned int, Player>& mapPlayers);
    5050   bool move(WorldMap *map);
    5151
Note: See TracChangeset for help on using the changeset viewer.