- Timestamp:
- Jan 21, 2006, 2:32:04 PM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/resource_manager.cc
r6641 r6642 79 79 while (!this->imageDirs.empty()) 80 80 { 81 delete[] this->imageDirs. front();82 this->imageDirs.pop_ front();81 delete[] this->imageDirs.back(); 82 this->imageDirs.pop_back(); 83 83 } 84 84 … … 203 203 { 204 204 // check if the Directory has been added before 205 std:: list<char*>::const_iterator imageDir;205 std::vector<char*>::const_iterator imageDir; 206 206 for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++) 207 207 { … … 467 467 else 468 468 { 469 std:: list<char*>::iterator imageDir;469 std::vector<char*>::iterator imageDir; 470 470 for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++) 471 471 { … … 611 611 PRINTF(4)("Resource %s safely removed.\n", resource->name); 612 612 delete[] resource->name; 613 std:: list<Resource*>::iterator resourceIT = std::find(this->resourceList.begin(), this->resourceList.end(), resource);613 std::vector<Resource*>::iterator resourceIT = std::find(this->resourceList.begin(), this->resourceList.end(), resource); 614 614 this->resourceList.erase(resourceIT); 615 615 delete resource; … … 630 630 bool ResourceManager::unloadAllByPriority(ResourcePriority prio) 631 631 { 632 std::list<Resource*>::iterator resource, pre;633 pre = --this->resourceList.end();634 632 unsigned int removeCount; 635 633 for (unsigned int round = 0; round < 3; round++) 636 634 { 635 int index = this->resourceList.size() - 1; 637 636 removeCount = 0; 638 while (pre != resourceList.end()) 639 { 640 resource = pre; 641 pre--; 642 if ((*resource)->prio <= prio) 637 while (index >= 0) 638 { 639 if (this->resourceList[index]->prio <= prio) 643 640 { 644 if ( (*resource)->count == 0)645 unload( (*resource), prio);641 if (this->resourceList[index]->count == 0) 642 unload(this->resourceList[index], prio); 646 643 else 647 644 { 648 645 PRINTF(2)("unable to unload %s because there are still %d references to it\n", 649 (*resource)->name, (*resource)->count);646 this->resourceList[index]->name, this->resourceList[index]->count); 650 647 removeCount++; 651 648 } 652 649 } 650 index--; 653 651 } 654 652 if (removeCount == 0) break; … … 669 667 void* param1, void* param2, void* param3) const 670 668 { 671 std:: list<Resource*>::const_iterator resource;669 std::vector<Resource*>::const_iterator resource; 672 670 for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++) 673 671 { … … 751 749 { 752 750 // Resource* enumRes = resourceList->enumerate(); 753 std:: list<Resource*>::const_iterator resource;751 std::vector<Resource*>::const_iterator resource; 754 752 for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++) 755 753 if (pointer == (*resource)->pointer) … … 967 965 PRINT(0)(" Data-Directory is: %s\n", this->dataDir); 968 966 PRINT(0)(" List of Image-Directories: "); 969 std:: list<char*>::const_iterator imageDir;967 std::vector<char*>::const_iterator imageDir; 970 968 for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++) 971 969 PRINT(0)("%s ", (*imageDir)); … … 973 971 974 972 PRINT(0)("List of all stored Resources:\n"); 975 std:: list<Resource*>::const_iterator resource;973 std::vector<Resource*>::const_iterator resource; 976 974 for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++) 977 975 -
trunk/src/util/loading/resource_manager.h
r6640 r6642 23 23 24 24 25 #include < list>25 #include <vector> 26 26 27 27 //! An eumerator for different fileTypes the resourceManager supports … … 154 154 155 155 char* dataDir; //!< The Data Directory, where all relevant Data is stored. 156 std::list<Resource*> resourceList; //!< The List of Resources, that has already been loaded. 157 std::list<char*> imageDirs; //!< A list of directories in which images are stored. 156 std::vector<char*> imageDirs; //!< A list of directories in which images are stored. 158 157 158 std::vector<Resource*> resourceList; //!< The List of Resources, that has already been loaded. 159 159 }; 160 160
Note: See TracChangeset
for help on using the changeset viewer.