Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 4, 2015, 10:25:42 PM (9 years ago)
Author:
landauf
Message:

replace 'NULL' by 'nullptr'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/pong/Pong.cc

    r9939 r10765  
    103103    void Pong::cleanup()
    104104    {
    105         if (this->ball_ != NULL) // Destroy the ball, if present.
     105        if (this->ball_ != nullptr) // Destroy the ball, if present.
    106106        {
    107107            this->ball_->destroy();
     
    112112        for (size_t i = 0; i < 2; ++i)
    113113        {
    114             if (this->bat_[0] != NULL)
     114            if (this->bat_[0] != nullptr)
    115115            {
    116116                this->bat_[0]->destroy();
     
    127127    void Pong::start()
    128128    {
    129         if (this->center_ != NULL) // There needs to be a PongCenterpoint, i.e. the area the game takes place.
    130         {
    131             if (this->ball_ == NULL) // If there is no ball, create a new ball.
     129        if (this->center_ != nullptr) // There needs to be a PongCenterpoint, i.e. the area the game takes place.
     130        {
     131            if (this->ball_ == nullptr) // If there is no ball, create a new ball.
    132132            {
    133133                this->ball_ = new PongBall(this->center_->getContext());
     
    147147            for (size_t i = 0; i < 2; ++i)
    148148            {
    149                 if (this->bat_[i] == NULL)
     149                if (this->bat_[i] == nullptr)
    150150                {
    151151                    this->bat_[i] = new PongBat(this->center_->getContext());
     
    231231
    232232        // If the first (left) bat has no player.
    233         if (this->bat_[0]->getPlayer() == NULL)
     233        if (this->bat_[0]->getPlayer() == nullptr)
    234234        {
    235235            player->startControl(this->bat_[0]);
     
    237237        }
    238238        // If the second (right) bat has no player.
    239         else if (this->bat_[1]->getPlayer() == NULL)
     239        else if (this->bat_[1]->getPlayer() == nullptr)
    240240        {
    241241            player->startControl(this->bat_[1]);
     
    247247
    248248        // If the player is an AI, it receives a pointer to the ball.
    249         if (player->getController() != NULL && player->getController()->isA(Class(PongAI)))
     249        if (player->getController() != nullptr && player->getController()->isA(Class(PongAI)))
    250250        {
    251251            PongAI* ai = orxonox_cast<PongAI*>(player->getController());
     
    262262        Deathmatch::playerScored(player, score);
    263263
    264         if (this->center_ != NULL) // If there is a centerpoint.
     264        if (this->center_ != nullptr) // If there is a centerpoint.
    265265        {
    266266            // Fire an event for the player that has scored, to be able to react to it in the level, e.g. by displaying fireworks.
     
    271271
    272272            // Also announce, that the player has scored.
    273             if (player != NULL)
     273            if (player != nullptr)
    274274                this->gtinfo_->sendAnnounceMessage(player->getName() + " scored");
    275275        }
    276276
    277277        // If there is a ball present, reset its position, velocity and acceleration.
    278         if (this->ball_ != NULL)
     278        if (this->ball_ != nullptr)
    279279        {
    280280            this->ball_->setPosition(Vector3::ZERO);
     
    285285
    286286        // If there are bats reset them to the middle position.
    287         if (this->bat_[0] != NULL && this->bat_[1] != NULL)
     287        if (this->bat_[0] != nullptr && this->bat_[1] != nullptr)
    288288        {
    289289            this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
     
    292292
    293293        // If a player gets enough points, he won the game -> end of game
    294         PlayerInfo* winningPlayer = NULL;
     294        PlayerInfo* winningPlayer = nullptr;
    295295        if (this->getLeftPlayer() && this->getScore(this->getLeftPlayer()) >= scoreLimit_)
    296296            winningPlayer = this->getLeftPlayer();
     
    314314    void Pong::startBall()
    315315    {
    316         if (this->ball_ != NULL && this->center_ != NULL)
     316        if (this->ball_ != nullptr && this->center_ != nullptr)
    317317            this->ball_->setSpeed(this->center_->getBallSpeed());
    318318    }
     
    322322        Get the left player.
    323323    @return
    324         Returns a pointer to the player playing on the left. If there is no left player, NULL is returned.
     324        Returns a pointer to the player playing on the left. If there is no left player, nullptr is returned.
    325325    */
    326326    PlayerInfo* Pong::getLeftPlayer() const
    327327    {
    328         if (this->bat_ != NULL && this->bat_[0] != NULL)
     328        if (this->bat_ != nullptr && this->bat_[0] != nullptr)
    329329            return this->bat_[0]->getPlayer();
    330330        else
     
    336336        Get the right player.
    337337    @return
    338         Returns a pointer to the player playing on the right. If there is no right player, NULL is returned.
     338        Returns a pointer to the player playing on the right. If there is no right player, nullptr is returned.
    339339    */
    340340    PlayerInfo* Pong::getRightPlayer() const
    341341    {
    342         if (this->bat_ != NULL && this->bat_[1] != NULL)
     342        if (this->bat_ != nullptr && this->bat_[1] != nullptr)
    343343            return this->bat_[1]->getPlayer();
    344344        else
Note: See TracChangeset for help on using the changeset viewer.