Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/jump/Jump.cc

    r10262 r11071  
    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)
     
    619610        const int numJ = 4;
    620611
    621         enum PlatformType
    622         {
    623             PLATFORM_EMPTY, PLATFORM_STATIC, PLATFORM_HMOVE, PLATFORM_VMOVE, PLATFORM_DISAPPEAR, PLATFORM_TIMER, PLATFORM_FAKE
     612        enum class PlatformType
     613        {
     614            EMPTY, STATIC, HMOVE, VMOVE, DISAPPEAR, TIMER, FAKE
    624615        };
    625616
    626         enum ItemType
    627         {
    628             ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD
     617        enum class ItemType
     618        {
     619            NOTHING, SPRING, PROPELLER, ROCKET, BOOTS, SHIELD
    629620        };
    630621
     
    640631            for (int j = 0; j < numJ; ++j)
    641632            {
    642                 matrix[i][j].type = PLATFORM_EMPTY;
     633                matrix[i][j].type = PlatformType::EMPTY;
    643634                matrix[i][j].done = false;
    644635            }
     
    646637        PlatformType platformtype1;
    647638        PlatformType platformtype2;
    648         ItemType itemType = ITEM_NOTHING;
     639        ItemType itemType = ItemType::NOTHING;
    649640
    650641        if (rand()%2 == 0)
    651642        {
    652             itemType = ITEM_SPRING;
     643            itemType = ItemType::SPRING;
    653644        }
    654645        else if (rand()%2 == 0 && sectionNumber_ > 3)
     
    657648            {
    658649            case 0:
    659                 itemType = ITEM_PROPELLER;
     650                itemType = ItemType::PROPELLER;
    660651                break;
    661652            case 1:
    662                 itemType = ITEM_ROCKET;
     653                itemType = ItemType::ROCKET;
    663654                break;
    664655            case 2:
    665                 itemType = ITEM_BOOTS;
     656                itemType = ItemType::BOOTS;
    666657                break;
    667658            case 3:
    668                 itemType = ITEM_SHIELD;
     659                itemType = ItemType::SHIELD;
    669660                break;
    670661            default:
     
    676667        {
    677668        case 0:
    678             platformtype1 = PLATFORM_STATIC;
    679             platformtype2 = PLATFORM_STATIC;
     669            platformtype1 = PlatformType::STATIC;
     670            platformtype2 = PlatformType::STATIC;
    680671            break;
    681672        case 1:
    682             platformtype1 = PLATFORM_STATIC;
    683             platformtype2 = PLATFORM_STATIC;
     673            platformtype1 = PlatformType::STATIC;
     674            platformtype2 = PlatformType::STATIC;
    684675            break;
    685676        case 2:
    686             platformtype1 = PLATFORM_STATIC;
    687             platformtype2 = PLATFORM_HMOVE;
     677            platformtype1 = PlatformType::STATIC;
     678            platformtype2 = PlatformType::HMOVE;
    688679            break;
    689680        case 3:
    690             platformtype1 = PLATFORM_STATIC;
    691             platformtype2 = PLATFORM_DISAPPEAR;
     681            platformtype1 = PlatformType::STATIC;
     682            platformtype2 = PlatformType::DISAPPEAR;
    692683            break;
    693684        case 4:
    694             platformtype1 = PLATFORM_STATIC;
    695             platformtype2 = PLATFORM_VMOVE;
     685            platformtype1 = PlatformType::STATIC;
     686            platformtype2 = PlatformType::VMOVE;
    696687            break;
    697688        case 5:
    698             platformtype1 = PLATFORM_STATIC;
    699             platformtype2 = PLATFORM_TIMER;
     689            platformtype1 = PlatformType::STATIC;
     690            platformtype2 = PlatformType::TIMER;
    700691            break;
    701692        case 6:
    702             platformtype1 = PLATFORM_HMOVE;
    703             platformtype2 = PLATFORM_STATIC;
     693            platformtype1 = PlatformType::HMOVE;
     694            platformtype2 = PlatformType::STATIC;
    704695            break;
    705696        case 7:
    706             platformtype1 = PLATFORM_HMOVE;
    707             platformtype2 = PLATFORM_HMOVE;
     697            platformtype1 = PlatformType::HMOVE;
     698            platformtype2 = PlatformType::HMOVE;
    708699            break;
    709700        case 8:
    710             platformtype1 = PLATFORM_HMOVE;
    711             platformtype2 = PLATFORM_HMOVE;
     701            platformtype1 = PlatformType::HMOVE;
     702            platformtype2 = PlatformType::HMOVE;
    712703            break;
    713704        case 9:
    714             platformtype1 = PLATFORM_HMOVE;
    715             platformtype2 = PLATFORM_DISAPPEAR;
     705            platformtype1 = PlatformType::HMOVE;
     706            platformtype2 = PlatformType::DISAPPEAR;
    716707            break;
    717708        case 10:
    718             platformtype1 = PLATFORM_HMOVE;
    719             platformtype2 = PLATFORM_VMOVE;
     709            platformtype1 = PlatformType::HMOVE;
     710            platformtype2 = PlatformType::VMOVE;
    720711            break;
    721712        case 11:
    722             platformtype1 = PLATFORM_HMOVE;
    723             platformtype2 = PLATFORM_TIMER;
     713            platformtype1 = PlatformType::HMOVE;
     714            platformtype2 = PlatformType::TIMER;
    724715            break;
    725716        case 12:
    726             platformtype1 = PLATFORM_DISAPPEAR;
    727             platformtype2 = PLATFORM_STATIC;
     717            platformtype1 = PlatformType::DISAPPEAR;
     718            platformtype2 = PlatformType::STATIC;
    728719            break;
    729720        case 13:
    730             platformtype1 = PLATFORM_DISAPPEAR;
    731             platformtype2 = PLATFORM_HMOVE;
     721            platformtype1 = PlatformType::DISAPPEAR;
     722            platformtype2 = PlatformType::HMOVE;
    732723            break;
    733724        case 14:
    734             platformtype1 = PLATFORM_DISAPPEAR;
    735             platformtype2 = PLATFORM_DISAPPEAR;
     725            platformtype1 = PlatformType::DISAPPEAR;
     726            platformtype2 = PlatformType::DISAPPEAR;
    736727            break;
    737728        case 15:
    738             platformtype1 = PLATFORM_DISAPPEAR;
    739             platformtype2 = PLATFORM_DISAPPEAR;
     729            platformtype1 = PlatformType::DISAPPEAR;
     730            platformtype2 = PlatformType::DISAPPEAR;
    740731            break;
    741732        case 16:
    742             platformtype1 = PLATFORM_DISAPPEAR;
    743             platformtype2 = PLATFORM_VMOVE;
     733            platformtype1 = PlatformType::DISAPPEAR;
     734            platformtype2 = PlatformType::VMOVE;
    744735            break;
    745736        case 17:
    746             platformtype1 = PLATFORM_DISAPPEAR;
    747             platformtype2 = PLATFORM_TIMER;
     737            platformtype1 = PlatformType::DISAPPEAR;
     738            platformtype2 = PlatformType::TIMER;
    748739            break;
    749740        case 18:
    750             platformtype1 = PLATFORM_VMOVE;
    751             platformtype2 = PLATFORM_STATIC;
     741            platformtype1 = PlatformType::VMOVE;
     742            platformtype2 = PlatformType::STATIC;
    752743            break;
    753744        case 19:
    754             platformtype1 = PLATFORM_VMOVE;
    755             platformtype2 = PLATFORM_HMOVE;
     745            platformtype1 = PlatformType::VMOVE;
     746            platformtype2 = PlatformType::HMOVE;
    756747            break;
    757748        case 20:
    758             platformtype1 = PLATFORM_VMOVE;
    759             platformtype2 = PLATFORM_DISAPPEAR;
     749            platformtype1 = PlatformType::VMOVE;
     750            platformtype2 = PlatformType::DISAPPEAR;
    760751            break;
    761752        case 21:
    762             platformtype1 = PLATFORM_VMOVE;
    763             platformtype2 = PLATFORM_VMOVE;
     753            platformtype1 = PlatformType::VMOVE;
     754            platformtype2 = PlatformType::VMOVE;
    764755            break;
    765756        case 22:
    766             platformtype1 = PLATFORM_VMOVE;
    767             platformtype2 = PLATFORM_VMOVE;
     757            platformtype1 = PlatformType::VMOVE;
     758            platformtype2 = PlatformType::VMOVE;
    768759            break;
    769760        case 23:
    770             platformtype1 = PLATFORM_VMOVE;
    771             platformtype2 = PLATFORM_TIMER;
     761            platformtype1 = PlatformType::VMOVE;
     762            platformtype2 = PlatformType::TIMER;
    772763            break;
    773764        case 24:
    774             platformtype1 = PLATFORM_TIMER;
    775             platformtype2 = PLATFORM_STATIC;
     765            platformtype1 = PlatformType::TIMER;
     766            platformtype2 = PlatformType::STATIC;
    776767            break;
    777768        case 25:
    778             platformtype1 = PLATFORM_TIMER;
    779             platformtype2 = PLATFORM_HMOVE;
     769            platformtype1 = PlatformType::TIMER;
     770            platformtype2 = PlatformType::HMOVE;
    780771            break;
    781772        case 26:
    782             platformtype1 = PLATFORM_TIMER;
    783             platformtype2 = PLATFORM_DISAPPEAR;
     773            platformtype1 = PlatformType::TIMER;
     774            platformtype2 = PlatformType::DISAPPEAR;
    784775            break;
    785776        case 27:
    786             platformtype1 = PLATFORM_TIMER;
    787             platformtype2 = PLATFORM_VMOVE;
     777            platformtype1 = PlatformType::TIMER;
     778            platformtype2 = PlatformType::VMOVE;
    788779            break;
    789780        case 28:
    790             platformtype1 = PLATFORM_TIMER;
    791             platformtype2 = PLATFORM_TIMER;
     781            platformtype1 = PlatformType::TIMER;
     782            platformtype2 = PlatformType::TIMER;
    792783            break;
    793784        default:
    794             platformtype1 = PLATFORM_TIMER;
    795             platformtype2 = PLATFORM_TIMER;
     785            platformtype1 = PlatformType::TIMER;
     786            platformtype2 = PlatformType::TIMER;
    796787            break;
    797788        }
     
    816807        if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0)
    817808        {
    818             matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    819             matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
     809            matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
     810            matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
    820811        }
    821812
     
    825816            if (rand()%2 == 0)
    826817            {
    827                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    828             }
    829             else
    830             {
    831                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
     818                matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
     819            }
     820            else
     821            {
     822                matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
    832823            }
    833824        }
     
    836827            if (rand()%2 == 0)
    837828            {
    838                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    839             }
    840             else
    841             {
    842                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
     829                matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
     830            }
     831            else
     832            {
     833                matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
    843834            }
    844835            if (rand()%2 == 0)
    845836            {
    846                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    847             }
    848             else
    849             {
    850                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
     837                matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
     838            }
     839            else
     840            {
     841                matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
    851842            }
    852843        }
     
    855846            if (rand()%2 == 0)
    856847            {
    857                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    858             }
    859             else
    860             {
    861                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
     848                matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
     849            }
     850            else
     851            {
     852                matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
    862853            }
    863854            if (rand()%2 == 0)
    864855            {
    865                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    866             }
    867             else
    868             {
    869                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
     856                matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
     857            }
     858            else
     859            {
     860                matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
    870861            }
    871862            if (rand()%2 == 0)
    872863            {
    873                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    874             }
    875             else
    876             {
    877                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
     864                matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY;
     865            }
     866            else
     867            {
     868                matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE;
    878869            }
    879870        }
     
    898889                    switch(matrix[i][j].type)
    899890                    {
    900                     case PLATFORM_EMPTY:
     891                    case PlatformType::EMPTY:
    901892                        matrix[i][j].done = true;
    902893                        break;
    903                     case PLATFORM_STATIC:
     894                    case PlatformType::STATIC:
    904895                        xPosition = randomXPosition(numJ, j);
    905896                        zPosition = sectionBegin + i*sectionLength/numI;
     
    907898                        matrix[i][j].done = true;
    908899                        break;
    909                     case PLATFORM_FAKE:
     900                    case PlatformType::FAKE:
    910901                        xPosition = randomXPosition(numJ, j);
    911902                        zPosition = sectionBegin + i*sectionLength/numI;
     
    913904                        matrix[i][j].done = true;
    914905                        break;
    915                     case PLATFORM_TIMER:
     906                    case PlatformType::TIMER:
    916907                        xPosition = randomXPosition(numJ, j);
    917908                        zPosition = sectionBegin + i*sectionLength/numI;
     
    919910                        matrix[i][j].done = true;
    920911                        break;
    921                     case PLATFORM_DISAPPEAR:
     912                    case PlatformType::DISAPPEAR:
    922913                        xPosition = randomXPosition(numJ, j);
    923914                        zPosition = sectionBegin + i*sectionLength/numI;
     
    925916                        matrix[i][j].done = true;
    926917                        break;
    927                     case PLATFORM_HMOVE:
     918                    case PlatformType::HMOVE:
    928919                        xVelocity = randomSpeed();
    929                         if (j <= numJ-3 && matrix[i][j+1].type == PLATFORM_HMOVE && matrix[i][j+2].type == PLATFORM_HMOVE && rand()%2 == 0)
     920                        if (j <= numJ-3 && matrix[i][j+1].type == PlatformType::HMOVE && matrix[i][j+2].type == PlatformType::HMOVE && rand()%2 == 0)
    930921                        {
    931922                            leftBoundary = randomXPositionLeft(numJ, j);
     
    938929                            matrix[i][j+2].done = true;
    939930                        }
    940                         else if (j <= numJ-2 && matrix[i][j+1].type == PLATFORM_HMOVE && rand()%2 == 0)
     931                        else if (j <= numJ-2 && matrix[i][j+1].type == PlatformType::HMOVE && rand()%2 == 0)
    941932                        {
    942933                            leftBoundary = randomXPositionLeft(numJ, j);
     
    958949                        }
    959950                        break;
    960                     case PLATFORM_VMOVE:
     951                    case PlatformType::VMOVE:
    961952                        zVelocity = randomSpeed();
    962                         if (i <= numI-3 && matrix[i+1][j].type == PLATFORM_VMOVE && matrix[i+2][j].type == PLATFORM_VMOVE && rand()%2 == 0)
     953                        if (i <= numI-3 && matrix[i+1][j].type == PlatformType::VMOVE && matrix[i+2][j].type == PlatformType::VMOVE && rand()%2 == 0)
    963954                        {
    964955                            lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
     
    971962                            matrix[i+2][j].done = true;
    972963                        }
    973                         else if (i <= numI-2 && matrix[i+1][j].type == PLATFORM_VMOVE && rand()%2 == 0)
     964                        else if (i <= numI-2 && matrix[i+1][j].type == PlatformType::VMOVE && rand()%2 == 0)
    974965                        {
    975966                            lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
     
    10091000                switch (itemType)
    10101001                {
    1011                 case ITEM_ROCKET:
     1002                case ItemType::ROCKET:
    10121003                    addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10131004                    break;
    1014                 case ITEM_PROPELLER:
     1005                case ItemType::PROPELLER:
    10151006                    addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10161007                    break;
    1017                 case ITEM_BOOTS:
     1008                case ItemType::BOOTS:
    10181009                    addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10191010                    break;
    1020                 case ITEM_SHIELD:
     1011                case ItemType::SHIELD:
    10211012                    addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10221013                    break;
     
    10291020                switch (itemType)
    10301021                {
    1031                 case ITEM_ROCKET:
     1022                case ItemType::ROCKET:
    10321023                    addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10331024                    break;
    1034                 case ITEM_PROPELLER:
     1025                case ItemType::PROPELLER:
    10351026                    addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10361027                    break;
    1037                 case ITEM_BOOTS:
     1028                case ItemType::BOOTS:
    10381029                    addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10391030                    break;
    1040                 case ITEM_SHIELD:
     1031                case ItemType::SHIELD:
    10411032                    addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10421033                    break;
     
    10541045                switch (itemType)
    10551046                {
    1056                 case ITEM_SPRING:
     1047                case ItemType::SPRING:
    10571048                    addSpring(itemPlatform);
    10581049                    break;
    1059                 case ITEM_ROCKET:
     1050                case ItemType::ROCKET:
    10601051                    addRocket(itemPlatform);
    10611052                    break;
    1062                 case ITEM_PROPELLER:
     1053                case ItemType::PROPELLER:
    10631054                    addPropeller(itemPlatform);
    10641055                    break;
    1065                 case ITEM_BOOTS:
     1056                case ItemType::BOOTS:
    10661057                    addBoots(itemPlatform);
    10671058                    break;
    1068                 case ITEM_SHIELD:
     1059                case ItemType::SHIELD:
    10691060                    addShield(itemPlatform);
    10701061                    break;
     
    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.