Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 6:41:22 PM (8 years ago)
Author:
landauf
Message:

merged remaining commits from cpp11_v2 to cpp11_v3 (for some reason they were not merged in the first attempt)

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

    r11054 r11068  
    610610        const int numJ = 4;
    611611
    612         enum PlatformType
    613         {
    614             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
    615615        };
    616616
    617         enum ItemType
    618         {
    619             ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD
     617        enum class ItemType
     618        {
     619            NOTHING, SPRING, PROPELLER, ROCKET, BOOTS, SHIELD
    620620        };
    621621
     
    631631            for (int j = 0; j < numJ; ++j)
    632632            {
    633                 matrix[i][j].type = PLATFORM_EMPTY;
     633                matrix[i][j].type = PlatformType::EMPTY;
    634634                matrix[i][j].done = false;
    635635            }
     
    637637        PlatformType platformtype1;
    638638        PlatformType platformtype2;
    639         ItemType itemType = ITEM_NOTHING;
     639        ItemType itemType = ItemType::NOTHING;
    640640
    641641        if (rand()%2 == 0)
    642642        {
    643             itemType = ITEM_SPRING;
     643            itemType = ItemType::SPRING;
    644644        }
    645645        else if (rand()%2 == 0 && sectionNumber_ > 3)
     
    648648            {
    649649            case 0:
    650                 itemType = ITEM_PROPELLER;
     650                itemType = ItemType::PROPELLER;
    651651                break;
    652652            case 1:
    653                 itemType = ITEM_ROCKET;
     653                itemType = ItemType::ROCKET;
    654654                break;
    655655            case 2:
    656                 itemType = ITEM_BOOTS;
     656                itemType = ItemType::BOOTS;
    657657                break;
    658658            case 3:
    659                 itemType = ITEM_SHIELD;
     659                itemType = ItemType::SHIELD;
    660660                break;
    661661            default:
     
    667667        {
    668668        case 0:
    669             platformtype1 = PLATFORM_STATIC;
    670             platformtype2 = PLATFORM_STATIC;
     669            platformtype1 = PlatformType::STATIC;
     670            platformtype2 = PlatformType::STATIC;
    671671            break;
    672672        case 1:
    673             platformtype1 = PLATFORM_STATIC;
    674             platformtype2 = PLATFORM_STATIC;
     673            platformtype1 = PlatformType::STATIC;
     674            platformtype2 = PlatformType::STATIC;
    675675            break;
    676676        case 2:
    677             platformtype1 = PLATFORM_STATIC;
    678             platformtype2 = PLATFORM_HMOVE;
     677            platformtype1 = PlatformType::STATIC;
     678            platformtype2 = PlatformType::HMOVE;
    679679            break;
    680680        case 3:
    681             platformtype1 = PLATFORM_STATIC;
    682             platformtype2 = PLATFORM_DISAPPEAR;
     681            platformtype1 = PlatformType::STATIC;
     682            platformtype2 = PlatformType::DISAPPEAR;
    683683            break;
    684684        case 4:
    685             platformtype1 = PLATFORM_STATIC;
    686             platformtype2 = PLATFORM_VMOVE;
     685            platformtype1 = PlatformType::STATIC;
     686            platformtype2 = PlatformType::VMOVE;
    687687            break;
    688688        case 5:
    689             platformtype1 = PLATFORM_STATIC;
    690             platformtype2 = PLATFORM_TIMER;
     689            platformtype1 = PlatformType::STATIC;
     690            platformtype2 = PlatformType::TIMER;
    691691            break;
    692692        case 6:
    693             platformtype1 = PLATFORM_HMOVE;
    694             platformtype2 = PLATFORM_STATIC;
     693            platformtype1 = PlatformType::HMOVE;
     694            platformtype2 = PlatformType::STATIC;
    695695            break;
    696696        case 7:
    697             platformtype1 = PLATFORM_HMOVE;
    698             platformtype2 = PLATFORM_HMOVE;
     697            platformtype1 = PlatformType::HMOVE;
     698            platformtype2 = PlatformType::HMOVE;
    699699            break;
    700700        case 8:
    701             platformtype1 = PLATFORM_HMOVE;
    702             platformtype2 = PLATFORM_HMOVE;
     701            platformtype1 = PlatformType::HMOVE;
     702            platformtype2 = PlatformType::HMOVE;
    703703            break;
    704704        case 9:
    705             platformtype1 = PLATFORM_HMOVE;
    706             platformtype2 = PLATFORM_DISAPPEAR;
     705            platformtype1 = PlatformType::HMOVE;
     706            platformtype2 = PlatformType::DISAPPEAR;
    707707            break;
    708708        case 10:
    709             platformtype1 = PLATFORM_HMOVE;
    710             platformtype2 = PLATFORM_VMOVE;
     709            platformtype1 = PlatformType::HMOVE;
     710            platformtype2 = PlatformType::VMOVE;
    711711            break;
    712712        case 11:
    713             platformtype1 = PLATFORM_HMOVE;
    714             platformtype2 = PLATFORM_TIMER;
     713            platformtype1 = PlatformType::HMOVE;
     714            platformtype2 = PlatformType::TIMER;
    715715            break;
    716716        case 12:
    717             platformtype1 = PLATFORM_DISAPPEAR;
    718             platformtype2 = PLATFORM_STATIC;
     717            platformtype1 = PlatformType::DISAPPEAR;
     718            platformtype2 = PlatformType::STATIC;
    719719            break;
    720720        case 13:
    721             platformtype1 = PLATFORM_DISAPPEAR;
    722             platformtype2 = PLATFORM_HMOVE;
     721            platformtype1 = PlatformType::DISAPPEAR;
     722            platformtype2 = PlatformType::HMOVE;
    723723            break;
    724724        case 14:
    725             platformtype1 = PLATFORM_DISAPPEAR;
    726             platformtype2 = PLATFORM_DISAPPEAR;
     725            platformtype1 = PlatformType::DISAPPEAR;
     726            platformtype2 = PlatformType::DISAPPEAR;
    727727            break;
    728728        case 15:
    729             platformtype1 = PLATFORM_DISAPPEAR;
    730             platformtype2 = PLATFORM_DISAPPEAR;
     729            platformtype1 = PlatformType::DISAPPEAR;
     730            platformtype2 = PlatformType::DISAPPEAR;
    731731            break;
    732732        case 16:
    733             platformtype1 = PLATFORM_DISAPPEAR;
    734             platformtype2 = PLATFORM_VMOVE;
     733            platformtype1 = PlatformType::DISAPPEAR;
     734            platformtype2 = PlatformType::VMOVE;
    735735            break;
    736736        case 17:
    737             platformtype1 = PLATFORM_DISAPPEAR;
    738             platformtype2 = PLATFORM_TIMER;
     737            platformtype1 = PlatformType::DISAPPEAR;
     738            platformtype2 = PlatformType::TIMER;
    739739            break;
    740740        case 18:
    741             platformtype1 = PLATFORM_VMOVE;
    742             platformtype2 = PLATFORM_STATIC;
     741            platformtype1 = PlatformType::VMOVE;
     742            platformtype2 = PlatformType::STATIC;
    743743            break;
    744744        case 19:
    745             platformtype1 = PLATFORM_VMOVE;
    746             platformtype2 = PLATFORM_HMOVE;
     745            platformtype1 = PlatformType::VMOVE;
     746            platformtype2 = PlatformType::HMOVE;
    747747            break;
    748748        case 20:
    749             platformtype1 = PLATFORM_VMOVE;
    750             platformtype2 = PLATFORM_DISAPPEAR;
     749            platformtype1 = PlatformType::VMOVE;
     750            platformtype2 = PlatformType::DISAPPEAR;
    751751            break;
    752752        case 21:
    753             platformtype1 = PLATFORM_VMOVE;
    754             platformtype2 = PLATFORM_VMOVE;
     753            platformtype1 = PlatformType::VMOVE;
     754            platformtype2 = PlatformType::VMOVE;
    755755            break;
    756756        case 22:
    757             platformtype1 = PLATFORM_VMOVE;
    758             platformtype2 = PLATFORM_VMOVE;
     757            platformtype1 = PlatformType::VMOVE;
     758            platformtype2 = PlatformType::VMOVE;
    759759            break;
    760760        case 23:
    761             platformtype1 = PLATFORM_VMOVE;
    762             platformtype2 = PLATFORM_TIMER;
     761            platformtype1 = PlatformType::VMOVE;
     762            platformtype2 = PlatformType::TIMER;
    763763            break;
    764764        case 24:
    765             platformtype1 = PLATFORM_TIMER;
    766             platformtype2 = PLATFORM_STATIC;
     765            platformtype1 = PlatformType::TIMER;
     766            platformtype2 = PlatformType::STATIC;
    767767            break;
    768768        case 25:
    769             platformtype1 = PLATFORM_TIMER;
    770             platformtype2 = PLATFORM_HMOVE;
     769            platformtype1 = PlatformType::TIMER;
     770            platformtype2 = PlatformType::HMOVE;
    771771            break;
    772772        case 26:
    773             platformtype1 = PLATFORM_TIMER;
    774             platformtype2 = PLATFORM_DISAPPEAR;
     773            platformtype1 = PlatformType::TIMER;
     774            platformtype2 = PlatformType::DISAPPEAR;
    775775            break;
    776776        case 27:
    777             platformtype1 = PLATFORM_TIMER;
    778             platformtype2 = PLATFORM_VMOVE;
     777            platformtype1 = PlatformType::TIMER;
     778            platformtype2 = PlatformType::VMOVE;
    779779            break;
    780780        case 28:
    781             platformtype1 = PLATFORM_TIMER;
    782             platformtype2 = PLATFORM_TIMER;
     781            platformtype1 = PlatformType::TIMER;
     782            platformtype2 = PlatformType::TIMER;
    783783            break;
    784784        default:
    785             platformtype1 = PLATFORM_TIMER;
    786             platformtype2 = PLATFORM_TIMER;
     785            platformtype1 = PlatformType::TIMER;
     786            platformtype2 = PlatformType::TIMER;
    787787            break;
    788788        }
     
    807807        if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0)
    808808        {
    809             matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    810             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;
    811811        }
    812812
     
    816816            if (rand()%2 == 0)
    817817            {
    818                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    819             }
    820             else
    821             {
    822                 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;
    823823            }
    824824        }
     
    827827            if (rand()%2 == 0)
    828828            {
    829                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    830             }
    831             else
    832             {
    833                 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;
    834834            }
    835835            if (rand()%2 == 0)
    836836            {
    837                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    838             }
    839             else
    840             {
    841                 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;
    842842            }
    843843        }
     
    846846            if (rand()%2 == 0)
    847847            {
    848                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    849             }
    850             else
    851             {
    852                 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;
    853853            }
    854854            if (rand()%2 == 0)
    855855            {
    856                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    857             }
    858             else
    859             {
    860                 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;
    861861            }
    862862            if (rand()%2 == 0)
    863863            {
    864                 matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
    865             }
    866             else
    867             {
    868                 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;
    869869            }
    870870        }
     
    889889                    switch(matrix[i][j].type)
    890890                    {
    891                     case PLATFORM_EMPTY:
     891                    case PlatformType::EMPTY:
    892892                        matrix[i][j].done = true;
    893893                        break;
    894                     case PLATFORM_STATIC:
     894                    case PlatformType::STATIC:
    895895                        xPosition = randomXPosition(numJ, j);
    896896                        zPosition = sectionBegin + i*sectionLength/numI;
     
    898898                        matrix[i][j].done = true;
    899899                        break;
    900                     case PLATFORM_FAKE:
     900                    case PlatformType::FAKE:
    901901                        xPosition = randomXPosition(numJ, j);
    902902                        zPosition = sectionBegin + i*sectionLength/numI;
     
    904904                        matrix[i][j].done = true;
    905905                        break;
    906                     case PLATFORM_TIMER:
     906                    case PlatformType::TIMER:
    907907                        xPosition = randomXPosition(numJ, j);
    908908                        zPosition = sectionBegin + i*sectionLength/numI;
     
    910910                        matrix[i][j].done = true;
    911911                        break;
    912                     case PLATFORM_DISAPPEAR:
     912                    case PlatformType::DISAPPEAR:
    913913                        xPosition = randomXPosition(numJ, j);
    914914                        zPosition = sectionBegin + i*sectionLength/numI;
     
    916916                        matrix[i][j].done = true;
    917917                        break;
    918                     case PLATFORM_HMOVE:
     918                    case PlatformType::HMOVE:
    919919                        xVelocity = randomSpeed();
    920                         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)
    921921                        {
    922922                            leftBoundary = randomXPositionLeft(numJ, j);
     
    929929                            matrix[i][j+2].done = true;
    930930                        }
    931                         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)
    932932                        {
    933933                            leftBoundary = randomXPositionLeft(numJ, j);
     
    949949                        }
    950950                        break;
    951                     case PLATFORM_VMOVE:
     951                    case PlatformType::VMOVE:
    952952                        zVelocity = randomSpeed();
    953                         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)
    954954                        {
    955955                            lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
     
    962962                            matrix[i+2][j].done = true;
    963963                        }
    964                         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)
    965965                        {
    966966                            lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
     
    10001000                switch (itemType)
    10011001                {
    1002                 case ITEM_ROCKET:
     1002                case ItemType::ROCKET:
    10031003                    addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10041004                    break;
    1005                 case ITEM_PROPELLER:
     1005                case ItemType::PROPELLER:
    10061006                    addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10071007                    break;
    1008                 case ITEM_BOOTS:
     1008                case ItemType::BOOTS:
    10091009                    addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10101010                    break;
    1011                 case ITEM_SHIELD:
     1011                case ItemType::SHIELD:
    10121012                    addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
    10131013                    break;
     
    10201020                switch (itemType)
    10211021                {
    1022                 case ITEM_ROCKET:
     1022                case ItemType::ROCKET:
    10231023                    addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10241024                    break;
    1025                 case ITEM_PROPELLER:
     1025                case ItemType::PROPELLER:
    10261026                    addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10271027                    break;
    1028                 case ITEM_BOOTS:
     1028                case ItemType::BOOTS:
    10291029                    addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10301030                    break;
    1031                 case ITEM_SHIELD:
     1031                case ItemType::SHIELD:
    10321032                    addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
    10331033                    break;
     
    10451045                switch (itemType)
    10461046                {
    1047                 case ITEM_SPRING:
     1047                case ItemType::SPRING:
    10481048                    addSpring(itemPlatform);
    10491049                    break;
    1050                 case ITEM_ROCKET:
     1050                case ItemType::ROCKET:
    10511051                    addRocket(itemPlatform);
    10521052                    break;
    1053                 case ITEM_PROPELLER:
     1053                case ItemType::PROPELLER:
    10541054                    addPropeller(itemPlatform);
    10551055                    break;
    1056                 case ITEM_BOOTS:
     1056                case ItemType::BOOTS:
    10571057                    addBoots(itemPlatform);
    10581058                    break;
    1059                 case ITEM_SHIELD:
     1059                case ItemType::SHIELD:
    10601060                    addShield(itemPlatform);
    10611061                    break;
Note: See TracChangeset for help on using the changeset viewer.