Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10456 for code


Ignore:
Timestamp:
May 23, 2015, 9:47:30 PM (9 years ago)
Author:
frovelli
Message:

Transmit client count in LAN by evil hack

Location:
code/branches/multiplayerFS15/src/libraries/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/multiplayerFS15/src/libraries/network/LANDiscoverable.cc

    r10447 r10456  
    120120            packet::ServerInformation info;
    121121            info.setServerName(this->ownName);
    122             info.setClientNumber(this->clientNumber);
     122            info.setClientNumber(5);
    123123            info.send(event.peer);
    124124//             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  
    8989          {
    9090            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)));
    9194            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", Players: " << info.getClientNumber() << ", RTT: " << info.getServerRTT() << endl;
    9295            std::vector<packet::ServerInformation>::iterator it;
  • code/branches/multiplayerFS15/src/libraries/network/packet/ServerInformation.cc

    r10434 r10456  
    7373    void ServerInformation::send(ENetPeer* peer)
    7474    {
    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);
    7677      uint8_t* temp = new uint8_t[size];
    7778      uint8_t* temp2 = temp;
    7879      saveAndIncrease((char*&)LAN_DISCOVERY_ACK, temp2);
    79       saveAndIncrease(this->serverName_, temp2);
     80      saveAndIncrease(payload, temp2);
    8081      ENetPacket* packet = enet_packet_create( temp, size, 0 );
    8182      enet_peer_send(peer, 0, packet);
  • code/branches/multiplayerFS15/src/libraries/network/packet/ServerInformation.h

    r10434 r10456  
    3030
    3131#include <string>
     32#include <OgreStringConverter.h>
     33
    3234
    3335#ifndef SERVERINFORMATION_H
     
    5759      private:
    5860        std::string   serverName_;
     61        int           clientNumber_;
    5962        std::string   serverIP_;
    6063        uint32_t      serverRTT_;
    61         int           clientNumber_;
    6264    };
    6365
Note: See TracChangeset for help on using the changeset viewer.