Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2007, 6:02:07 PM (16 years ago)
Author:
nicolasc
Message:

added copyright notice

File:
1 edited

Legend:

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

    r440 r514  
     1/*
     2 *   ORXONOX - the hottest 3D action shooter ever to exist
     3 *
     4 *
     5 *   License notice:
     6 *
     7 *   This program is free software; you can redistribute it and/or
     8 *   modify it under the terms of the GNU General Public License
     9 *   as published by the Free Software Foundation; either version 2
     10 *   of the License, or (at your option) any later version.
     11 *
     12 *   This program is distributed in the hope that it will be useful,
     13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 *   GNU General Public License for more details.
     16 *
     17 *   You should have received a copy of the GNU General Public License
     18 *   along with this program; if not, write to the Free Software
     19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     20 *
     21 *   Author:
     22 *      Dumeni Manatschal, (C) 2007
     23 *   Co-authors:
     24 *      ...
     25 *
     26 */
     27
    128/*
    229 * Class contains functions to determine and decode incomming packages
    330 * ->don't read this without the class PacketGenerator, since they belong together
    4  * 
     31 *
    532 * Autor: Dumeni Manatschal
    6  * 
     33 *
    734*/
    835
     
    5885        ack* a = new ack;
    5986        *a = *(ack*)packet->data; //press pattern of ack on new data
    60        
    61         //clean memory
    62         enet_packet_destroy( packet );
    63        
     87
     88        //clean memory
     89        enet_packet_destroy( packet );
     90
    6491        printAck( a ); //debug info
    6592}
     
    6996        mouse* mouseMove = new mouse;
    7097        //copy data of packet->data to new struct
    71         *mouseMove = *(mouse*)packet->data; 
    72        
    73         //clean memory
    74         enet_packet_destroy( packet );
    75        
     98        *mouseMove = *(mouse*)packet->data;
     99
     100        //clean memory
     101        enet_packet_destroy( packet );
     102
    76103        printMouse( mouseMove ); //debug info
    77104}
     
    81108        keyboard* key = new keyboard;
    82109        *key = *(keyboard*)packet->data; //see above
    83        
    84         //clean memory
    85         enet_packet_destroy( packet );
    86        
     110
     111        //clean memory
     112        enet_packet_destroy( packet );
     113
    87114        printKey( key ); //debug info
    88115
     
    94121        chatting->id = (int)*packet->data; //first copy id into new struct
    95122        //since the chat message is a char*, allocate the memory needed
    96         char* reserve = new char[packet->dataLength-4]; 
     123        char* reserve = new char[packet->dataLength-4];
    97124        //copy the transmitted bytestream into the new generated char*,
    98         //note the lenght of the message is represented as "packet->dataLength-sizeof( int )" 
     125        //note the lenght of the message is represented as "packet->dataLength-sizeof( int )"
    99126        memcpy( &reserve[0], packet->data+sizeof(int), packet->dataLength-sizeof(int) );
    100127        //put pointer of chatting struct to the begining of the new generated char*
    101128        chatting->message = reserve;
    102        
    103         //clean memory
    104         enet_packet_destroy( packet );
    105        
     129
     130        //clean memory
     131        enet_packet_destroy( packet );
     132
    106133        processChat( chatting, clientId ); //debug info
    107        
     134
    108135}
    109136
     
    126153        //copy the GameStateCompressed data
    127154        memcpy( (void*)(currentState->data), (const void*)(data+4*sizeof( int ) + sizeof(bool)), currentState->compsize );
    128  
     155
    129156        //clean memory
    130157        enet_packet_destroy( packet );
Note: See TracChangeset for help on using the changeset viewer.