Changeset 8827 in orxonox.OLD for branches/multi_player_map/src/util
- Timestamp:
- Jun 27, 2006, 2:46:40 PM (19 years ago)
- Location:
- branches/multi_player_map/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/multi_player_map/src/util/multiplayer_team_deathmatch.cc
r8809 r8827 487 487 stats.setPlayableUniqueId( playable.getUniqueID() ); 488 488 stats.setModelFileName( playableModel ); 489 490 this->respawnPlayable( &playable, stats.getPreferedTeamId(), 0.0f ); 489 491 490 492 if ( oldPlayable ) … … 734 736 } 735 737 738 this->respawnPlayable( killedStats.getPlayable(), killedStats.getTeamId(), 3.0f ); 739 } 740 741 /** 742 * this function is called on player respawn 743 * @param userId 744 */ 745 void MultiplayerTeamDeathmatch::onRespawn( int userId ) 746 { 747 if ( userId == SharedNetworkData::getInstance()->getHostID() ) 748 { 749 this->bLocalPlayerDead = false; 750 this->hideStats(); 751 } 752 } 753 754 /** 755 * this function is called on player respawn 756 * @param we 757 */ 758 void MultiplayerTeamDeathmatch::registerSpawn( WorldEntity * we ) 759 { 760 onRespawn( we->getOwner() ); 761 } 762 763 void MultiplayerTeamDeathmatch::respawnPlayable( Playable * playable, int teamId, float delay ) 764 { 736 765 const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT ); 737 766 … … 744 773 SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it); 745 774 746 if ( sp->getTeamId() < 0 || sp->getTeamId() == killedStats.getTeamId())775 if ( sp->getTeamId() == teamId ) 747 776 spList.push_back( sp ); 748 777 } 778 779 if ( spList.size() == 0 ) 780 { 781 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 782 { 783 SpawningPoint * sp = dynamic_cast<SpawningPoint*>(*it); 784 785 if ( sp->getTeamId() < 0 ) 786 spList.push_back( sp ); 787 } 788 } 789 790 assert( spList.size() != 0 ); 749 791 750 int n = spList.size()*rand(); 751 752 spList[n]->pushEntity( killedStats.getPlayable(), 3 ); 753 } 754 755 /** 756 * this function is called on player respawn 757 * @param userId 758 */ 759 void MultiplayerTeamDeathmatch::onRespawn( int userId ) 760 { 761 if ( userId == SharedNetworkData::getInstance()->getHostID() ) 762 { 763 this->bLocalPlayerDead = false; 764 this->hideStats(); 765 } 766 } 767 768 /** 769 * this function is called on player respawn 770 * @param we 771 */ 772 void MultiplayerTeamDeathmatch::registerSpawn( WorldEntity * we ) 773 { 774 onRespawn( we->getOwner() ); 775 } 776 792 int n = (int)((float)spList.size() * (float)rand()/(float)RAND_MAX); 793 794 spList[n]->pushEntity( playable, delay ); 795 } 796 -
branches/multi_player_map/src/util/multiplayer_team_deathmatch.h
r8802 r8827 60 60 61 61 virtual void handleChatMessage( int userId, const std::string & message, int messageType ); 62 63 void respawnPlayable( Playable * playable, int teamId, float delay ); 62 64 63 65 protected:
Note: See TracChangeset
for help on using the changeset viewer.