Changeset 9656 in orxonox.OLD for trunk/src/util
- Timestamp:
- Aug 4, 2006, 11:01:28 PM (18 years ago)
- Location:
- trunk/src/util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/multiplayer_team_deathmatch.cc
r9494 r9656 138 138 if ( currentGameState == GAMESTATE_PRE_GAME || currentGameState == GAMESTATE_GAME ) 139 139 { 140 if ( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) 141 && box == NULL 142 && (PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM 143 || bShowTeamChange ) 140 if ( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) && 141 box == NULL && 142 (PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM || bShowTeamChange ) 144 143 145 144 ) … … 193 192 } 194 193 195 if ( box != NULL 196 && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) 197 && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM 198 && !bShowTeamChange 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 // } 198 199 // check if the menu should be removed and the game state should be entered 200 if ( box != NULL && 201 PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() ) && 202 PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM && 203 !bShowTeamChange 199 204 ) 200 205 { … … 310 315 assert( false ); 311 316 } 317 312 318 313 319 std::string MultiplayerTeamDeathmatch::getPlayableModelFileName( int userId, int team, ClassID classId ) … … 442 448 } 443 449 450 /** 451 * this handles team changes but only on the master server 452 */ 444 453 void MultiplayerTeamDeathmatch::handleTeamChanges( ) 445 454 { … … 458 467 if ( stats.getPreferedTeamId() == TEAM_SPECTATOR || ( stats.getPreferedTeamId() >= 0 && stats.getPreferedTeamId() < numTeams ) ) 459 468 { 460 teamChange( stats.get UserId() );469 teamChange( stats.getAssignedUserId() ); 461 470 } 462 471 } … … 473 482 { 474 483 stats.setPreferedTeamId( getRandomTeam() ); 475 teamChange( stats.get UserId() );484 teamChange( stats.getAssignedUserId() ); 476 485 } 477 486 } … … 479 488 } 480 489 490 491 492 /** 493 * changes the team 494 * @param userId the user changing team (userId) 495 */ 481 496 void MultiplayerTeamDeathmatch::teamChange( int userId ) 482 497 { … … 489 504 490 505 491 ClassID playableClassId= getPlayableClassId( userId, stats.getPreferedTeamId() );492 std::string playableModel= getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );493 std::string playableTexture= getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );494 float playableScale= getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId );506 ClassID playableClassId = getPlayableClassId( userId, stats.getPreferedTeamId() ); 507 std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId ); 508 std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId ); 509 float playableScale = getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId ); 495 510 496 511 BaseObject * bo = Factory::fabricate( playableClassId ); … … 507 522 playable.setSynchronized( true ); 508 523 509 stats.setTeamId( stats.getPreferedTeamId() );510 524 stats.setPlayableClassId( playableClassId ); 511 525 stats.setPlayableUniqueId( playable.getUniqueID() ); 512 526 stats.setModelFileName( playableModel ); 527 stats.setTeamId( stats.getPreferedTeamId() ); 528 529 playable.setTeam(stats.getPreferedTeamId()); 530 513 531 514 532 this->respawnPlayable( &playable, stats.getPreferedTeamId(), 0.0f ); … … 516 534 if ( oldPlayable ) 517 535 { 518 //if ( userId == SharedNetworkData::getInstance()->getHostID() )519 // State::getPlayer()->setPlayable( NULL );520 536 delete oldPlayable; 521 537 } 522 538 } 539 523 540 524 541 void MultiplayerTeamDeathmatch::onButtonExit( ) … … 558 575 } 559 576 560 /** 561 * function that processes events from the handler 562 * @param event: the event 563 * @todo replace SDLK_o with something from KeyMapper 564 */ 577 578 /** 579 * function that processes events from the handler 580 * @param event: the event 581 * @todo replace SDLK_o with something from KeyMapper 582 */ 565 583 void MultiplayerTeamDeathmatch::process( const Event & event ) 566 584 { … … 573 591 if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed ) 574 592 { 575 PRINTF( 0)("hide stats\n");593 PRINTF(5)("hide stats\n"); 576 594 this->hideStats(); 577 595 } 578 596 else if ( !this->statsBox && event.bPressed ) 579 597 { 580 PRINTF( 0)("show stats\n");598 PRINTF(5)("show stats\n"); 581 599 this->showStats(); 582 600 } … … 740 758 PlayerStats & killerStats = *PlayerStats::getStats( killerUserId ); 741 759 742 if ( killerStats.getPlayable() != killer || victimStats.getPlayable() != victim)743 { 744 PRINTF(0)("killerStats.getPlayable() != killer || victimStats.getPlayable() != victim\n");760 if ( killerStats.getPlayable() == NULL || victimStats.getPlayable() == NULL) 761 { 762 PRINTF(0)("killerStats.getPlayable() != NULL || victimStats.getPlayable() != NULL\n"); 745 763 PRINTF(0)("%x %x %x %x\n", killerStats.getPlayable(), killer, victimStats.getPlayable(), victim ); 746 764 PRINTF(0)("%d %d %d %d\n", killerStats.getPlayable()->getUniqueID(), killer->getUniqueID(), victimStats.getPlayable()->getUniqueID(), victim->getUniqueID() ); … … 796 814 797 815 816 /** 817 * respawns a playable in the world via spawning points 818 * @param playable the playable to respawn 819 * @param teamId the teamId to use 820 * @param delay time delay for delayed spawning 821 */ 798 822 void MultiplayerTeamDeathmatch::respawnPlayable( Playable * playable, int teamId, float delay ) 799 823 { -
trunk/src/util/object_manager.cc
r9406 r9656 134 134 if (omList != OM_INIT || omList == OM_SIZE) 135 135 { 136 PRINT(0)(" +ObjectManager-LIST: '%s'==size='%d'==---\n", ObjectManager::OMListToString((OM_LIST)omList) , this->objectLists[omList].size());136 PRINT(0)(" +ObjectManager-LIST: '%s'==size='%d'==---\n", ObjectManager::OMListToString((OM_LIST)omList).c_str(), this->objectLists[omList].size()); 137 137 // if (level >= 1) 138 138 { … … 174 174 * @returns the String transformed from omList. 175 175 */ 176 const char*ObjectManager::OMListToString(OM_LIST omList)176 const std::string& ObjectManager::OMListToString(OM_LIST omList) 177 177 { 178 178 if (omList == OM_INIT || omList == OM_SIZE) 179 return "===invalid===";179 return ObjectManager::objectManagerListNames[OM_NULL]; 180 180 181 181 printf("%d\n", omList); … … 199 199 } 200 200 } 201 return OM_ DEFAULT_LIST;202 } 203 204 205 206 const char*ObjectManager::objectManagerListNames[] = {201 return OM_NULL; 202 } 203 204 205 206 const std::string ObjectManager::objectManagerListNames[] = { 207 207 "null", 208 208 "dead", -
trunk/src/util/object_manager.h
r8068 r9656 96 96 97 97 static OM_LIST StringToOMList(const std::string& listName); 98 static const char*OMListToString(OM_LIST omList);98 static const std::string& OMListToString(OM_LIST omList); 99 99 100 100 … … 113 113 EntityList objectLists[OM_SIZE]; //!< The ObjectLists. 114 114 115 static const char*objectManagerListNames[]; //!< Names of all the lists115 static const std::string objectManagerListNames[]; //!< Names of all the lists 116 116 117 117 EntityList reflectionList; //!< A list of all reflected objects in the world
Note: See TracChangeset
for help on using the changeset viewer.