Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 10, 2016, 1:54:11 PM (9 years ago)
Author:
landauf
Message:

merged branch cpp11_v2 into cpp11_v3

Location:
code/branches/cpp11_v3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/modules/jump/Jump.cc

    r10262 r11054  
    3434#include "Jump.h"
    3535#include "core/CoreIncludes.h"
    36 #include "core/EventIncludes.h"
    37 #include "core/command/Executor.h"
    38 #include "core/config/ConfigValueIncludes.h"
    39 #include "gamestates/GSLevel.h"
    40 #include "chat/ChatManager.h"
     36
    4137#include "JumpCenterpoint.h"
    4238#include "JumpPlatform.h"
     
    5652#include "JumpBoots.h"
    5753#include "JumpShield.h"
     54
     55#include "gamestates/GSLevel.h"
    5856#include "infos/PlayerInfo.h"
     57#include "graphics/Camera.h"
    5958
    6059namespace orxonox
     
    6665        RegisterObject(Jump);
    6766
    68         center_ = 0;
    69         figure_ = 0;
    70         camera = 0;
     67        center_ = nullptr;
     68        figure_ = nullptr;
     69        camera = nullptr;
    7170        setHUDTemplate("JumpHUD");
    72 
    73         setConfigValues();
    7471    }
    7572
     
    8683        SUPER(Jump, tick, dt);
    8784
    88         if (figure_ != NULL)
     85        if (figure_ != nullptr)
    8986        {
    9087            Vector3 figurePosition = figure_->getPosition();
     
    10198                if (screenShiftSinceLastUpdate_ > center_->getSectionLength())
    10299                {
    103                     if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == false && figure_->rocketActive_ == false && addAdventure(adventureNumber_) == true)
     100                    if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == nullptr && figure_->rocketActive_ == nullptr && addAdventure(adventureNumber_) == true)
    104101                    {
    105102                        screenShiftSinceLastUpdate_ -= 2*center_->getSectionLength();
     
    133130
    134131
    135             if (camera != NULL)
     132            if (camera != nullptr)
    136133            {
    137134                Vector3 cameraPosition = Vector3(0, totalScreenShift_, 0);
     
    144141        }
    145142
    146         ObjectList<JumpPlatform>::iterator beginPlatform = ObjectList<JumpPlatform>::begin();
    147         ObjectList<JumpPlatform>::iterator endPlatform = ObjectList<JumpPlatform>::end();
    148         ObjectList<JumpPlatform>::iterator itPlatform = beginPlatform;
     143        ObjectList<JumpPlatform> listPlatform;
     144        ObjectList<JumpPlatform>::iterator itPlatform = listPlatform.begin();
    149145        Vector3 platformPosition;
    150146
    151         while (itPlatform != endPlatform)
     147        while (itPlatform != listPlatform.end())
    152148        {
    153149            platformPosition = itPlatform->getPosition();
     
    166162
    167163        // Deleted deactivated platforms
    168         ObjectList<JumpPlatformDisappear>::iterator beginDisappear = ObjectList<JumpPlatformDisappear>::begin();
    169         ObjectList<JumpPlatformDisappear>::iterator endDisappear = ObjectList<JumpPlatformDisappear>::end();
    170         ObjectList<JumpPlatformDisappear>::iterator itDisappear = beginDisappear;
    171 
    172         while (itDisappear != endDisappear)
     164        ObjectList<JumpPlatformDisappear> listDisappear;
     165        ObjectList<JumpPlatformDisappear>::iterator itDisappear = listDisappear.begin();
     166
     167        while (itDisappear != listDisappear.end())
    173168        {
    174169            if (!itDisappear->isActive())
     
    185180        }
    186181
    187         ObjectList<JumpPlatformTimer>::iterator beginTimer = ObjectList<JumpPlatformTimer>::begin();
    188         ObjectList<JumpPlatformTimer>::iterator endTimer = ObjectList<JumpPlatformTimer>::end();
    189         ObjectList<JumpPlatformTimer>::iterator itTimer = beginTimer;
    190 
    191         while (itTimer != endTimer)
     182        ObjectList<JumpPlatformTimer> listTimer;
     183        ObjectList<JumpPlatformTimer>::iterator itTimer = listTimer.begin();
     184
     185        while (itTimer != listTimer.end())
    192186        {
    193187            if (!itTimer->isActive())
     
    204198        }
    205199
    206         ObjectList<JumpProjectile>::iterator beginProjectile = ObjectList<JumpProjectile>::begin();
    207         ObjectList<JumpProjectile>::iterator endProjectile = ObjectList<JumpProjectile>::end();
    208         ObjectList<JumpProjectile>::iterator itProjectile = beginProjectile;
     200        ObjectList<JumpProjectile> listProjectile;
     201        ObjectList<JumpProjectile>::iterator itProjectile = listProjectile.begin();
    209202        Vector3 projectilePosition;
    210203
    211         while (itProjectile != endProjectile)
     204        while (itProjectile != listProjectile.end())
    212205        {
    213206            projectilePosition = itProjectile->getPosition();
     
    225218        }
    226219
    227         ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin();
    228         ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end();
    229         ObjectList<JumpEnemy>::iterator itEnemy = beginEnemy;
     220        ObjectList<JumpEnemy> listEnemy;
     221        ObjectList<JumpEnemy>::iterator itEnemy = listEnemy.begin();
    230222        Vector3 enemyPosition;
    231223
    232         while (itEnemy != endEnemy)
     224        while (itEnemy != listEnemy.end())
    233225        {
    234226            enemyPosition = itEnemy->getPosition();
     
    246238        }
    247239
    248         ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin();
    249         ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end();
    250         ObjectList<JumpItem>::iterator itItem = beginItem;
     240        ObjectList<JumpItem> listItem;
     241        ObjectList<JumpItem>::iterator itItem = listItem.begin();
    251242        Vector3 itemPosition;
    252243
    253         while (itItem != endItem)
     244        while (itItem != listItem.end())
    254245        {
    255246            itemPosition = itItem->getPosition();
     
    273264    void Jump::cleanup()
    274265    {
    275         camera = 0;
     266        camera = nullptr;
    276267    }
    277268
    278269    void Jump::start()
    279270    {
    280         if (center_ != NULL) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.
    281         {
    282             if (figure_ == NULL)
     271        if (center_ != nullptr) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.
     272        {
     273            if (figure_ == nullptr)
    283274            {
    284275                figure_ = new JumpFigure(center_->getContext());
     
    301292        Deathmatch::start();
    302293
    303         if (figure_ != NULL)
     294        if (figure_ != nullptr)
    304295        {
    305296            camera = figure_->getCamera();
     
    328319        assert(player);
    329320
    330         if (figure_->getPlayer() == NULL)
     321        if (figure_->getPlayer() == nullptr)
    331322        {
    332323            player->startControl(figure_);
     
    337328    PlayerInfo* Jump::getPlayer() const
    338329    {
    339         if (this->figure_ != NULL)
     330        if (this->figure_ != nullptr)
    340331        {
    341332            return this->figure_->getPlayer();
     
    343334        else
    344335        {
    345             return 0;
     336            return nullptr;
    346337        }
    347338    }
     
    349340    void Jump::addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition)
    350341    {
    351         if (newPlatform != NULL && center_ != NULL)
     342        if (newPlatform != nullptr && center_ != nullptr)
    352343        {
    353344            newPlatform->addTemplate(platformTemplate);
     
    417408    {
    418409        JumpProjectile* newProjectile = new JumpProjectile(center_->getContext());
    419         if (newProjectile != NULL && center_ != NULL)
     410        if (newProjectile != nullptr && center_ != nullptr)
    420411        {
    421412            newProjectile->addTemplate(center_->getProjectileTemplate());
     
    430421    {
    431422        JumpSpring* newSpring = new JumpSpring(center_->getContext());
    432         if (newSpring != NULL && center_ != NULL)
     423        if (newSpring != nullptr && center_ != nullptr)
    433424        {
    434425            newSpring->addTemplate(center_->getSpringTemplate());
     
    443434    {
    444435        JumpSpring* newSpring = new JumpSpring(center_->getContext());
    445         if (newSpring != NULL && center_ != NULL)
     436        if (newSpring != nullptr && center_ != nullptr)
    446437        {
    447438            newSpring->addTemplate(center_->getSpringTemplate());
     
    456447    {
    457448        JumpRocket* newRocket = new JumpRocket(center_->getContext());
    458         if (newRocket != NULL && center_ != NULL)
     449        if (newRocket != nullptr && center_ != nullptr)
    459450        {
    460451            newRocket->addTemplate(center_->getRocketTemplate());
     
    469460    {
    470461        JumpRocket* newRocket = new JumpRocket(center_->getContext());
    471         if (newRocket != NULL && center_ != NULL)
     462        if (newRocket != nullptr && center_ != nullptr)
    472463        {
    473464            newRocket->addTemplate(center_->getRocketTemplate());
     
    482473    {
    483474        JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
    484         if (newPropeller != NULL && center_ != NULL)
     475        if (newPropeller != nullptr && center_ != nullptr)
    485476        {
    486477            newPropeller->addTemplate(center_->getPropellerTemplate());
     
    495486    {
    496487        JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
    497         if (newPropeller != NULL && center_ != NULL)
     488        if (newPropeller != nullptr && center_ != nullptr)
    498489        {
    499490            newPropeller->addTemplate(center_->getPropellerTemplate());
     
    508499    {
    509500        JumpBoots* newBoots = new JumpBoots(center_->getContext());
    510         if (newBoots != NULL && center_ != NULL)
     501        if (newBoots != nullptr && center_ != nullptr)
    511502        {
    512503            newBoots->addTemplate(center_->getBootsTemplate());
     
    521512    {
    522513        JumpBoots* newBoots = new JumpBoots(center_->getContext());
    523         if (newBoots != NULL && center_ != NULL)
     514        if (newBoots != nullptr && center_ != nullptr)
    524515        {
    525516            newBoots->addTemplate(center_->getBootsTemplate());
     
    534525    {
    535526        JumpShield* newShield = new JumpShield(center_->getContext());
    536         if (newShield != NULL && center_ != NULL)
     527        if (newShield != nullptr && center_ != nullptr)
    537528        {
    538529            newShield->addTemplate(center_->getShieldTemplate());
     
    547538    {
    548539        JumpShield* newShield = new JumpShield(center_->getContext());
    549         if (newShield != NULL && center_ != NULL)
     540        if (newShield != nullptr && center_ != nullptr)
    550541        {
    551542            newShield->addTemplate(center_->getShieldTemplate());
     
    560551    {
    561552        JumpEnemy* newEnemy = new JumpEnemy(center_->getContext());
    562         if (newEnemy != NULL && center_ != NULL)
     553        if (newEnemy != nullptr && center_ != nullptr)
    563554        {
    564555            switch (type)
     
    12731264    float Jump::getFuel() const
    12741265    {
    1275         if (this->figure_ != NULL)
    1276         {
    1277             if (this->figure_->rocketActive_ != NULL)
     1266        if (this->figure_ != nullptr)
     1267        {
     1268            if (this->figure_->rocketActive_ != nullptr)
    12781269            {
    12791270                return this->figure_->rocketActive_->getFuelState();
    12801271            }
    1281             else if (this->figure_->propellerActive_ != NULL)
     1272            else if (this->figure_->propellerActive_ != nullptr)
    12821273            {
    12831274                return this->figure_->propellerActive_->getFuelState();
    12841275            }
    1285             else if (this->figure_->shieldActive_ != NULL)
     1276            else if (this->figure_->shieldActive_ != nullptr)
    12861277            {
    12871278                return this->figure_->shieldActive_->getFuelState();
    12881279            }
    1289             else if (this->figure_->bootsActive_ != NULL)
     1280            else if (this->figure_->bootsActive_ != nullptr)
    12901281            {
    12911282                return this->figure_->bootsActive_->getFuelState();
     
    13001291        return figure_->dead_;
    13011292    }
     1293
     1294    void Jump::setCenterpoint(JumpCenterpoint* center)
     1295    {
     1296        center_ = center;
     1297    }
     1298
    13021299}
Note: See TracChangeset for help on using the changeset viewer.