Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 6, 2015, 2:51:14 PM (8 years ago)
Author:
landauf
Message:

no static functions anymore in ObjectList. you need to instantiate an ObjectList to use it.
this allows for prettier for-loop syntax when iterating over an ObjectList of a specific context: for (T* object : ObjectList<T>(context)) { … }

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/jump/Jump.cc

    r10916 r10920  
    141141        }
    142142
    143         ObjectList<JumpPlatform>::iterator beginPlatform = ObjectList<JumpPlatform>::begin();
    144         ObjectList<JumpPlatform>::iterator endPlatform = ObjectList<JumpPlatform>::end();
    145         ObjectList<JumpPlatform>::iterator itPlatform = beginPlatform;
     143        ObjectList<JumpPlatform> listPlatform;
     144        ObjectList<JumpPlatform>::iterator itPlatform = listPlatform.begin();
    146145        Vector3 platformPosition;
    147146
    148         while (itPlatform != endPlatform)
     147        while (itPlatform != listPlatform.end())
    149148        {
    150149            platformPosition = itPlatform->getPosition();
     
    163162
    164163        // Deleted deactivated platforms
    165         ObjectList<JumpPlatformDisappear>::iterator beginDisappear = ObjectList<JumpPlatformDisappear>::begin();
    166         ObjectList<JumpPlatformDisappear>::iterator endDisappear = ObjectList<JumpPlatformDisappear>::end();
    167         ObjectList<JumpPlatformDisappear>::iterator itDisappear = beginDisappear;
    168 
    169         while (itDisappear != endDisappear)
     164        ObjectList<JumpPlatformDisappear> listDisappear;
     165        ObjectList<JumpPlatformDisappear>::iterator itDisappear = listDisappear.begin();
     166
     167        while (itDisappear != listDisappear.end())
    170168        {
    171169            if (!itDisappear->isActive())
     
    182180        }
    183181
    184         ObjectList<JumpPlatformTimer>::iterator beginTimer = ObjectList<JumpPlatformTimer>::begin();
    185         ObjectList<JumpPlatformTimer>::iterator endTimer = ObjectList<JumpPlatformTimer>::end();
    186         ObjectList<JumpPlatformTimer>::iterator itTimer = beginTimer;
    187 
    188         while (itTimer != endTimer)
     182        ObjectList<JumpPlatformTimer> listTimer;
     183        ObjectList<JumpPlatformTimer>::iterator itTimer = listTimer.begin();
     184
     185        while (itTimer != listTimer.end())
    189186        {
    190187            if (!itTimer->isActive())
     
    201198        }
    202199
    203         ObjectList<JumpProjectile>::iterator beginProjectile = ObjectList<JumpProjectile>::begin();
    204         ObjectList<JumpProjectile>::iterator endProjectile = ObjectList<JumpProjectile>::end();
    205         ObjectList<JumpProjectile>::iterator itProjectile = beginProjectile;
     200        ObjectList<JumpProjectile> listProjectile;
     201        ObjectList<JumpProjectile>::iterator itProjectile = listProjectile.begin();
    206202        Vector3 projectilePosition;
    207203
    208         while (itProjectile != endProjectile)
     204        while (itProjectile != listProjectile.end())
    209205        {
    210206            projectilePosition = itProjectile->getPosition();
     
    222218        }
    223219
    224         ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin();
    225         ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end();
    226         ObjectList<JumpEnemy>::iterator itEnemy = beginEnemy;
     220        ObjectList<JumpEnemy> listEnemy;
     221        ObjectList<JumpEnemy>::iterator itEnemy = listEnemy.begin();
    227222        Vector3 enemyPosition;
    228223
    229         while (itEnemy != endEnemy)
     224        while (itEnemy != listEnemy.end())
    230225        {
    231226            enemyPosition = itEnemy->getPosition();
     
    243238        }
    244239
    245         ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin();
    246         ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end();
    247         ObjectList<JumpItem>::iterator itItem = beginItem;
     240        ObjectList<JumpItem> listItem;
     241        ObjectList<JumpItem>::iterator itItem = listItem.begin();
    248242        Vector3 itemPosition;
    249243
    250         while (itItem != endItem)
     244        while (itItem != listItem.end())
    251245        {
    252246            itemPosition = itItem->getPosition();
Note: See TracChangeset for help on using the changeset viewer.