Changeset 9110 in orxonox.OLD for trunk/src/util
- Timestamp:
- Jul 4, 2006, 11:18:41 AM (18 years ago)
- Location:
- trunk/src/util
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/multiplayer_team_deathmatch.cc
r9059 r9110 455 455 ClassID playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() ); 456 456 std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId ); 457 std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId ); 457 458 458 459 BaseObject * bo = Factory::fabricate( playableClassId ); … … 463 464 Playable & playable = *(dynamic_cast<Playable*>(bo)); 464 465 465 playable.loadModel( playableModel ); 466 if ( playableTexture != "" ) 467 playable.loadMD2Texture( playableTexture ); 468 if ( playableModel != "" ) 469 playable.loadModel( playableModel ); 466 470 playable.setOwner( userId ); 467 471 playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); … … 537 541 this->hideStats(); 538 542 } 539 if ( !this->statsBox && event.bPressed )543 else if ( !this->statsBox && event.bPressed ) 540 544 { 541 545 PRINTF(0)("show stats\n"); … … 612 616 { 613 617 statsBox = new OrxGui::GLGuiBox(); 614 statsBox->setAbsCoor2D( 300, 100 );615 616 this->table = new OrxGui::GLGuiTable( 5,5);618 statsBox->setAbsCoor2D( 100, 100 ); 619 620 this->table = new OrxGui::GLGuiTable(10,5); 617 621 618 622 statsBox->pack( this->table ); … … 642 646 643 647 std::vector<std::string> headers; 648 headers.push_back("Blue Team"); 649 headers.push_back(""); 650 headers.push_back(""); 644 651 headers.push_back("Red Team"); 645 652 headers.push_back(""); 646 headers.push_back("");647 headers.push_back("Blue Team");648 headers.push_back("");649 653 this->table->setHeader(headers); 650 654 651 std::map<int,std::string> fragsTeam0; 652 std::map<int,std::string> fragsTeam1; 653 654 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS ); 655 656 if ( !list ) 657 return; 658 659 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 660 { 661 PlayerStats & stats = *dynamic_cast<PlayerStats*>(*it); 662 663 if ( stats.getTeamId() == 0 || stats.getTeamId() == 1 ) 664 { 665 if ( stats.getTeamId() == 0 ) 666 fragsTeam0[stats.getScore()] = stats.getNickName(); 667 else 668 fragsTeam1[stats.getScore()] = stats.getNickName(); 669 } 670 } 655 ScoreList scoreList = PlayerStats::getScoreList(); 671 656 672 657 char st[10]; 673 658 int i = 0; 674 675 659 676 660 i = 2; 677 for ( std::map<int,std::string>::const_iterator it = fragsTeam0.begin(); it != fragsTeam0.end(); it++ )678 { 679 this->table->setEntry( 0, i, it->second);680 snprintf( st, 10, "%d", it-> first);681 this->table->setEntry( 1, i, st );682 this->table->setEntry( 2, i, "" );661 for ( TeamScoreList::const_iterator it = scoreList[0].begin(); it != scoreList[0].end(); it++ ) 662 { 663 this->table->setEntry( i, 0, it->name ); 664 snprintf( st, 10, "%d", it->score ); 665 this->table->setEntry( i, 1, st ); 666 this->table->setEntry( i, 2, "" ); 683 667 i++; 684 668 } 685 669 686 670 i = 2; 687 for ( std::map<int,std::string>::const_iterator it = fragsTeam1.begin(); it != fragsTeam1.end(); it++ )688 { 689 this->table->setEntry( 3, i, it->second);690 snprintf( st, 10, "%d", it-> first);691 this->table->setEntry( 4, i, st );671 for ( TeamScoreList::const_iterator it = scoreList[1].begin(); it != scoreList[1].end(); it++ ) 672 { 673 this->table->setEntry( i, 3, it->name ); 674 snprintf( st, 10, "%d", it->score ); 675 this->table->setEntry( i, 4, st ); 692 676 i++; 693 677 } 678 694 679 } 695 680 … … 797 782 } 798 783 784 std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, ClassID classId ) 785 { 786 if ( classId == CL_FPS_PLAYER ) 787 { 788 return "maps/doom_guy.png"; 789 } 790 791 return ""; 792 } 793 -
trunk/src/util/multiplayer_team_deathmatch.h
r9059 r9110 39 39 virtual int getTeamForNewUser(); 40 40 virtual ClassID getPlayableClassId( int userId, int team ); 41 virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId ); 41 42 virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId ); 42 43 -
trunk/src/util/network_game_rules.cc
r8623 r9110 40 40 } 41 41 42 43 std::string NetworkGameRules::getPlayableModelTextureFileName( int userId, int team, ClassID classId ) 44 { 45 return ""; 46 } 47 42 48 std::string NetworkGameRules::getPlayableModelFileName( int uesrId, int team, ClassID classId ) 43 49 { -
trunk/src/util/network_game_rules.h
r8623 r9110 23 23 virtual ClassID getPlayableClassId( int userId, int team ); 24 24 virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId ); 25 virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId ); 25 26 26 27 virtual PlayerStats * getNewPlayerStats( int userId ){ return new PlayerStats( userId ); } -
trunk/src/util/signal_handler.h
r8623 r9110 44 44 public: 45 45 inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; } 46 ~SignalHandler(){ SignalHandler::singletonRef = NULL; } 46 47 47 48 void registerCallback( SignalCallback cb, void * someData );
Note: See TracChangeset
for help on using the changeset viewer.