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

    r436 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 *      Oliver Scheuss, (C) 2007
     23 *   Co-authors:
     24 *      ...
     25 *
     26 */
     27
    128//
    229// C++ Implementation: GameStateManager
    330//
    4 // Description: 
     31// Description:
    532//
    633//
     
    4774
    4875/**
    49  * This function goes through the whole list of synchronisables and 
     76 * This function goes through the whole list of synchronisables and
    5077 * saves all the synchronisables to a flat "list".
    5178 * @return struct of type gamestate containing the size of the whole gamestate and a pointer linking to the flat list
     
    6188  // struct for return value of Synchronisable::getData()
    6289  syncData sync;
    63  
     90
    6491  GameState *retval=new GameState; //return value
    6592  retval->id=id;
    6693  // reserve a little memory and increase it later on
    6794  retval->data = (unsigned char*)malloc(1);
    68  
     95
    6996  // offset of memory functions
    7097  int offset=0;
     
    77104    // allocate additional space
    78105    retval->data = (unsigned char *)realloc((void *)retval->data, totalsize);
    79    
     106
    80107    // run Synchronisable::getData with offset and additional place for 3 ints in between (for ids and length)
    81108    sync=it->getData(retval->data+offset+3*sizeof(int));
     
    140167  unsigned char* dest = (unsigned char*)malloc( buffer );
    141168  int retval;
    142   retval = compress( dest, &buffer, a->data, (uLong)size ); 
    143  
     169  retval = compress( dest, &buffer, a->data, (uLong)size );
     170
    144171  switch ( retval ) {
    145172  case Z_OK: std::cout << "successfully compressed" << std::endl; break;
     
    148175  case Z_DATA_ERROR: std::cout << "data corrupted" << std::endl; break;
    149176  }
    150  
     177
    151178  GameStateCompressed compressedGamestate;
    152179  compressedGamestate.compsize = buffer;
     
    155182  compressedGamestate.data = dest;
    156183  compressedGamestate.diffed = a->diffed;
    157  
     184
    158185  return compressedGamestate;
    159186}
Note: See TracChangeset for help on using the changeset viewer.