Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9235 in orxonox.OLD for trunk/src/world_entities/spawning_point.cc


Ignore:
Timestamp:
Jul 5, 2006, 4:39:02 PM (19 years ago)
Author:
bensch
Message:

merged the presentation back

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/spawning_point.cc

    r9008 r9235  
    5757 
    5858  MessageManager::getInstance()->registerMessageHandler( MSGID_RESPAWN, respawnMessageHandler, NULL );
     59 
     60  this->setSynchronized( true );
    5961}
    6062
     
    102104void SpawningPoint::spawn(Playable* entity)
    103105{
     106  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
     107 
     108  bool found = false;
     109 
     110  if ( !list )
     111    return;
     112   
     113  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     114  {
     115    if ( *it == entity )
     116    {
     117      found = true;
     118      break;
     119    }
     120  }
     121 
     122  if ( !found )
     123    return;
     124
    104125  PRINTF(0)("Spawningpoint spawns Entity (%s)\n", entity->getClassName());
    105126
     
    137158      this->spawn(it->entity);
    138159     
    139       if ( SharedNetworkData::getInstance()->isGameServer() )
     160      const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
     161 
     162      bool found = false;
     163 
     164      if ( !list )
     165        return;
     166   
     167      for ( std::list<BaseObject*>::const_iterator it2 = list->begin(); it2 != list->end(); it2++ )
     168      {
     169        if ( *it2 == it->entity )
     170        {
     171          found = true;
     172          break;
     173        }
     174      }
     175 
     176      if ( found && SharedNetworkData::getInstance()->isGameServer() )
    140177        this->sendRespawnMessage( it->entity->getUniqueID() );
    141178
     
    194231  assert( Converter::byteArrayToInt( data+INTSIZE, &uniqueId ) == INTSIZE );
    195232 
     233  PRINTF(0)("SPAWNMESSAGE %d\n", uniqueId);
     234 
    196235  SpawningPoint * sp = NULL;
    197236  Playable      * playable = NULL;
     
    203242    for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    204243    {
    205       if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == uniqueId )
     244      PRINTF(0)("%d:%d\n", dynamic_cast<SpawningPoint*>(*it)->getUniqueID(), spUniqueId);
     245      if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == spUniqueId )
    206246      {
    207247        sp = dynamic_cast<SpawningPoint*>(*it);
     
    213253  if ( !sp )
    214254  {
    215     PRINTF(2)("could not find spawning point\n");
     255    PRINTF(0)("could not find spawning point\n");
    216256    return false;
    217257  }
     
    233273  if ( !playable )
    234274  {
    235     PRINTF(2)("could not find playable\n");
     275    PRINTF(0)("could not find playable\n");
    236276    return false;
    237277  }
Note: See TracChangeset for help on using the changeset viewer.