Changeset 10456 for code/branches/multiplayerFS15/src/libraries/network
- Timestamp:
- May 23, 2015, 9:47:30 PM (9 years ago)
- Location:
- code/branches/multiplayerFS15/src/libraries/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/multiplayerFS15/src/libraries/network/LANDiscoverable.cc
r10447 r10456 120 120 packet::ServerInformation info; 121 121 info.setServerName(this->ownName); 122 info.setClientNumber( this->clientNumber);122 info.setClientNumber(5); 123 123 info.send(event.peer); 124 124 // ENetPacket* packet = enet_packet_create( LAN_DISCOVERY_ACK, strlen(LAN_DISCOVERY_ACK)+1, ENET_PACKET_FLAG_RELIABLE ); -
code/branches/multiplayerFS15/src/libraries/network/LANDiscovery.cc
r10434 r10456 89 89 { 90 90 packet::ServerInformation info(&event); 91 std::string payload = info.getServerName(); 92 info.setServerName(payload.substr(0,payload.length()-2)); 93 info.setClientNumber( Ogre::StringConverter::parseInt(payload.substr(payload.length()-1))); 91 94 orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", Players: " << info.getClientNumber() << ", RTT: " << info.getServerRTT() << endl; 92 95 std::vector<packet::ServerInformation>::iterator it; -
code/branches/multiplayerFS15/src/libraries/network/packet/ServerInformation.cc
r10434 r10456 73 73 void ServerInformation::send(ENetPeer* peer) 74 74 { 75 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); 76 77 uint8_t* temp = new uint8_t[size]; 77 78 uint8_t* temp2 = temp; 78 79 saveAndIncrease((char*&)LAN_DISCOVERY_ACK, temp2); 79 saveAndIncrease( this->serverName_, temp2);80 saveAndIncrease(payload, temp2); 80 81 ENetPacket* packet = enet_packet_create( temp, size, 0 ); 81 82 enet_peer_send(peer, 0, packet); -
code/branches/multiplayerFS15/src/libraries/network/packet/ServerInformation.h
r10434 r10456 30 30 31 31 #include <string> 32 #include <OgreStringConverter.h> 33 32 34 33 35 #ifndef SERVERINFORMATION_H … … 57 59 private: 58 60 std::string serverName_; 61 int clientNumber_; 59 62 std::string serverIP_; 60 63 uint32_t serverRTT_; 61 int clientNumber_;62 64 }; 63 65
Note: See TracChangeset
for help on using the changeset viewer.