Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Switching packets  (Read 3076 times)

0 Members and 1 Guest are viewing this topic.

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
Switching packets
« on: July 05, 2011, 12:12:22 am »
I want after getting a packet check what is the type of the packet(a line, a guy entering lobby)

Code: [Select]
class MyPacket: public sf::Packet{

private :
    virtual const char* OnSend(std::size_t& DataSize)
    {
Append(type.c_str(),type.length());
DataSize = GetDataSize();
return this->GetData();
    }

    virtual void OnReceive(const char* Data, std::size_t DataSize)
    {
        //HERE
    }
public:
string type;
};


How do i retrieve the type from const char* Data?