Changeset 9869 in orxonox.OLD for trunk/src/lib/network/network_game_manager.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/network_game_manager.cc
r9656 r9869 23 23 #include "util/loading/factory.h" 24 24 #include "state.h" 25 #include "class_list.h"26 25 #include "debug.h" 27 26 … … 43 42 #include "multiplayer_team_deathmatch.h" 44 43 45 #include "p references.h"46 47 48 49 44 #include "parser/preferences/preferences.h" 45 46 47 48 ObjectListDefinition(NetworkGameManager); 50 49 NetworkGameManager* NetworkGameManager::singletonRef = NULL; 51 50 … … 59 58 60 59 /* set the class id for the base object */ 61 this-> setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager");60 this->registerObject(this, NetworkGameManager::_objectList); 62 61 63 62 this->setSynchronized(true); … … 93 92 assert( SharedNetworkData::getInstance()->isMasterServer()); 94 93 assert( State::getGameRules() ); 95 assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES) );94 assert( State::getGameRules()->isA( NetworkGameRules::staticClassID()) ); 96 95 97 96 NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules())); 98 97 99 98 int team = rules.getTeamForNewUser(); 100 ClassID 99 ClassID playableClassId = rules.getPlayableClassId( userId, team ); 101 100 std::string playableModel = rules.getPlayableModelFileName( userId, team, playableClassId ); 102 101 std::string playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId ); … … 106 105 107 106 assert( bo != NULL ); 108 assert( bo->isA( CL_PLAYABLE) );107 assert( bo->isA( Playable::staticClassID()) ); 109 108 110 109 Playable & playable = *(dynamic_cast<Playable*>(bo)); … … 131 130 stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) ); 132 131 133 if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH) )132 if ( rules.isA( MultiplayerTeamDeathmatch::staticClassID()) ) 134 133 dynamic_cast<MultiplayerTeamDeathmatch*>(&rules)->respawnPlayable( &playable, team, 0.0f ); 135 134 … … 187 186 } 188 187 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 (ObjectList<Synchronizeable>::const_iterator it = Synchronizeable::objectList().begin(); 189 it != Synchronizeable::objectList().end(); 190 ++it) 191 { 192 if ( (*it)->getUniqueID() == uniqueId ) 194 193 { 195 if ( (*it)->isA( CL_PLAYABLE) )194 if ( (*it)->isA(Playable::staticClassID()) ) 196 195 { 197 196 getInstance()->playablesToDelete.push_back( dynamic_cast<Playable*>(*it) ); … … 199 198 } 200 199 201 delete dynamic_cast<Synchronizeable*>(*it);200 delete (*it); 202 201 return true; 203 202 } … … 297 296 if ( State::getPlayer()->getPlayable() != *it ) 298 297 { 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() ) 302 299 { 303 300 PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassCName(), (*it)->getOwner() ); … … 324 321 325 322 assert( State::getGameRules() ); 326 assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES) );323 assert( State::getGameRules()->isA( NetworkGameRules::staticClassID()) ); 327 324 328 325 NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
Note: See TracChangeset
for help on using the changeset viewer.