- Timestamp:
- Dec 30, 2012, 6:33:03 PM (12 years ago)
- Branches:
- master
- Children:
- 3535088
- Parents:
- 092817a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Player.cpp
r092817a r1106210 53 53 ostringstream oss; 54 54 55 cout << "Player name: " << this->name << endl; 56 57 /* 55 58 oss.write((char*)&(this->id), sizeof(int)); 56 59 oss << this->name; 60 cout << "first oss str: " << oss.str() << endl; 57 61 oss.write("\0", 1); 62 cout << "second oss str: " << oss.str() << endl; 58 63 oss.write((char*)&(this->pos.x), sizeof(int)); 64 cout << "third oss str: " << oss.str() << endl; 59 65 oss.write((char*)&(this->pos.y), sizeof(int)); 66 */ 60 67 61 memcpy(buffer, oss.str().c_str(), this->name.length()+1+2*sizeof(int)); 68 oss << this->id; 69 oss << this->name; 70 css << this->pos.x; 71 css << this->pos.y; 72 73 memcpy(buffer, oss.str().c_str(), oss.str().length); 62 74 } 63 75 … … 67 79 iss.str(buffer); 68 80 81 /* 69 82 iss.read((char*)&(this->id), sizeof(int)); 70 83 iss >> this->name; 71 84 iss.read((char*)&(this->pos.x), sizeof(int)); 72 85 iss.read((char*)&(this->pos.y), sizeof(int)); 86 */ 87 88 iss >> this.id; 89 iss >> this->name; 90 iss >> this->pos.x; 91 iss >> this->pos.y; 73 92 } 74 93
Note:
See TracChangeset
for help on using the changeset viewer.