Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6420 in orxonox.OLD for branches


Ignore:
Timestamp:
Jan 6, 2006, 6:41:59 PM (19 years ago)
Author:
rennerc
Message:

tried to place ParamPowerUp

Location:
branches/network/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_game_manager.cc

    r6419 r6420  
    734734  }
    735735
    736   PNode::getNullParent()->debugNode( 0 );
    737 
    738736  return true;
    739737}
  • branches/network/src/world_entities/power_ups/param_power_up.cc

    r6419 r6420  
    2525#include "factory.h"
    2626#include "load_param.h"
     27#include "network_game_manager.h"
    2728
    2829using namespace std;
     
    119120}
    120121
     122int ParamPowerUp::writeBytes( const byte * data, int length, int sender )
     123{
     124  setRequestedSync( false );
     125  setIsOutOfSync( false );
    121126
     127  SYNCHELP_READ_BEGIN();
     128
     129  SYNCHELP_READ_FKT( PowerUp::writeState );
     130
     131  return SYNCHELP_READ_N;
     132}
     133
     134
     135
     136int ParamPowerUp::readBytes( byte * data, int maxLength, int * reciever )
     137{
     138  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
     139  {
     140    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
     141    setRequestedSync( true );
     142  }
     143
     144  int rec = this->getRequestSync();
     145  if ( rec > 0 )
     146  {
     147    *reciever = rec;
     148
     149    SYNCHELP_WRITE_BEGIN();
     150
     151    SYNCHELP_WRITE_FKT( PowerUp::readState );
     152
     153    return SYNCHELP_WRITE_N;
     154  }
     155
     156  *reciever = 0;
     157  return 0;
     158}
     159
  • branches/network/src/world_entities/power_ups/param_power_up.h

    r6113 r6420  
    3030  int getValue();
    3131
     32  virtual int writeBytes(const byte* data, int length, int sender);
     33  virtual int readBytes(byte* data, int maxLength, int * reciever );
     34
    3235protected:
    3336  virtual void respawn();
  • branches/network/src/world_entities/space_ships/space_ship.cc

    r6417 r6420  
    3131#include "key_mapper.h"
    3232#include "event_handler.h"
     33
     34#include "network_game_manager.h"
    3335
    3436#include "power_ups/weapon_power_up.h"
     
    516518  }
    517519}
     520
     521
     522int SpaceShip::writeBytes( const byte * data, int length, int sender )
     523{
     524  setRequestedSync( false );
     525  setIsOutOfSync( false );
     526
     527  SYNCHELP_READ_BEGIN();
     528
     529  SYNCHELP_READ_FKT( WorldEntity::writeState );
     530
     531  return SYNCHELP_READ_N;
     532}
     533
     534int SpaceShip::readBytes( byte * data, int maxLength, int * reciever )
     535{
     536  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
     537  {
     538    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
     539    setRequestedSync( true );
     540  }
     541
     542  int rec = this->getRequestSync();
     543  if ( rec > 0 )
     544  {
     545    *reciever = rec;
     546
     547    SYNCHELP_WRITE_BEGIN();
     548
     549    SYNCHELP_WRITE_FKT( WorldEntity::readState );
     550
     551    return SYNCHELP_WRITE_N;
     552  }
     553
     554  *reciever = 0;
     555  return 0;
     556}
  • branches/network/src/world_entities/space_ships/space_ship.h

    r6243 r6420  
    4444    bool pickup(PowerUp* powerUp);
    4545
     46    virtual int       writeBytes(const byte* data, int length, int sender);
     47    virtual int       readBytes(byte* data, int maxLength, int * reciever);
     48
    4649
    4750  private:
  • branches/network/src/world_entities/terrain.cc

    r6414 r6420  
    327327  SYNCHELP_READ_FKT( WorldEntity::writeState );
    328328
    329   PNode::getNullParent()->debugNode( 0 );
    330 
    331329  return SYNCHELP_READ_N;
    332330}
Note: See TracChangeset for help on using the changeset viewer.