Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/multiplayer_team_deathmatch.cc

    r9656 r9869  
    2424#include "render2D/image_plane.h"
    2525#include "state.h"
    26 #include "class_list.h"
    2726
    2827#include "player.h"
     
    3332#include "shared_network_data.h"
    3433#include "terrain.h"
    35 #include "class_list.h"
    3634#include "space_ships/space_ship.h"
    3735
     
    5048
    5149
    52 
    53 
    54 CREATE_FACTORY(MultiplayerTeamDeathmatch, CL_MULTIPLAYER_TEAM_DEATHMATCH);
    55 
    56 
     50#include "class_id_DEPRECATED.h"
     51
     52ObjectListDefinitionID(MultiplayerTeamDeathmatch, CL_MULTIPLAYER_TEAM_DEATHMATCH);
     53CREATE_FACTORY(MultiplayerTeamDeathmatch);
    5754/**
    5855 * constructor
    5956 */
    6057MultiplayerTeamDeathmatch::MultiplayerTeamDeathmatch(const TiXmlElement* root)
    61   : NetworkGameRules(root)
    62 {
    63   this->setClassID(CL_MULTIPLAYER_TEAM_DEATHMATCH, "MultiplayerTeamDeathmatch");
     58    : NetworkGameRules(root)
     59{
     60  this->registerObject(this, MultiplayerTeamDeathmatch::_objectList);
    6461
    6562  this->bLocalPlayerDead = false;
     
    114111
    115112  LoadParam(root, "death-penalty-timeout", this, MultiplayerTeamDeathmatch, setDeathPenaltyTimeout)
    116       .describe("sets the time in seconds a player has to wait for respawn");
     113  .describe("sets the time in seconds a player has to wait for respawn");
    117114
    118115  LoadParam(root, "max-kills", this, MultiplayerTeamDeathmatch, setMaxKills)
    119       .describe("sets the maximal kills for winning condition");
     116  .describe("sets the maximal kills for winning condition");
    120117
    121118  LoadParam(root, "num-teams", this, MultiplayerTeamDeathmatch, setNumTeams)
    122       .describe("sets number of teams");
     119  .describe("sets number of teams");
    123120
    124121}
     
    192189  }
    193190
    194 //   if( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) )
    195 //   {
    196 //     PRINTF(0)("prefered team id: %i, noteam: %i\n", PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId(), TEAM_NOTEAM);
    197 //   }
     191  //   if( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) )
     192  //   {
     193  //     PRINTF(0)("prefered team id: %i, noteam: %i\n", PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId(), TEAM_NOTEAM);
     194  //   }
    198195
    199196  // check if the menu should be removed and the game state should be entered
     
    273270  if( unlikely( this->bLocalPlayerDead))
    274271  {
    275 
    276272  }
    277273}
     
    308304{
    309305  if ( team == TEAM_NOTEAM || team == TEAM_SPECTATOR )
    310     return CL_SPECTATOR;
     306    return ObjectListBase::retrieveIdentity("Spectator");
    311307
    312308  if ( team == 0 || team == 1 )
    313     return CL_TURBINE_HOVER;
     309    return ObjectListBase::retrieveIdentity("TurbineHover");
    314310
    315311  assert( false );
     
    317313
    318314
    319 std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, ClassID classId )
     315std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, const ClassID& classId )
    320316{
    321317  if (classId == CL_TURBINE_HOVER)
    322    return "models/ships/hoverglider_mainbody.obj";
     318    return "models/ships/hoverglider_mainbody.obj";
    323319  if ( team == 0 )
    324320    return "models/creatures/doom_guy.md2";
     
    329325}
    330326
    331 std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, ClassID classId )
     327std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, const ClassID& classId )
    332328{
    333329  if ( classId == CL_FPS_PLAYER )
     
    342338}
    343339
    344 float MultiplayerTeamDeathmatch::getPlayableScale( int userId, int team, ClassID classId )
    345 {
    346   if ( classId == CL_FPS_PLAYER )
     340float MultiplayerTeamDeathmatch::getPlayableScale( int userId, int team, const ClassID& classId )
     341{
     342  if ( classId == ObjectListBase::retrieveIdentity(CL_FPS_PLAYER))
    347343  {
    348344    return 10.0f;
     
    362358    teamScore[i] = 0;
    363359
    364 
    365   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
    366 
    367   if ( !list )
    368     return;
    369 
    370   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    371   {
    372     PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
     360  for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
     361       it != PlayerStats::objectList().end();
     362       ++it)
     363  {
     364    PlayerStats & stats = *(*it);
    373365
    374366    if ( stats.getTeamId() >= 0 )
     
    390382    playersInTeam[i] = 0;
    391383
    392   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
    393 
    394   if ( !list )
    395     return 0;
    396 
    397   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    398   {
    399     PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
     384  for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
     385       it != PlayerStats::objectList().end();
     386       ++it)
     387  {
     388    PlayerStats & stats = *(*it);
    400389
    401390    if ( stats.getTeamId() >= 0 )
     
    453442void MultiplayerTeamDeathmatch::handleTeamChanges( )
    454443{
    455   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
    456 
    457   if ( !list )
    458     return;
    459 
    460   //first server players with choices
    461   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    462   {
    463     PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
     444  for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
     445       it != PlayerStats::objectList().end();
     446       ++it)
     447  {
     448    PlayerStats & stats = *(*it);
    464449
    465450    if ( stats.getTeamId() != stats.getPreferedTeamId() )
     
    473458
    474459  //now serve player who want join a random team
    475   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    476   {
    477     PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it);
     460  for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin();
     461       it != PlayerStats::objectList().end();
     462       ++it)
     463  {
     464    PlayerStats & stats = *(*it);
    478465
    479466    if ( stats.getTeamId() != stats.getPreferedTeamId() )
     
    587574    if ( event.bPressed )
    588575      this->bShowTeamChange = true;
    589   } else if ( event.type == SDLK_F1 )
     576  }
     577  else if ( event.type == SDLK_F1 )
    590578  {
    591579    if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed )
     
    683671void MultiplayerTeamDeathmatch::hideStats( )
    684672{
    685     if ( statsBox )
    686     {
    687       delete statsBox;
    688       statsBox = NULL;
    689     }
     673  if ( statsBox )
     674  {
     675    delete statsBox;
     676    statsBox = NULL;
     677  }
    690678}
    691679
     
    822810void MultiplayerTeamDeathmatch::respawnPlayable( Playable * playable, int teamId, float delay )
    823811{
    824   const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
    825 
    826   assert( list );
    827812
    828813  std::vector<SpawningPoint*> spList;
    829814
    830   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    831   {
    832     SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it);
     815  for (ObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin();
     816       it != SpawningPoint::objectList().end();
     817       ++it)
     818  {
     819    SpawningPoint * sp = (*it);
    833820
    834821    if ( sp->getTeamId() == teamId )
     
    838825  if ( spList.size() == 0 )
    839826  {
    840     for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    841     {
    842       SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it);
     827    for (ObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin();
     828         it != SpawningPoint::objectList().end();
     829         ++it)
     830    {
     831      SpawningPoint * sp = (*it);
    843832
    844833      if ( sp->getTeamId() < 0 )
Note: See TracChangeset for help on using the changeset viewer.