Changeset 3b8adee in network-game for common/Player.cpp
- Timestamp:
- Dec 26, 2012, 3:10:05 PM (12 years ago)
- Branches:
- master
- Children:
- 60776f2
- Parents:
- 4c202e0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Player.cpp
r4c202e0 r3b8adee 2 2 3 3 #include <iostream> 4 #include <sstream> 5 #include <cstring> 4 6 5 7 using namespace std; … … 30 32 } 31 33 34 void Player::serialize(char* buffer) 35 { 36 ostringstream oss; 37 38 oss << this->name; 39 40 memcpy(buffer, oss.str().c_str(), this->name.length()+1); 41 } 42 43 void Player::deserialize(char* buffer) 44 { 45 istringstream iss; 46 47 iss >> this->name; 48 } 49 32 50 void Player::setAddr(sockaddr_in addr) 33 51 { 34 52 this->addr = addr; 35 53 } 36 37 void Player::clearSensitiveInfo()38 {39 this->password = "";40 this->addr.sin_family = 0;41 this->addr.sin_port = 0;42 this->addr.sin_addr.s_addr = 0;43 }
Note:
See TracChangeset
for help on using the changeset viewer.