Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 28, 2006, 12:48:03 AM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: Resources now get Loaded and Unloaded correctly by will alone

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/loading/resource.cc

    r9850 r9851  
    165165  StorePointer::StorePointer(const std::string& loadString, const KeepLevel& keeplevel)
    166166      : _loadString(loadString), _keepLevel(keeplevel)
    167   {}
    168 
     167  {
     168    PRINTF(4)("Acquired a Resource with LoadString '%s' and KeepLevel '%s'\n", _loadString.c_str(), _keepLevel.name().c_str());
     169  }
     170
     171  StorePointer::~StorePointer()
     172  {
     173    PRINTF(4)("Deleting Stored Resource '%s' from KeepLevel '%s'\n", _loadString.c_str(), _keepLevel.name().c_str());
     174  };
    169175
    170176
     
    234240  void Type::unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel)
    235241  {
    236     std::vector<Resources::StorePointer*>::iterator it;
    237     for (it = this->_storedResources.begin(); it != this->_storedResources.end(); ++it)
    238       if((*it)->keepLevel() < keepLevel && (*it)->last())
    239       {
    240         delete (*it);
    241         this->_storedResources.erase(it);
    242         it = this->_storedResources.begin();
    243       }
     242    std::vector<Resources::StorePointer*>::iterator it, it2;
     243    bool finished = false;
     244
     245    while (!finished)
     246    {
     247      finished = true;
     248      for (it = this->_storedResources.begin(); it != this->_storedResources.end();++it)
     249        if((*it)->keepLevel() < keepLevel && (*it)->last())
     250        {
     251          delete (*it);
     252          this->_storedResources.erase(it);
     253          finished = false;
     254          break;
     255        }
     256    }
    244257  }
    245258
Note: See TracChangeset for help on using the changeset viewer.