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/PacketGenerator.cc

    r437 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 generates packets that can be send by enet
    330 * ->don't read this without the class PacketDecoder, since they belong together
    4  * 
     31 *
    532 * Autor: Dumeni Manatschal
    6  * 
     33 *
    734*/
    835
     
    2653        ackreq->id = ACK;
    2754        ackreq->a = state;
    28        
     55
    2956        ENetPacket *packet = enet_packet_create( ackreq , sizeof( *ackreq ), reliable );
    30        
     57
    3158        return packet;
    3259}
     
    3966        mousemove->x = x;
    4067        mousemove->y = y;
    41        
     68
    4269        ENetPacket *packet = enet_packet_create( mousemove , sizeof( *mousemove ), reliable );
    43        
     70
    4471        return packet;
    4572}
     
    5178        key->id = KEYBOARD;
    5279        key->press = press;
    53        
     80
    5481        ENetPacket *packet = enet_packet_create( key , sizeof( *key ), reliable );
    55        
     82
    5683        return packet;
    5784}
     
    6491        memcpy( &trans[1], (const void*)message, strlen( message ) + 1);
    6592        ENetPacket *packet = enet_packet_create( trans , sizeof( int ) + strlen( message ) + 1, reliable );
    66        
     93
    6794        return packet;
    6895}
     
    7198ENetPacket* PacketGenerator::gstate( GameStateCompressed* states, int reliable )
    7299{
    73         int* gid = new int; 
     100        int* gid = new int;
    74101        *gid = GAMESTATE; //first assign the correct enet id
    75102        int totalLen = 4*sizeof( int ) + sizeof(bool) + states->compsize; //calculate the total size of the datastream memory
     
    87114        //create an enet packet with the generated bytestream
    88115        ENetPacket *packet = enet_packet_create( data , totalLen, reliable );
    89        
     116
    90117        return packet;
    91118}
Note: See TracChangeset for help on using the changeset viewer.