Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9347 in orxonox.OLD for branches/proxy/src/world_entities


Ignore:
Timestamp:
Jul 20, 2006, 11:43:27 AM (18 years ago)
Author:
bensch
Message:

orxonox/proxy: merged the proxy.old back again, and it seems to work.

Merged with command
svn merge -r9247:HEAD https://svn.orxonox.net/orxonox/branches/proxy.old .

no conflicts

Location:
branches/proxy/src/world_entities
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/world_entities/camera.cc

    r9235 r9347  
    1717#include "camera.h"
    1818#include "key_mapper.h"
     19#include "glincl.h"
    1920
    2021/**
  • branches/proxy/src/world_entities/creatures/fps_player.cc

    r9235 r9347  
    287287  //dealing damage
    288288
    289   if ( State::isOnline() && SharedNetworkData::getInstance()->isGameServer() )
     289  if ( State::isOnline() && SharedNetworkData::getInstance()->isMasterServer() )
    290290  {
    291291    this->damageTicker -= time;
  • branches/proxy/src/world_entities/playable.cc

    r9235 r9347  
    361361  }
    362362}
    363 /**
    364  * @brief helps us colliding Playables
    365  * @param entity the Entity to collide
    366  * @param location where the collision occured.
    367  */
    368 void Playable::collidesWith(WorldEntity* entity, const Vector& location)
    369 {
    370   if (entity == collider)
    371     return;
    372   collider = entity;
    373 
    374   if ( entity->isA(CL_PROJECTILE) && ( !State::isOnline() || SharedNetworkData::getInstance()->isGameServer() ) )
    375   {
    376     this->decreaseHealth(entity->getHealth() *(float)rand()/(float)RAND_MAX);
    377     // EXTREME HACK
    378     if (this->getHealth() <= 0.0f)
    379     {
    380 //       this->destory();
    381 
    382       if( State::getGameRules() != NULL)
    383         State::getGameRules()->registerKill(Kill(entity, this));
    384     }
    385   }
    386 }
    387363
    388364
     
    413389    }
    414390    this->bDead = true;
    415    
     391
    416392    if( State::getGameRules() != NULL)
    417393      State::getGameRules()->registerKill(Kill(killer, this));
  • branches/proxy/src/world_entities/playable.h

    r9235 r9347  
    8282  virtual void destroy(WorldEntity* killer);
    8383  virtual void respawn();
    84   virtual void collidesWith(WorldEntity* entity, const Vector& location);
    8584  virtual void process(const Event &event);
    8685  virtual void tick(float dt);
     
    9089  static const std::string& playmodeToString(Playable::Playmode playmode);
    9190  static const std::string playmodeNames[];
    92  
     91
    9392  inline bool beFire(){ return this->bFire; }
    9493  inline void fire(bool bF){ this->bFire = bF;}
  • branches/proxy/src/world_entities/space_ships/space_ship.cc

    r9235 r9347  
    314314  if( entity->isA(CL_PROJECTILE) && entity != ref)
    315315  {
    316     if ( isServer() )
     316    if ( SharedNetworkData::getInstance()->isMasterServer() )
    317317    {
    318318      //TODO handle this
  • branches/proxy/src/world_entities/spawning_point.cc

    r9235 r9347  
    4141
    4242  this->init();
    43  
     43
    4444  if (root != NULL)
    4545    this->loadParams(root);
     
    5050  this->setClassID(CL_SPAWNING_POINT, "SpawningPoint");
    5151  PRINTF(0)("Created SpawningPoint\n");
    52  
     52
    5353  this->teamId = -1;
    5454  this->localTimer = 0.0f;
    55  
     55
    5656  this->toList( OM_DEAD_TICK );
    57  
     57
    5858  MessageManager::getInstance()->registerMessageHandler( MSGID_RESPAWN, respawnMessageHandler, NULL );
    59  
     59
    6060  this->setSynchronized( true );
    6161}
     
    9494  qe.entity = entity;
    9595  qe.respawnTime = this->localTimer + delay;
    96  
     96
    9797  queue.push_back( qe );
    9898}
     
    105105{
    106106  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    107  
     107
    108108  bool found = false;
    109  
     109
    110110  if ( !list )
    111111    return;
    112    
     112
    113113  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    114114  {
     
    119119    }
    120120  }
    121  
     121
    122122  if ( !found )
    123123    return;
     
    128128  entity->setAbsCoor( this->getAbsCoor() );
    129129  entity->setAbsDir( this->getAbsDir() );
    130  
     130
    131131  //TODO set camera (not smooth)
    132  
     132
    133133  if ( State::getGameRules() )
    134134  {
    135135    (State::getGameRules())->registerSpawn( entity );
    136136  }
    137  
     137
    138138  entity->respawn();
    139139}
     
    157157      //spawn the player
    158158      this->spawn(it->entity);
    159      
     159
    160160      const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    161  
     161
    162162      bool found = false;
    163  
     163
    164164      if ( !list )
    165165        return;
    166    
     166
    167167      for ( std::list<BaseObject*>::const_iterator it2 = list->begin(); it2 != list->end(); it2++ )
    168168      {
     
    173173        }
    174174      }
    175  
    176       if ( found && SharedNetworkData::getInstance()->isGameServer() )
     175
     176      if ( found && SharedNetworkData::getInstance()->isMasterServer() )
    177177        this->sendRespawnMessage( it->entity->getUniqueID() );
    178178
    179179      std::list<QueueEntry>::iterator delit = it;
    180180      it++;
    181      
     181
    182182      queue.erase( delit );
    183      
     183
    184184      continue;
    185185    }
    186    
     186
    187187    it++;
    188188  }
     
    204204{
    205205  byte * buf = new byte[2*INTSIZE];
    206  
     206
    207207  assert( Converter::intToByteArray( this->getUniqueID(), buf, INTSIZE ) == INTSIZE );
    208208  assert( Converter::intToByteArray( uniqueId, buf + INTSIZE, INTSIZE ) == INTSIZE );
    209  
     209
    210210  MessageManager::getInstance()->sendMessage( MSGID_RESPAWN, buf, 2*INTSIZE, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
    211211}
     
    213213bool SpawningPoint::respawnMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
    214214{
    215   if ( SharedNetworkData::getInstance()->isGameServer() )
     215  if ( SharedNetworkData::getInstance()->isMasterServer() )
    216216  {
    217217    PRINTF(2)("server received spawn message!\n");
    218218    return true;
    219219  }
    220    
     220
    221221  int spUniqueId;
    222222  int uniqueId;
    223  
     223
    224224  if ( dataLength != 2*INTSIZE )
    225225  {
     
    227227    return true;
    228228  }
    229  
     229
    230230  assert( Converter::byteArrayToInt( data, &spUniqueId ) == INTSIZE );
    231231  assert( Converter::byteArrayToInt( data+INTSIZE, &uniqueId ) == INTSIZE );
    232  
     232
    233233  PRINTF(0)("SPAWNMESSAGE %d\n", uniqueId);
    234  
     234
    235235  SpawningPoint * sp = NULL;
    236236  Playable      * playable = NULL;
    237  
     237
    238238  const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
    239  
     239
    240240  if ( list )
    241241  {
     
    250250    }
    251251  }
    252  
     252
    253253  if ( !sp )
    254254  {
     
    256256    return false;
    257257  }
    258  
     258
    259259  list = ClassList::getList( CL_PLAYABLE );
    260  
     260
    261261  if ( list )
    262262  {
     
    270270    }
    271271  }
    272  
     272
    273273  if ( !playable )
    274274  {
     
    276276    return false;
    277277  }
    278  
     278
    279279  sp->spawn( playable );
    280  
     280
    281281  return true;
    282282}
Note: See TracChangeset for help on using the changeset viewer.