Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 20, 2006, 1:39:01 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the network branche back here
merged with command:
svn merge -r8230:HEAD https://svn.orxonox.net/orxonox/branches/network .
conflicts resolved in favour of the network branche (conflicts were in network)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/multiplayer_team_deathmatch.cc

    r8147 r8623  
    6565  this->currentGameState = GAMESTATE_PRE_GAME;
    6666  this->gameStateTimer = 10.0f;
     67  this->bShowTeamChange = false;
    6768 
    6869  this->box = NULL;
     
    7778  if( root != NULL)
    7879    this->loadParams(root);
     80 
     81  subscribeEvent( ES_GAME, SDLK_o );
    7982}
    8083
     
    8689  if( this->deathScreen)
    8790    delete this->deathScreen;
     91 
     92  unsubscribeEvent( ES_GAME, SDLK_o );
    8893}
    8994
     
    150155    return;
    151156 
    152   if ( currentGameState == GAMESTATE_PRE_GAME )
     157  if ( currentGameState == GAMESTATE_PRE_GAME || currentGameState == GAMESTATE_GAME )
    153158  {
    154159    if ( PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )
    155          && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM
    156160         && box == NULL
     161         &&  (PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() == TEAM_NOTEAM
     162         || bShowTeamChange )
     163         
    157164       )
    158165    {
     
    180187      buttonTeam1->connect(SIGNAL(buttonTeam1, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonTeam1));
    181188     
     189      if ( bShowTeamChange )
     190      {
     191        OrxGui::GLGuiPushButton * buttonCancel = new OrxGui::GLGuiPushButton("Cancel");
     192        box->pack( buttonCancel );
     193        buttonCancel->connect(SIGNAL(buttonCancel, released), this, SLOT(MultiplayerTeamDeathmatch, onButtonCancel));
     194      }
     195     
    182196      OrxGui::GLGuiPushButton * buttonExit = new OrxGui::GLGuiPushButton("Exit");
    183197      box->pack( buttonExit );
     
    191205       && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )
    192206       && PlayerStats::getStats( SharedNetworkData::getInstance()->getHostID() )->getPreferedTeamId() != TEAM_NOTEAM
     207       && !bShowTeamChange
    193208     )
    194209  {
     
    479494{
    480495  State::getCurrentStoryEntity()->stop();
     496  this->bShowTeamChange = false;
    481497}
    482498
     
    484500{
    485501  NetworkGameManager::getInstance()->prefereTeam( TEAM_RANDOM );
     502  this->bShowTeamChange = false;
    486503}
    487504
     
    489506{
    490507  NetworkGameManager::getInstance()->prefereTeam( 0 );
     508  this->bShowTeamChange = false;
    491509}
    492510
     
    494512{
    495513  NetworkGameManager::getInstance()->prefereTeam( 1 );
     514  this->bShowTeamChange = false;
    496515}
    497516
     
    499518{
    500519  NetworkGameManager::getInstance()->prefereTeam( TEAM_SPECTATOR );
     520  this->bShowTeamChange = false;
    501521}
    502522
     
    507527}
    508528
    509 
    510 
    511 
    512 
    513 
     529  /**
     530   * function that processes events from the handler
     531   * @param event: the event
     532   * @todo replace SDLK_o with something from KeyMapper
     533   */
     534void MultiplayerTeamDeathmatch::process( const Event & event )
     535{
     536  if ( event.type == SDLK_o )
     537  {
     538    if ( event.bPressed )
     539      this->bShowTeamChange = true;
     540  }
     541}
     542
     543void MultiplayerTeamDeathmatch::onButtonCancel( )
     544{
     545  this->bShowTeamChange = false;
     546}
     547
     548
     549
     550/**
     551 * this method is called by NetworkGameManger when he recieved a chat message
     552 * @param userId senders user id
     553 * @param message message string
     554 * @param messageType some int
     555 */
     556void MultiplayerTeamDeathmatch::handleChatMessage( int userId, const std::string & message, int messageType )
     557{
     558  std::string name = "unknown";
     559 
     560  if ( PlayerStats::getStats( userId ) )
     561  {
     562    name = PlayerStats::getStats( userId )->getNickName();
     563  }
     564 
     565  PRINTF(0)("CHATMESSAGE %s: %s\n", name.c_str(), message.c_str() );
     566}
     567
     568
     569
     570
Note: See TracChangeset for help on using the changeset viewer.