Changeset 10622 for code/trunk/src/libraries/network/packet
- Timestamp:
- Oct 4, 2015, 3:45:56 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/network/packet/ServerInformation.cc
r8351 r10622 39 39 namespace packet 40 40 { 41 41 42 42 ServerInformation::ServerInformation() 43 43 { 44 45 44 } 46 45 47 46 ServerInformation::ServerInformation(ENetEvent* event) 48 47 { … … 69 68 ServerInformation::~ServerInformation() 70 69 { 71 70 72 71 } 73 72 74 73 void ServerInformation::send(ENetPeer* peer) 75 74 { 76 uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(this->serverName_); 75 std::string payload = this->serverName_ + Ogre::StringConverter::toString(this->clientNumber_); 76 uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(payload); 77 77 uint8_t* temp = new uint8_t[size]; 78 78 uint8_t* temp2 = temp; 79 79 saveAndIncrease((char*&)LAN_DISCOVERY_ACK, temp2); 80 saveAndIncrease( this->serverName_, temp2);80 saveAndIncrease(payload, temp2); 81 81 ENetPacket* packet = enet_packet_create( temp, size, 0 ); 82 82 enet_peer_send(peer, 0, packet); 83 83 84 84 delete[] temp; 85 85 } 86 86 87 87 } // namespace packet 88 88 … … 95 95 } 96 96 } // namespace orxonox 97 -
code/trunk/src/libraries/network/packet/ServerInformation.h
r8351 r10622 30 30 31 31 #include <string> 32 #include <OgreStringConverter.h> 33 32 34 33 35 #ifndef SERVERINFORMATION_H … … 45 47 ServerInformation(ENetEvent* event); 46 48 ~ServerInformation(); 47 49 48 50 void send( ENetPeer* peer ); 51 void setServerName(std::string name) { this->serverName_ = name; } 52 std::string getServerName() { return this->serverName_; } 53 void setServerIP( std::string IP ) { this->serverIP_ = IP; } 49 54 std::string getServerIP() { return this->serverIP_; } 50 std::string getServerName() { return this->serverName_; } 51 void setServerName(std::string name) { this->serverName_ = name; } 52 void setServerIP( std::string IP ) { this->serverIP_ = IP; } 55 void setClientNumber( int clientNumber ) { this->clientNumber_ = clientNumber; } 56 int getClientNumber() { return this->clientNumber_; } 53 57 uint32_t getServerRTT() { return this->serverRTT_; } 54 58 55 59 private: 56 60 std::string serverName_; 61 int clientNumber_; 57 62 std::string serverIP_; 58 63 uint32_t serverRTT_;
Note: See TracChangeset
for help on using the changeset viewer.