Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 27, 2006, 11:13:17 PM (18 years ago)
Author:
bensch
Message:

some more functionality for the unloading of resources

File:
1 edited

Legend:

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

    r9843 r9845  
    137137  //////////////
    138138  Type::Type(const std::string& typeName)
    139       : _id(-1), _typeName(typeName)
     139      : _typeName(typeName)
    140140  {
    141141    ResourceManager::getInstance()->registerType(this);
     
    151151  {
    152152    this->_storedResources.push_back(resource);
    153 
    154153  }
    155154
     
    175174  }
    176175
    177 
    178   void Type::setID(int id)
    179   {
    180     this->_id = id;
     176  void Type::unloadAllBelowKeepLevel(const Resources::KeepLevel& keepLevel)
     177  {
     178    std::vector<Resources::StorePointer*>::iterator it;
     179    for (it = this->_storedResources.begin(); it != this->_storedResources.end(); ++it)
     180      if((*it)->keepLevel() < keepLevel)
     181    {
     182      delete (*it);
     183      this->_storedResources.erase(it);
     184      it = this->_storedResources.begin();
     185    }
    181186  }
    182187
     
    184189  void Type::debug() const
    185190  {
    186     PRINT(0)(" ResourceType '%s' with ID %d stores %d Resources\n", this->_typeName.c_str(), this->_id, this->_storedResources.size());
     191    PRINT(0)(" ResourceType '%s' stores %d Resources\n", this->_typeName.c_str(), this->_storedResources.size());
    187192    PRINT(0)("  Paths:\n");
    188193    for (unsigned int i = 0; i < this->_resourcePaths.size(); ++i)
Note: See TracChangeset for help on using the changeset viewer.