Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6641 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jan 21, 2006, 3:18:55 AM (19 years ago)
Author:
bensch
Message:

trunk: ResourceManager: caching should work

File:
1 edited

Legend:

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

    r6640 r6641  
    292292  return this->load(fileName, tmpType, prio, param1, param2, param3);
    293293}
     294
     295/**
     296 * caches a Resource
     297 *
     298 * @see load;
     299 *
     300 * This function loads a Resource without applying it to an Object.
     301 * This is for loading purposes, e.g, when the user is loading a Resource
     302 * during the initialisation instead of at Runtime.
     303 */
     304void ResourceManager::cache(const char* fileName, ResourceType type, ResourcePriority prio,
     305             void* param1, void* param2, void* param3)
     306{
     307  assert(fileName != NULL);
     308
     309  // searching if the resource was loaded before.
     310  Resource* tmpResource;
     311  // check if we already loaded this Resource
     312  tmpResource = this->locateResourceByInfo(fileName, type, param1, param2, param3);
     313  // otherwise load it
     314  if (tmpResource == NULL)
     315    tmpResource = this->loadResource(fileName, type, prio, param1, param2, param3);
     316  // return cached pointer.
     317  if (tmpResource != NULL) // if the resource was loaded before.
     318    if(tmpResource->prio < prio)
     319      tmpResource->prio = prio;
     320}
     321
    294322
    295323/**
Note: See TracChangeset for help on using the changeset viewer.