Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

some more entities should sync now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/world_entities/power_ups/weapon_power_up.cc

    r6243 r6419  
    2020#include "state.h"
    2121#include "list.h"
     22#include "network_game_manager.h"
    2223
    2324#include "primitive_model.h"
     
    8586  this->weapon = dynamic_cast<Weapon*>(Factory::fabricate(name));
    8687}
     88
     89int WeaponPowerUp::writeBytes( const byte * data, int length, int sender )
     90{
     91  setRequestedSync( false );
     92  setIsOutOfSync( false );
     93
     94  SYNCHELP_READ_BEGIN();
     95
     96  SYNCHELP_READ_FKT( PowerUp::writeState );
     97
     98  //TODO: sync weapon class ( see loadParams )
     99
     100  return SYNCHELP_READ_N;
     101}
     102
     103
     104
     105int WeaponPowerUp::readBytes( byte * data, int maxLength, int * reciever )
     106{
     107  if ( isOutOfSync() && !requestedSync() && this->getHostID()!=this->getOwner() )
     108  {
     109    (NetworkGameManager::getInstance())->sync( this->getUniqueID(), this->getOwner() );
     110    setRequestedSync( true );
     111  }
     112
     113  int rec = this->getRequestSync();
     114  if ( rec > 0 )
     115  {
     116    *reciever = rec;
     117
     118    SYNCHELP_WRITE_BEGIN();
     119
     120    SYNCHELP_WRITE_FKT( PowerUp::readState );
     121
     122    //TODO: sync weapon class ( see loadParams )
     123
     124    return SYNCHELP_WRITE_N;
     125  }
     126
     127  *reciever = 0;
     128  return 0;
     129}
Note: See TracChangeset for help on using the changeset viewer.