Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 6, 2015, 2:51:14 PM (9 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)) { … }

Location:
code/branches/cpp11_v2/src/modules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc

    r10919 r10920  
    5959
    6060        virtualCheckPointIndex = -2;
    61         if (ObjectList<SpaceRaceManager>::size() != 1)
    62             orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>::size() << endl;
     61        if (ObjectList<SpaceRaceManager>().size() != 1)
     62            orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>().size() << endl;
    6363        for (SpaceRaceManager* manager : ObjectList<SpaceRaceManager>())
    6464        {
     
    299299        orxout()<<"add VCP at"<<virtualCheckPointPosition.x<<", "<<virtualCheckPointPosition.y<<", "<<virtualCheckPointPosition.z<<endl;
    300300        RaceCheckPoint* newTempRaceCheckPoint;
    301         for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it!= ObjectList<SpaceRaceManager>::end(); ++it)
     301        ObjectList<SpaceRaceManager> list;
     302        for (ObjectList<SpaceRaceManager>::iterator it = list.begin(); it!= list.end(); ++it)
    302303        {
    303304            newTempRaceCheckPoint = new RaceCheckPoint((*it));
     
    488489        std::vector<StaticEntity*> problematicObjects;
    489490
    490         for (ObjectList<StaticEntity>::iterator it = ObjectList<StaticEntity>::begin(); it!= ObjectList<StaticEntity>::end(); ++it)
     491        ObjectList<StaticEntity> list;
     492        for (ObjectList<StaticEntity>::iterator it = list.begin(); it!= list.end(); ++it)
    491493        {
    492494
  • 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();
  • code/branches/cpp11_v2/src/modules/mini4dgame/Mini4Dgame.cc

    r10917 r10920  
    183183    void Mini4Dgame::undoStone()//Vector4 move, const int playerColor)
    184184    {
    185         ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>::begin();
     185        ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin();
    186186        it->undoMove();
    187187    }
     
    191191    {
    192192        Mini4DgamePosition move = Mini4DgamePosition(x,y,z,w);
    193         ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>::begin();
     193        ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin();
    194194        it->makeMove(move);
    195195    }
  • code/branches/cpp11_v2/src/modules/overlays/debugging/DebugPositionText.cc

    r9943 r10920  
    5252        SUPER(DebugPositionText, tick, dt);
    5353       
    54         ObjectList<NewHumanController>::iterator it = ObjectList<NewHumanController>::begin();
     54        ObjectList<NewHumanController>::iterator it = ObjectList<NewHumanController>().begin();
    5555        if (it && it->getControllableEntity() )
    5656        {
Note: See TracChangeset for help on using the changeset viewer.