Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 22, 2006, 11:45:21 PM (18 years ago)
Author:
bensch
Message:

new_class_id: adapted Network

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/network/network_game_manager.cc

    r9690 r9691  
    2323#include "util/loading/factory.h"
    2424#include "state.h"
    25 #include "class_list.h"
    2625#include "debug.h"
    2726
     
    5958
    6059  /* set the class id for the base object */
    61   this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager");
     60  this->registerObject(this, NetworkGameManager::_objectList);
    6261
    6362  this->setSynchronized(true);
     
    9392  assert( SharedNetworkData::getInstance()->isMasterServer());
    9493  assert( State::getGameRules() );
    95   assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     94  assert( State::getGameRules()->isA( NetworkGameRules::classID()) );
    9695
    9796  NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
    9897
    9998  int          team = rules.getTeamForNewUser();
    100   ClassID      playableClassId = rules.getPlayableClassId( userId, team );
     99  NewClassID   playableClassId = rules.getPlayableClassId( userId, team );
    101100  std::string  playableModel = rules.getPlayableModelFileName( userId, team, playableClassId );
    102101  std::string  playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId );
     
    106105
    107106  assert( bo != NULL );
    108   assert( bo->isA( CL_PLAYABLE ) );
     107  assert( bo->isA( Playable::classID()) );
    109108
    110109  Playable & playable = *(dynamic_cast<Playable*>(bo));
     
    131130    stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) );
    132131
    133   if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) )
     132  if ( rules.isA( MultiplayerTeamDeathmatch::classID()) )
    134133    dynamic_cast<MultiplayerTeamDeathmatch*>(&rules)->respawnPlayable( &playable, team, 0.0f );
    135134
     
    187186  }
    188187
    189   const std::list<BaseObject*> * list = ClassList::getList( CL_SYNCHRONIZEABLE );
    190 
    191   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    192   {
    193     if ( dynamic_cast<Synchronizeable*>(*it)->getUniqueID() == uniqueId )
     188  for (NewObjectList<Synchronizeable>::const_iterator it = Synchronizeable::objectList().begin();
     189       it != Synchronizeable::objectList().end();
     190      ++it)
     191  {
     192    if ( (*it)->getUniqueID() == uniqueId )
    194193    {
    195       if ( (*it)->isA(CL_PLAYABLE) )
     194      if ( (*it)->isA(Playable::classID()) )
    196195      {
    197196        getInstance()->playablesToDelete.push_back( dynamic_cast<Playable*>(*it) );
     
    199198      }
    200199
    201       delete dynamic_cast<Synchronizeable*>(*it);
     200      delete (*it);
    202201      return true;
    203202    }
     
    297296    if ( State::getPlayer()->getPlayable() != *it )
    298297    {
    299       const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    300 
    301       if ( list && std::find( list->begin(), list->end(), *it ) != list->end() )
     298      if ( std::find( Playable::objectList().begin(), Playable::objectList().end(), *it ) != Playable::objectList().end() )
    302299      {
    303300        PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassCName(), (*it)->getOwner() );
     
    324321
    325322  assert( State::getGameRules() );
    326   assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
     323  assert( State::getGameRules()->isA( NetworkGameRules::classID()) );
    327324
    328325  NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
Note: See TracChangeset for help on using the changeset viewer.