Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 8, 2015, 10:18:05 PM (9 years ago)
Author:
landauf
Message:

fixed bug which was introduced in r10563: when unloading in client mode, the Level object was not destroyed because it was still referenced by MeshLodInformation instances (which are not Synchronizables). Now the level is unloaded correctly even in client mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/orxonox/gamestates/GSLevel.cc

    r10566 r10569  
    4747
    4848#include "LevelManager.h"
     49#include "Level.h"
    4950#include "PlayerManager.h"
    5051#include "GSRoot.h"
     
    214215    void GSLevel::unloadLevelAsClient()
    215216    {
    216         ObjectList<Synchronisable>::iterator it;
    217         for(it = ObjectList<Synchronisable>::begin(); it; )
    218         {
    219             if( it->getSyncMode() != 0x0 )
     217        for (ObjectList<Level>::iterator it = ObjectList<Level>::begin(); it != ObjectList<Level>::end(); )
     218        {
     219            StrongPtr<Level> level = *(it++); // StrongPtr prevents that the Level gets destroyed while we loop over it
     220            for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(level); it != ObjectList<BaseObject>::end(level); )
     221                (it++)->destroy();
     222        }
     223
     224        for (ObjectList<Synchronisable>::iterator it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); )
     225        {
     226            if (it->getSyncMode() != 0x0)
    220227                (it++)->destroy();
    221228            else
    222             {
    223229                ++it;
    224             }
    225230        }
    226231    }
Note: See TracChangeset for help on using the changeset viewer.