Changeset ad5d122 in network-game for common/Player.cpp


Ignore:
Timestamp:
Jan 29, 2013, 7:19:59 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
5806dc2
Parents:
80b3f94
Message:

Fixed a bug with Player serialization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Player.cpp

    r80b3f94 rad5d122  
    5353   memcpy(buffer, &this->id, 4);
    5454   strcpy(buffer+4, this->name.c_str());
    55    memcpy(buffer+4+this->name.length(), &this->pos.x, 4);
    56    memcpy(buffer+8+this->name.length(), &this->pos.y, 4);
     55   memcpy(buffer+5+this->name.length(), &this->pos.x, 4);
     56   memcpy(buffer+9+this->name.length(), &this->pos.y, 4);
    5757}
    5858
     
    6363   memcpy(&this->id, buffer, 4);
    6464   strcpy(test, buffer+4);
    65    memcpy(&this->pos.x, buffer+4+strlen(test), 4);
    66    memcpy(&this->pos.y, buffer+8+strlen(test), 4);
     65   memcpy(&this->pos.x, buffer+5+strlen(test), 4);
     66   memcpy(&this->pos.y, buffer+9+strlen(test), 4);
    6767
    6868   cout << "id: " << this->id << endl;
Note: See TracChangeset for help on using the changeset viewer.