Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 203


Ignore:
Timestamp:
Nov 14, 2007, 2:52:03 PM (12 years ago)
Author:
dumenim
Message:

PacketDecoder takes a packet as argument and not an event

Location:
code/branches/network/src/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/PacketDecoder.cc

    r199 r203  
    88PacketDecoder::PacketDecoder(){}
    99
    10 bool PacketDecoder::elaborate( ENetEvent* event )
     10bool PacketDecoder::elaborate( ENetPacket* packet, int clientId )
    1111{
    12         int id = (int)*event->packet->data;
     12        int client = clientId;
     13        cout << "clientId: " << client << endl;
     14        int id = (int)*packet->data;
    1315        switch( id ) {
    1416        case ACK:
    15                 acknowledgement( event->packet );
     17                acknowledgement( packet );
    1618                return true;
    1719                break;
    1820        case MOUSE:
    19                 mousem( event->packet );
     21                mousem( packet );
    2022                return true;
    2123                break;
    2224        case KEYBOARD:
    23                 keystrike( event->packet );
     25                keystrike( packet );
    2426                return true;
    2527                break;
    2628        case CHAT:
    27                 chatMessage( event->packet );
     29                chatMessage( packet );
    2830                return true;
    2931                break;
     
    6264        printChat( chatting );
    6365}
    64 
     66/*
    6567void PacketDecoder::printPeer( ENetPeer* peer )
    6668{
     
    7375        cout << "state of peer:       " << peer->state << endl;
    7476}
    75 
     77*/
    7678void PacketDecoder::printAck( ack* data )
    7779{
  • code/branches/network/src/network/PacketManager.h

    r199 r203  
    3737                char press;
    3838        };     
    39         struct chat {
    40                 int id;
    41                 const char* message;
    42         };
    4339};
    4440
     
    4743public:
    4844        PacketDecoder();
    49         bool elaborate( ENetEvent* event );
     45        bool elaborate( ENetPacket* packet, int clientId );
    5046private:
    5147        struct ack {
     
    6965        };
    7066       
    71         void acknowledgement( ENetPacket* event );
    72         void mousem( ENetPacket* event );
    73         void keystrike( ENetPacket* event );
    74         void chatMessage( ENetPacket* event );
     67        void acknowledgement( ENetPacket* packet );
     68        void mousem( ENetPacket* packet );
     69        void keystrike( ENetPacket* packet );
     70        void chatMessage( ENetPacket* packet );
    7571       
    7672        //print functions
Note: See TracChangeset for help on using the changeset viewer.