Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2005, 1:57:12 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the network branche back to the trunk, so we do not get away from each other to fast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/ground_turret.cc

    r6142 r6341  
    1919
    2020#include "factory.h"
     21#include "network_game_manager.h"
    2122#include "load_param.h"
    2223
     
    168169
    169170}
     171
     172/**
     173 * Writes data from network containing information about the state
     174 * @param data pointer to data
     175 * @param length length of data
     176 * @param sender hostID of sender
     177 */
     178int GroundTurret::writeBytes( const byte * data, int length, int sender )
     179{
     180  setRequestedSync( false );
     181  setIsOutOfSync( false );
     182
     183  SYNCHELP_READ_BEGIN();
     184
     185  SYNCHELP_READ_FKT( WorldEntity::writeState );
     186
     187  return SYNCHELP_READ_N;
     188}
     189
     190/**
     191 * data copied in data will bee sent to another host
     192 * @param data pointer to data
     193 * @param maxLength max length of data
     194 * @return the number of bytes writen
     195 */
     196int GroundTurret::readBytes( byte * data, int maxLength, int * reciever )
     197{
     198  SYNCHELP_WRITE_BEGIN();
     199
     200  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
     201  {
     202    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
     203    setRequestedSync( true );
     204  }
     205
     206  int rec = this->getRequestSync();
     207  if ( rec > 0 )
     208  {
     209    *reciever = rec;
     210
     211    SYNCHELP_WRITE_FKT( WorldEntity::readState );
     212
     213  }
     214
     215  *reciever = 0;
     216  return SYNCHELP_WRITE_N;
     217}
Note: See TracChangeset for help on using the changeset viewer.