Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2011, 5:16:39 PM (13 years ago)
Author:
landauf
Message:

fixed possible bug in LastTeamStanding

Location:
code/branches/presentation/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/libraries/network/synchronisable/Serialise.h

    r7284 r8612  
    8484
    8585    /** @brief returns the size of the objectID needed to synchronise the pointer */
    86     template <class T> inline uint32_t returnSize( const SmartPtr<T>& variable )
     86    template <class T> inline uint32_t returnSize( const SmartPtr<T>& )
    8787    {
    8888        return sizeof(uint32_t);
  • code/branches/presentation/src/orxonox/gametypes/LastTeamStanding.cc

    r8351 r8612  
    5555        this->setHUDTemplate("lastTeamStandingHUD");
    5656    }
    57    
     57
    5858    LastTeamStanding::~LastTeamStanding()
    5959    {
    60     }   
     60    }
    6161
    6262    void LastTeamStanding::playerEntered(PlayerInfo* player)
     
    6969        else
    7070            playerLives_[player]=getMinLives();//new players only get minimum of lives */
    71        
     71
    7272        this->timeToAct_[player] = timeRemaining;
    7373        this->playerDelayTime_[player] = respawnDelay;
    7474        this->inGame_[player] = true;
    7575        unsigned int team = getTeam(player);
    76         if( team < 0|| team > teams_) // make sure getTeam returns a regular value
     76        if(team >= eachTeamsPlayers.size()) // make sure getTeam returns a regular value
    7777            return;
    7878        if(this->eachTeamsPlayers[team]==0) //if a player is the first in his group, a new team is alive
     
    9191            this->inGame_.erase(player);
    9292            unsigned int team = getTeam(player);
    93             if( team < 0|| team > teams_) // make sure getTeam returns a regular value
     93            if(team >= eachTeamsPlayers.size()) // make sure getTeam returns a regular value
    9494                return valid_player;
    9595            this->eachTeamsPlayers[team]--;       // a player left the team
     
    107107        bool allow = TeamDeathmatch::allowPawnDeath(victim, originator);
    108108        if(!allow) {return allow;}
    109        
     109
    110110        playerLives_[victim->getPlayer()] = playerLives_[victim->getPlayer()] - 1; //player lost a live
    111111        this->inGame_[victim->getPlayer()] = false; //if player dies, he isn't allowed to respawn immediately
     
    113113        {
    114114            unsigned int team = getTeam(victim->getPlayer());
    115             if(team < 0|| team > teams_) // make sure getTeam returns a regular value
     115            if(team >= eachTeamsPlayers.size()) // make sure getTeam returns a regular value
    116116                return allow;
    117117            this->eachTeamsPlayers[team]--;
     
    140140                const std::string& message = ""; // resets Camper-Warning-message
    141141                this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    142             }   
     142            }
    143143        }
    144144        return allow;
     
    163163            return;
    164164        TeamDeathmatch::playerStartsControllingPawn(player,pawn);
    165        
     165
    166166        this->timeToAct_[player] = timeRemaining + 3.0f + respawnDelay;//reset timer
    167167        this->playerDelayTime_[player] = respawnDelay;
    168        
     168
    169169        std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
    170170        if (it != this->players_.end())
     
    174174            const std::string& message = ""; // resets Camper-Warning-message
    175175            this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
    176         } 
     176        }
    177177    }
    178178
     
    187187            }
    188188            for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
    189             {   
     189            {
    190190                if (playerGetLives(it->first) <= 0)//Players without lives shouldn't be affected by time.
    191                     continue;     
     191                    continue;
    192192                it->second -= dt;//Decreases punishment time.
    193                 if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 
     193                if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
    194194                {
    195195                    playerDelayTime_[it->first] -= dt;
     
    309309            return 0;
    310310    }
    311    
     311
    312312    void LastTeamStanding::setConfigValues()
    313313    {
  • code/branches/presentation/src/orxonox/weaponsystem/Munition.cc

    r7896 r8612  
    253253    bool Munition::canAddMunition(unsigned int amount) const
    254254    {
     255        // TODO: 'amount' is not used
     256
    255257        if (!this->bAllowMunitionRefilling_)
    256258            return false;
     
    334336    bool Munition::canAddMagazines(unsigned int amount) const
    335337    {
     338        // TODO: 'amount' is not used
     339
    336340        if (this->bStackMunition_)
    337341            // If we stack munition, we can always add new magazines because they contribute directly to the munition
Note: See TracChangeset for help on using the changeset viewer.