Changeset 60776f2 in network-game for common


Ignore:
Timestamp:
Dec 26, 2012, 3:27:08 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
5066e27
Parents:
3b8adee
git-author:
dportnoy <dmp1488@…> (12/26/12 15:26:07)
git-committer:
dportnoy <dmp1488@…> (12/26/12 15:27:08)
Message:

Changed the client to use serialize/deserialize and added serialization code for the player location

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Player.cpp

    r3b8adee r60776f2  
    3737
    3838   oss << this->name;
     39   oss.write((char*)&(this->pos.x), sizeof(int));
     40   oss.write((char*)&(this->pos.y), sizeof(int));
    3941
    40    memcpy(buffer, oss.str().c_str(), this->name.length()+1);
     42   memcpy(buffer, oss.str().c_str(), this->name.length()+1+2*sizeof(int));
    4143}
    4244
     
    4446{
    4547   istringstream iss;
     48   iss.str(buffer);
    4649
    4750   iss >> this->name;
     51   iss.read((char*)&(this->pos.x), sizeof(int));
     52   iss.read((char*)&(this->pos.y), sizeof(int));
    4853}
    4954
Note: See TracChangeset for help on using the changeset viewer.