Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8798 in orxonox.OLD for branches/network/src


Ignore:
Timestamp:
Jun 26, 2006, 3:48:47 PM (18 years ago)
Author:
rennerc
Message:

network changes

Location:
branches/network/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/util/game_rules.cc

    r8362 r8798  
    2121
    2222#include "util/mission_goal.h"
     23
     24#include "shared_network_data.h"
    2325
    2426#include "debug.h"
     
    8688void GameRules::registerKill(const Kill& kill)
    8789{
     90  if ( !SharedNetworkData::getInstance()->isGameServer() )
     91    return;
    8892  PRINTF(0)("Received Event: Kill\n");
    8993  this->killList.push_back(kill);
  • branches/network/src/util/multiplayer_team_deathmatch.cc

    r8786 r8798  
    4545
    4646#include "shell_command.h"
     47
     48#include "spawning_point.h"
    4749
    4850
     
    237239  if ( !SharedNetworkData::getInstance()->isGameServer() )
    238240    return;
     241   
     242  //handle kills
     243  for ( std::vector<Kill>::iterator it = this->killList.begin(); it != this->killList.end();  )
     244  {
     245    std::vector<Kill>::iterator delit = it;
     246   
     247    onKill( it->getKiller()->getOwner(), it->getVictim()->getOwner() );
     248   
     249    it++;
     250    killList.erase( delit );
     251  }
    239252 
    240253  gameStateTimer -= dt;
     
    735748    stats.setScore( stats.getScore() - 1 );
    736749 
    737   killedStats.getPlayable()->toList( OM_DEAD );
    738  
    739750  if ( killedUserId == SharedNetworkData::getInstance()->getHostID() )
    740751  {
     
    743754  }
    744755 
    745   //TODO respawn killed palyer
     756  const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
     757 
     758  assert( list );
     759 
     760  std::vector<SpawningPoint*> spList;
     761 
     762  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     763  {
     764    SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it);
     765   
     766    if ( sp->getTeamId() < 0 || sp->getTeamId() == killedStats.getTeamId() )
     767      spList.push_back( sp );
     768  }
    746769 
     770  int n = spList.size()*rand();
     771 
     772  spList[n]->pushEntity( killedStats.getPlayable(), 3 );
    747773}
    748774
  • branches/network/src/world_entities/spawning_point.cc

    r8068 r8798  
    5959{
    6060  this->setClassID(CL_SPAWNING_POINT, "SpawningPoint");
     61 
     62  this->teamId = -1;
    6163}
    6264
     
    8183  LoadParam(root, "delay", this, SpawningPoint, setSpawningDelay)
    8284      .describe("sets the delay of the spawning point");
     85     
     86  /* load teamId */
     87  LoadParam(root, "teamId", this, SpawningPoint, setTeamId)
     88      .describe("sets teamId");
    8389
    8490
  • branches/network/src/world_entities/spawning_point.h

    r8068 r8798  
    5050    /** sets the spawning point mode @param mode: the mode */
    5151    void SpawningPoint::setSpawningMode(int mode) { this->mode = (SpawningPointMode)mode; }
     52   
     53    inline int getTeamId(){ return this->teamId; }
     54    inline void setTeamId( int teamId ){ this->teamId = teamId; }
    5255
    5356    void pushEntity(WorldEntity* entity, float delay = 0);
     
    7275    float                           localTimer;                     //!< the local timer
    7376    float                           seed;                           //!< the random seed of the position
     77    int                             teamId;                         //!< only spawn players of this team
    7478    ClassID                         classid;                        //!< the classid of the entity to spawn
    7579    SpawningPointMode               mode;                           //!< the mode of the spawning point
Note: See TracChangeset for help on using the changeset viewer.