Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 2, 2012, 6:45:40 PM (12 years ago)
Author:
jo
Message:

Teamdeathmatch ends if a certain number of opponents have been killed. (friendlyfire is not concerned)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/release2012/src/orxonox/gametypes/TeamGametype.cc

    r9348 r9363  
    173173    }
    174174
     175    int TeamGametype::getTeamScore(PlayerInfo* player)
     176    {
     177        int teamscore = 0;
     178        if(!player || this->getTeam(player) == -1)
     179            return 0;
     180        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     181        {
     182            if ( this->getTeam(it->first) ==  this->getTeam(player) )
     183            {
     184                teamscore += it->second.frags_;
     185            }
     186        }
     187        return teamscore;
     188    }
     189
    175190    SpawnPoint* TeamGametype::getBestSpawnPoint(PlayerInfo* player) const
    176191    {
     
    336351    }
    337352
     353    void TeamGametype::announceTeamWin(int winnerTeam)
     354    {
     355        for (std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3)
     356        {
     357            if (it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)
     358                continue;
     359            if (it3->second == winnerTeam)
     360            {
     361                this->gtinfo_->sendAnnounceMessage("Your team has won the match!", it3->first->getClientID());
     362            }
     363            else
     364            {
     365                this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", it3->first->getClientID());
     366            }
     367        }   
     368    }
     369
    338370}
Note: See TracChangeset for help on using the changeset viewer.