Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6331 in orxonox.OLD for branches/network/src/world_entities/weapons


Ignore:
Timestamp:
Dec 29, 2005, 5:37:00 PM (19 years ago)
Author:
rennerc
Message:

synchronizeable: writeBytes now returns int
converter: converts now 0.0f without endless loop :D

Location:
branches/network/src/world_entities/weapons
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/weapons/ground_turret.cc

    r6142 r6331  
    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}
  • branches/network/src/world_entities/weapons/ground_turret.h

    r5819 r6331  
    3030  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    3131
     32  virtual int writeBytes(const byte* data, int length, int sender);
     33  virtual int readBytes(byte* data, int maxLength, int * reciever);
     34
    3235 private:
    3336   Weapon *left, *right;
Note: See TracChangeset for help on using the changeset viewer.