- Timestamp:
- Oct 9, 2005, 1:27:58 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/shader.cc
r5333 r5335 234 234 void Shader::deleteProgram(SHADER_TYPE type) 235 235 { 236 GLint status ;236 GLint status = 0; 237 237 if (type == SHADER_VERTEX && this->vertexShader != 0) 238 238 { -
trunk/src/lib/shell/shell.cc
r5329 r5335 56 56 this->setName("Shell"); 57 57 58 // register the shell at the ShellBuffer59 ShellBuffer::getInstance()->registerShell(this);60 58 // EVENT-Handler subscription of '`' to all States. 61 59 EventHandler::getInstance()->subscribe(this, ES_ALL, SDLK_BACKQUOTE); … … 82 80 83 81 this->rebuildText(); 82 83 // register the shell at the ShellBuffer 84 ShellBuffer::getInstance()->registerShell(this); 84 85 } 85 86 … … 89 90 Shell::~Shell () 90 91 { 92 ShellBuffer::getInstance()->unregisterShell(this); 93 91 94 // delete the displayable Buffers 92 95 for (unsigned int i = 0; i < this->bufferDisplaySize; i++) … … 97 100 // delete the inputLine 98 101 delete this->shellInput; 99 100 ShellBuffer::getInstance()->unregisterShell(this);101 102 } 102 103 … … 158 159 void Shell::setFont(const char* fontFile) 159 160 { 161 // if (!ResourceManager::isInDataDir(fontFile)) 162 // return false; 163 160 164 if (this->fontFile != NULL) 161 165 delete[] this->fontFile; -
trunk/src/orxonox.cc
r5332 r5335 282 282 } 283 283 //! @todo this is a hack and should be loadable 284 char* imageDir = ResourceManager::getInstance()->getFullName("maps /");284 char* imageDir = ResourceManager::getInstance()->getFullName("maps"); 285 285 ResourceManager::getInstance()->addImageDir(imageDir); 286 286 delete[] imageDir; -
trunk/src/util/resource_manager.cc
r5334 r5335 60 60 this->dataDir = NULL; 61 61 this->setDataDir("./"); 62 this->imageDirs = new tList<char> ();63 this->resourceList = new tList<Resource> ();62 this->imageDirs = new tList<char>; 63 this->resourceList = new tList<Resource>; 64 64 } 65 65 … … 105 105 { 106 106 delete[] this->dataDir; 107 this->dataDir = new char[strlen(realDir)+1]; 108 strcpy(this->dataDir, realDir); 107 if (dataDir[strlen(dataDir)-1] == '/' || dataDir[strlen(dataDir)-1] == '\\') 108 { 109 this->dataDir = new char[strlen(realDir)+1]; 110 strcpy(this->dataDir, realDir); 111 } 112 else 113 { 114 this->dataDir = new char[strlen(realDir)+2]; 115 strcpy(this->dataDir, realDir); 116 this->dataDir[strlen(realDir)] = '/'; 117 this->dataDir[strlen(realDir)+1] = '\0'; 118 } 109 119 delete[] realDir; 110 120 return true; … … 147 157 bool ResourceManager::addImageDir(const char* imageDir) 148 158 { 159 if (imageDir == NULL) 160 return false; 161 162 char* newDir; 163 if (imageDir[strlen(imageDir)-1] == '/' || imageDir[strlen(imageDir)-1] == '\\') 164 { 165 newDir = new char[strlen(imageDir)+1]; 166 strcpy(newDir, imageDir); 167 } 168 else 169 { 170 newDir = new char[strlen(imageDir)+2]; 171 strcpy(newDir, imageDir); 172 newDir[strlen(imageDir)] = '/'; 173 newDir[strlen(imageDir)+1] = '\0'; 174 } 149 175 // check if the param is a Directory 150 if (isDir( imageDir))176 if (isDir(newDir)) 151 177 { 152 178 // check if the Directory has been added before … … 155 181 while(tmpDir) 156 182 { 157 if (!strcmp(tmpDir, imageDir))183 if (!strcmp(tmpDir, newDir)) 158 184 { 159 PRINTF(4)("Path %s already loaded\n", imageDir); 185 PRINTF(3)("Path %s already loaded\n", newDir); 186 delete[] newDir; 160 187 delete tmpImageDirs; 161 188 return true; … … 166 193 167 194 // adding the directory to the List 168 tmpDir = new char[strlen(imageDir)+1]; 169 strcpy(tmpDir, imageDir); 170 this->imageDirs->add(tmpDir); 195 this->imageDirs->add(newDir); 171 196 return true; 172 197 } 173 198 else 174 199 { 175 PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", dataDir); 200 PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", newDir); 201 delete[] newDir; 176 202 return false; 177 203 } … … 660 686 directoryName[strlen(directoryName)-1] == '\\') 661 687 { 662 tmpDirName = new char[strlen(directoryName) +1];688 tmpDirName = new char[strlen(directoryName)]; 663 689 strncpy(tmpDirName, directoryName, strlen(directoryName)-1); 664 690 tmpDirName[strlen(directoryName)-1] = '\0'; … … 800 826 char* ResourceManager::getFullName(const char* fileName) 801 827 { 802 if (fileName == NULL )828 if (fileName == NULL || ResourceManager::getInstance()->getDataDir() == NULL) 803 829 return NULL; 804 830 … … 813 839 return NULL; 814 840 } 841 } 842 843 844 /** 845 * checks wether a file is in the DataDir. 846 * @param fileName the File to check if it is in the Data-Dir structure. 847 * @returns true if the file exists, false otherwise 848 */ 849 bool ResourceManager::isInDataDir(const char* fileName) 850 { 851 if (fileName == NULL || ResourceManager::getInstance()->getDataDir() == NULL) 852 return false; 853 854 bool retVal = false; 855 char* checkFile = new char[strlen(ResourceManager::getInstance()->getDataDir()) 856 + strlen(fileName) + 1]; 857 sprintf(checkFile, "%s%s", ResourceManager::getInstance()->getDataDir(), fileName); 858 859 if (ResourceManager::isFile(checkFile) || ResourceManager::isDir(checkFile)) 860 retVal = true; 861 else 862 retVal = false; 863 delete[] checkFile; 864 return retVal; 815 865 } 816 866 -
trunk/src/util/resource_manager.h
r5323 r5335 108 108 109 109 bool checkDataDir(const char* fileInside); 110 110 bool addImageDir(const char* imageDir); 111 111 BaseObject* load(const char* fileName, ResourcePriority prio = RP_NO, 112 112 void* param1 = NULL, void* param2 = NULL, void* param3 = NULL); … … 127 127 static char* homeDirCheck(const char* fileName); 128 128 static char* getFullName(const char* fileName); 129 static bool isInDataDir(const char* fileName); 129 130 130 131 static const char* ResourceTypeToChar(ResourceType type); -
trunk/src/util/track/track_manager.cc
r5313 r5335 900 900 * @param count The count of Paths to join. 901 901 * @param trackIDs an Array with the trackID's to join 902 903 \see void TrackManager::join(unsigned int count, ...)902 * 903 * @see void TrackManager::join(unsigned int count, ...) 904 904 */ 905 905 void TrackManager::joinV(unsigned int count, int* trackIDs)
Note: See TracChangeset
for help on using the changeset viewer.