Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2013, 8:06:44 PM (10 years ago)
Author:
jo
Message:

Adding most of the changes that were proposed in the release2012 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc

    r9667 r9941  
    3333#include "infos/PlayerInfo.h"
    3434#include "worldentities/pawns/Pawn.h"
     35#include "core/config/ConfigValueIncludes.h"
    3536
    3637namespace orxonox
     
    4142    {
    4243        RegisterObject(TeamDeathmatch);
     44
     45        this->setConfigValues();
     46    }
     47
     48    void TeamDeathmatch::setConfigValues()
     49    {
     50        SetConfigValue(maxScore_, 10);
    4351    }
    4452
     
    5765        std::string message("The match has ended.");
    5866        ChatManager::message(message);
     67       
     68        //find team that won the match
     69        int winnerTeam = 0;
     70        int highestScore = 0;
     71        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     72        {
     73            if ( this->getTeamScore(it->first) > highestScore )
     74            {
     75                winnerTeam = this->getTeam(it->first);
     76                highestScore = this->getTeamScore(it->first);
     77            }
     78        }
     79
     80        //announce win
     81        this->announceTeamWin(winnerTeam);
    5982    }
    6083
     
    100123            {
    101124                if (killer->getPlayer())
     125                {
    102126                    message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName();
     127                    if(this->isExactlyA(Class(TeamDeathmatch)) && (this->getTeamScore(killer->getPlayer()) >= (this->maxScore_ -1)) )
     128                        this->end();
     129                }
    103130                else
    104131                    message = victim->getPlayer()->getName() + " was killed";
Note: See TracChangeset for help on using the changeset viewer.