Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5308 in orxonox.OLD for trunk/src/util/resource_manager.cc


Ignore:
Timestamp:
Oct 8, 2005, 12:32:52 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Fixed a reversive BUG in the ResourceManager:
Since resources, that depend on each other are loaded left tgo right they must be unlinked right to left… this cost me 3 hours.
What a luck i found this :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/resource_manager.cc

    r5307 r5308  
    251251    {
    252252      PRINTF(4)("not loading cached resource %s\n", tmpResource->name);
    253 //      printf("adding %s count: %d\n", tmpResource->pointer->getName(),  tmpResource->count);
    254253      tmpResource->count++;
    255254      if(tmpResource->prio < prio)
     
    409408    }
    410409  else
    411     unload(tmpResource, prio);
     410    return unload(tmpResource, prio);
    412411}
    413412
     
    416415 * @param resource: The resource to unloade
    417416 * @param prio the PriorityLevel to unload this resource
     417 * @returns true on success, false otherwise.
    418418*/
    419419bool ResourceManager::unload(Resource* resource, ResourcePriority prio)
     
    421421  if (resource == NULL)
    422422    return false;
    423 //  printf("removing %s count: %d\n", resource->pointer->getName(),  resource->count);
    424423  if (resource->count > 0)
    425424    resource->count--;
     
    427426  if (resource->prio <= prio)
    428427    {
    429       if (resource->count <= 0)
     428      if (resource->count == 0)
    430429        {
    431430          // deleting the Resource
     
    480479
    481480/**
    482  *  unloads all alocated Memory of Resources with a pririty lower than prio
     481 * unloads all alocated Memory of Resources with a pririty lower than prio
    483482 * @param prio The priority to delete
    484483*/
     
    486485{
    487486  tIterator<Resource>* iterator = resourceList->getIterator();
    488   Resource* enumRes = iterator->firstElement();
     487  Resource* enumRes = iterator->lastElement();
    489488  while (enumRes)
    490489    {
     
    496495                   enumRes->name, enumRes->count);
    497496      //enumRes = resourceList->nextElement();
    498       enumRes = iterator->nextElement();
     497      enumRes = iterator->prevElement();
    499498    }
    500499  delete iterator;
Note: See TracChangeset for help on using the changeset viewer.