Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6424 in orxonox.OLD for trunk/src/world_entities/space_ships


Ignore:
Timestamp:
Jan 7, 2006, 11:07:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the branche network back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/network . -r 6351:HEAD
no conflicts

Location:
trunk/src/world_entities/space_ships
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6341 r6424  
    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"
     
    121123  PRINTF(4)("SPACESHIP INIT\n");
    122124
    123   //  EventHandler::getInstance()->grabEvents(true);
     125    EventHandler::getInstance()->grabEvents(true);
    124126
    125127  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
     
    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}
  • trunk/src/world_entities/space_ships/space_ship.h

    r6243 r6424  
    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:
Note: See TracChangeset for help on using the changeset viewer.