[1853] | 1 | /* |
---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[3655] | 12 | main-programmer: Benjamin Grauer |
---|
[3672] | 13 | co-programmer: Patrick Boenzli |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3655] | 16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD |
---|
[1853] | 17 | |
---|
[3655] | 18 | #include "resource_manager.h" |
---|
[1853] | 19 | |
---|
[3655] | 20 | // different resource Types |
---|
| 21 | #include "objModel.h" |
---|
[3657] | 22 | #include "primitive_model.h" |
---|
[3655] | 23 | #include "texture.h" |
---|
[1853] | 24 | |
---|
[3658] | 25 | #include "list.h" |
---|
| 26 | |
---|
[3655] | 27 | // File Handling Includes |
---|
| 28 | #include <sys/types.h> |
---|
| 29 | #include <sys/stat.h> |
---|
| 30 | #include <unistd.h> |
---|
| 31 | |
---|
[1856] | 32 | using namespace std; |
---|
[1853] | 33 | |
---|
[3245] | 34 | /** |
---|
| 35 | \brief standard constructor |
---|
| 36 | */ |
---|
[3655] | 37 | ResourceManager::ResourceManager () |
---|
[3365] | 38 | { |
---|
[3655] | 39 | this->setClassName ("ResourceManager"); |
---|
[3672] | 40 | this->dataDir = "./"; |
---|
| 41 | this->imageDirs = new tList<char>(); |
---|
| 42 | this->resourceList = new tList<Resource>(); |
---|
[3365] | 43 | } |
---|
[1853] | 44 | |
---|
[3660] | 45 | /** |
---|
| 46 | \returns the Instance to this ResourceManager |
---|
| 47 | */ |
---|
[3655] | 48 | ResourceManager* ResourceManager::getInstance(void) |
---|
| 49 | { |
---|
| 50 | if (!ResourceManager::singletonRef) |
---|
| 51 | ResourceManager::singletonRef = new ResourceManager(); |
---|
| 52 | return ResourceManager::singletonRef; |
---|
| 53 | } |
---|
[1853] | 54 | |
---|
[3658] | 55 | //! Singleton Reference to the ResourceManager |
---|
[3655] | 56 | ResourceManager* ResourceManager::singletonRef = NULL; |
---|
| 57 | |
---|
[3245] | 58 | /** |
---|
[3660] | 59 | \brief standard destructor |
---|
[3655] | 60 | */ |
---|
| 61 | ResourceManager::~ResourceManager (void) |
---|
| 62 | { |
---|
[3660] | 63 | // deleting the Resources-List |
---|
[3672] | 64 | this->unloadAllByPriority(RP_GAME); |
---|
| 65 | delete this->resourceList; |
---|
[3660] | 66 | // deleting the Directorie Lists |
---|
[3672] | 67 | tIterator<char>* tmpIt = imageDirs->getIterator(); |
---|
| 68 | char* tmpDir = tmpIt->nextElement(); |
---|
[3660] | 69 | while(tmpDir) |
---|
| 70 | { |
---|
| 71 | delete []tmpDir; |
---|
[3672] | 72 | tmpDir = tmpIt->nextElement(); |
---|
[3660] | 73 | } |
---|
[3672] | 74 | delete tmpIt; |
---|
[3660] | 75 | |
---|
[3672] | 76 | delete this->imageDirs; |
---|
| 77 | |
---|
[3655] | 78 | ResourceManager::singletonRef = NULL; |
---|
| 79 | } |
---|
[1853] | 80 | |
---|
[3655] | 81 | /** |
---|
| 82 | \brief sets the data main directory |
---|
| 83 | \param dataDir the DataDirectory. |
---|
[3245] | 84 | */ |
---|
[3655] | 85 | bool ResourceManager::setDataDir(char* dataDir) |
---|
[3543] | 86 | { |
---|
[3655] | 87 | if (isDir(dataDir)) |
---|
| 88 | { |
---|
[3672] | 89 | this->dataDir = new char[strlen(dataDir)+1]; |
---|
| 90 | strcpy(this->dataDir, dataDir); |
---|
[3655] | 91 | } |
---|
| 92 | else |
---|
| 93 | { |
---|
| 94 | PRINTF(1)("%s is not a Directory, and can not be the Data Directory\n", dataDir); |
---|
| 95 | } |
---|
[3543] | 96 | } |
---|
[1853] | 97 | |
---|
[3660] | 98 | /** |
---|
| 99 | \brief adds a new Path for Images |
---|
| 100 | \param imageDir The path to insert |
---|
| 101 | \returns true, if the Path was well and injected (or already existent within the list) |
---|
| 102 | false otherwise |
---|
| 103 | */ |
---|
[3658] | 104 | bool ResourceManager::addImageDir(char* imageDir) |
---|
| 105 | { |
---|
[3660] | 106 | // check if the param is a Directory |
---|
[3658] | 107 | if (isDir(imageDir)) |
---|
| 108 | { |
---|
[3660] | 109 | // check if the Directory has been added before |
---|
[3672] | 110 | tIterator<char>* tmpImageDirs = imageDirs->getIterator(); |
---|
| 111 | char* tmpDir = tmpImageDirs->nextElement(); |
---|
[3660] | 112 | while(tmpDir) |
---|
| 113 | { |
---|
| 114 | if (!strcmp(tmpDir, imageDir)) |
---|
| 115 | { |
---|
| 116 | PRINTF(4)("Path %s already loaded\n", imageDir); |
---|
[3672] | 117 | delete tmpImageDirs; |
---|
[3660] | 118 | return true; |
---|
| 119 | } |
---|
[3672] | 120 | tmpDir = tmpImageDirs->nextElement(); |
---|
[3660] | 121 | } |
---|
[3672] | 122 | delete tmpImageDirs; |
---|
| 123 | |
---|
[3660] | 124 | // adding the directory to the List |
---|
| 125 | tmpDir = new char[strlen(imageDir)+1]; |
---|
[3658] | 126 | strcpy(tmpDir, imageDir); |
---|
[3672] | 127 | this->imageDirs->add(tmpDir); |
---|
[3660] | 128 | return true; |
---|
[3658] | 129 | } |
---|
| 130 | else |
---|
| 131 | { |
---|
| 132 | PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", dataDir); |
---|
[3660] | 133 | return false; |
---|
[3658] | 134 | } |
---|
| 135 | } |
---|
| 136 | |
---|
[3245] | 137 | /** |
---|
[3655] | 138 | \brief loads resources |
---|
| 139 | \param fileName The fileName of the resource to load |
---|
[3660] | 140 | \param prio The ResourcePriority of this resource (will only be increased) |
---|
[3655] | 141 | \returns a pointer to a desired Resource. |
---|
| 142 | */ |
---|
[3660] | 143 | void* ResourceManager::load(const char* fileName, ResourcePriority prio) |
---|
[3655] | 144 | { |
---|
| 145 | ResourceType tmpType; |
---|
| 146 | if (!strncmp(fileName+(strlen(fileName)-4), ".obj", 4)) |
---|
| 147 | tmpType = OBJ; |
---|
[3658] | 148 | else if (!strncmp(fileName+(strlen(fileName)-4), ".wav", 4)) |
---|
| 149 | tmpType = WAV; |
---|
| 150 | else if (!strncmp(fileName+(strlen(fileName)-4), ".mp3", 4)) |
---|
| 151 | tmpType = MP3; |
---|
| 152 | else if (!strncmp(fileName+(strlen(fileName)-4), ".ogg", 4)) |
---|
| 153 | tmpType = OGG; |
---|
| 154 | else if (!strcmp(fileName, "cube") || |
---|
| 155 | !strcmp(fileName, "sphere") || |
---|
| 156 | !strcmp(fileName, "plane") || |
---|
| 157 | !strcmp(fileName, "cylinder") || |
---|
| 158 | !strcmp(fileName, "cone")) |
---|
| 159 | tmpType = PRIM; |
---|
| 160 | else |
---|
| 161 | tmpType = IMAGE; |
---|
[3245] | 162 | |
---|
[3672] | 163 | return this->load(fileName, tmpType, prio); |
---|
[3655] | 164 | } |
---|
| 165 | |
---|
| 166 | /** |
---|
| 167 | \brief loads resources |
---|
| 168 | \param fileName The fileName of the resource to load |
---|
| 169 | \param type The Type of Resource to load (\see ResourceType) |
---|
[3660] | 170 | \param prio The ResourcePriority of this resource (will only be increased) |
---|
[3655] | 171 | \returns a pointer to a desired Resource. |
---|
[3245] | 172 | */ |
---|
[3660] | 173 | void* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio) |
---|
[3655] | 174 | { |
---|
[3658] | 175 | // searching if the resource was loaded before. |
---|
[3672] | 176 | Resource* tmpResource = this->locateResourceByName(fileName); |
---|
[3677] | 177 | if (tmpResource) // if the resource was not loaded before. |
---|
[3655] | 178 | { |
---|
[3677] | 179 | PRINTF(4)("not loading cached resource %s\n", tmpResource->name); |
---|
| 180 | tmpResource->count++; |
---|
| 181 | if(tmpResource->prio < prio) |
---|
| 182 | tmpResource->prio = prio; |
---|
| 183 | } |
---|
| 184 | else |
---|
| 185 | { |
---|
[3660] | 186 | char* tmpDir; |
---|
[3658] | 187 | // Setting up the new Resource |
---|
| 188 | tmpResource = new Resource; |
---|
| 189 | tmpResource->count = 1; |
---|
| 190 | tmpResource->type = type; |
---|
[3660] | 191 | tmpResource->prio = prio; |
---|
[3658] | 192 | tmpResource->name = new char[strlen(fileName)+1]; |
---|
| 193 | strcpy(tmpResource->name, fileName); |
---|
| 194 | |
---|
| 195 | // creating the full name. (directoryName + FileName) |
---|
| 196 | char* fullName = new char[strlen(dataDir)+strlen(fileName)+1]; |
---|
[3672] | 197 | sprintf(fullName, "%s%s", this->dataDir, fileName); |
---|
[3658] | 198 | |
---|
| 199 | // Checking for the type of resource \see ResourceType |
---|
| 200 | switch(type) |
---|
[3655] | 201 | { |
---|
[3658] | 202 | case OBJ: |
---|
| 203 | if(isFile(fullName)) |
---|
| 204 | tmpResource->pointer = new OBJModel(fullName); |
---|
| 205 | else |
---|
| 206 | { |
---|
| 207 | PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", fullName); |
---|
| 208 | tmpResource->pointer = ResourceManager::load("cube", PRIM); |
---|
| 209 | } |
---|
| 210 | break; |
---|
| 211 | case PRIM: |
---|
| 212 | if (!strcmp(tmpResource->name, "cube")) |
---|
| 213 | tmpResource->pointer = new PrimitiveModel(CUBE); |
---|
| 214 | else if (!strcmp(tmpResource->name, "sphere")) |
---|
| 215 | tmpResource->pointer = new PrimitiveModel(SPHERE); |
---|
| 216 | else if (!strcmp(tmpResource->name, "plane")) |
---|
| 217 | tmpResource->pointer = new PrimitiveModel(PLANE); |
---|
| 218 | else if (!strcmp(tmpResource->name, "cylinder")) |
---|
| 219 | tmpResource->pointer = new PrimitiveModel(CYLINDER); |
---|
| 220 | else if (!strcmp(tmpResource->name, "cone")) |
---|
| 221 | tmpResource->pointer = new PrimitiveModel(CONE); |
---|
| 222 | break; |
---|
| 223 | case IMAGE: |
---|
| 224 | if(isFile(fullName)) |
---|
| 225 | { |
---|
[3676] | 226 | PRINTF(4)("Image %s resides to %s\n", fileName, fullName); |
---|
[3658] | 227 | tmpResource->pointer = new Texture(fullName); |
---|
| 228 | } |
---|
| 229 | else |
---|
| 230 | { |
---|
[3667] | 231 | tIterator<char>* iterator = imageDirs->getIterator(); |
---|
| 232 | tmpDir = iterator->nextElement(); |
---|
| 233 | //tmpDir = imageDirs->enumerate(); |
---|
[3658] | 234 | while(tmpDir) |
---|
| 235 | { |
---|
| 236 | char* imgName = new char[strlen(tmpDir)+strlen(fileName)+1]; |
---|
| 237 | sprintf(imgName, "%s%s", tmpDir, fileName); |
---|
| 238 | if(isFile(imgName)) |
---|
[3676] | 239 | { |
---|
| 240 | PRINTF(4)("Image %s resides to %s\n", fileName, imgName); |
---|
| 241 | tmpResource->pointer = new Texture(imgName); |
---|
| 242 | delete []imgName; |
---|
| 243 | break; |
---|
| 244 | } |
---|
[3658] | 245 | delete []imgName; |
---|
[3667] | 246 | tmpDir = iterator->nextElement(); |
---|
[3658] | 247 | } |
---|
[3667] | 248 | delete iterator; |
---|
[3658] | 249 | } |
---|
| 250 | if(!tmpResource) |
---|
| 251 | PRINTF(2)("!!Image %s not Found!!\n", fileName); |
---|
| 252 | break; |
---|
| 253 | default: |
---|
| 254 | tmpResource->pointer = NULL; |
---|
| 255 | PRINTF(1)("No type found for %s.\n !!This should not happen unless the Type is not supported yet.!!\n", tmpResource->name); |
---|
| 256 | break; |
---|
[3655] | 257 | } |
---|
[3672] | 258 | this->resourceList->add(tmpResource); |
---|
[3658] | 259 | delete []fullName; |
---|
[3655] | 260 | } |
---|
| 261 | |
---|
[3658] | 262 | return tmpResource->pointer; |
---|
| 263 | } |
---|
| 264 | |
---|
| 265 | /** |
---|
| 266 | \brief unloads a Resource |
---|
| 267 | \param pointer The pointer to free |
---|
| 268 | \returns true if successful (pointer found, and deleted), false otherwise |
---|
| 269 | |
---|
| 270 | */ |
---|
[3660] | 271 | bool ResourceManager::unload(void* pointer, ResourcePriority prio) |
---|
[3658] | 272 | { |
---|
| 273 | // if pointer is existent. and only one resource of this type exists. |
---|
[3672] | 274 | Resource* tmpResource = this->locateResourceByPointer(pointer); |
---|
[3658] | 275 | if (!tmpResource) |
---|
[3655] | 276 | { |
---|
[3658] | 277 | PRINTF(2)("Resource not Found %p\n", pointer); |
---|
| 278 | return false; |
---|
[3655] | 279 | } |
---|
[3660] | 280 | else |
---|
| 281 | unload(tmpResource, prio); |
---|
| 282 | } |
---|
| 283 | |
---|
| 284 | bool ResourceManager::unload(Resource* resource, ResourcePriority prio) |
---|
| 285 | { |
---|
[3665] | 286 | if (resource->count > 0) |
---|
| 287 | resource->count--; |
---|
[3660] | 288 | if (resource->prio <= prio) |
---|
[3658] | 289 | { |
---|
[3660] | 290 | if (resource->count <= 0) |
---|
[3658] | 291 | { |
---|
[3660] | 292 | // deleting the Resource |
---|
| 293 | switch(resource->type) |
---|
| 294 | { |
---|
| 295 | case OBJ: |
---|
| 296 | case PRIM: |
---|
| 297 | delete (Model*)resource->pointer; |
---|
| 298 | break; |
---|
| 299 | case IMAGE: |
---|
| 300 | delete (Texture*)resource->pointer; |
---|
| 301 | break; |
---|
| 302 | default: |
---|
| 303 | PRINTF(1)("NOT YET IMPLEMENTED !!FIX FIX!!\n"); |
---|
| 304 | return false; |
---|
| 305 | break; |
---|
| 306 | } |
---|
| 307 | // deleting the List Entry: |
---|
| 308 | PRINTF(4)("Resource %s safely removed.\n", resource->name); |
---|
| 309 | delete []resource->name; |
---|
[3672] | 310 | this->resourceList->remove(resource); |
---|
[3658] | 311 | } |
---|
[3660] | 312 | else |
---|
| 313 | PRINTF(4)("Resource %s not removed, because there are still %d References to it.\n", resource->name, resource->count); |
---|
[3658] | 314 | } |
---|
| 315 | else |
---|
[3660] | 316 | PRINTF(4)("not deleting resource %s because DeleteLevel to high\n", resource->name); |
---|
[3658] | 317 | return true; |
---|
[3655] | 318 | } |
---|
| 319 | |
---|
[3660] | 320 | |
---|
[3655] | 321 | /** |
---|
[3660] | 322 | \brief unloads all alocated Memory of Resources with a pririty lower than prio |
---|
| 323 | \param prio The priority to delete |
---|
| 324 | */ |
---|
| 325 | bool ResourceManager::unloadAllByPriority(ResourcePriority prio) |
---|
| 326 | { |
---|
[3666] | 327 | tIterator<Resource>* iterator = resourceList->getIterator(); |
---|
| 328 | Resource* enumRes = iterator->nextElement(); |
---|
[3660] | 329 | while (enumRes) |
---|
| 330 | { |
---|
| 331 | if (enumRes->prio <= prio) |
---|
[3677] | 332 | if (enumRes->count == 0) |
---|
| 333 | unload(enumRes, prio); |
---|
| 334 | else |
---|
| 335 | PRINTF(2)("unable to unload %s because there are still %d references to it\n", |
---|
| 336 | enumRes->name, enumRes->count); |
---|
[3666] | 337 | //enumRes = resourceList->nextElement(); |
---|
| 338 | enumRes = iterator->nextElement(); |
---|
[3660] | 339 | } |
---|
[3666] | 340 | delete iterator; |
---|
[3660] | 341 | } |
---|
| 342 | |
---|
| 343 | /** |
---|
[3658] | 344 | \brief Searches for a Resource by Name |
---|
| 345 | \param fileName The name to look for |
---|
| 346 | \returns a Pointer to the Resource if found, NULL otherwise. |
---|
| 347 | */ |
---|
| 348 | Resource* ResourceManager::locateResourceByName(const char* fileName) |
---|
| 349 | { |
---|
[3667] | 350 | // Resource* enumRes = resourceList->enumerate(); |
---|
| 351 | tIterator<Resource>* iterator = resourceList->getIterator(); |
---|
| 352 | Resource* enumRes = iterator->nextElement(); |
---|
[3658] | 353 | while (enumRes) |
---|
| 354 | { |
---|
| 355 | if (!strcmp(fileName, enumRes->name)) |
---|
[3667] | 356 | { |
---|
| 357 | delete iterator; |
---|
| 358 | return enumRes; |
---|
| 359 | } |
---|
| 360 | enumRes = iterator->nextElement(); |
---|
[3658] | 361 | } |
---|
[3667] | 362 | delete iterator; |
---|
[3658] | 363 | return NULL; |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | /** |
---|
| 367 | \brief Searches for a Resource by Pointer |
---|
| 368 | \param pointer the Pointer to search for |
---|
| 369 | \returns a Pointer to the Resource if found, NULL otherwise. |
---|
| 370 | */ |
---|
| 371 | Resource* ResourceManager::locateResourceByPointer(const void* pointer) |
---|
| 372 | { |
---|
[3667] | 373 | // Resource* enumRes = resourceList->enumerate(); |
---|
| 374 | tIterator<Resource>* iterator = resourceList->getIterator(); |
---|
| 375 | Resource* enumRes = iterator->nextElement(); |
---|
[3658] | 376 | while (enumRes) |
---|
| 377 | { |
---|
[3665] | 378 | if (pointer == enumRes->pointer) |
---|
[3667] | 379 | { |
---|
| 380 | delete iterator; |
---|
| 381 | return enumRes; |
---|
| 382 | } |
---|
| 383 | enumRes = iterator->nextElement(); |
---|
[3658] | 384 | } |
---|
[3667] | 385 | delete iterator; |
---|
[3658] | 386 | return NULL; |
---|
| 387 | } |
---|
| 388 | |
---|
| 389 | /** |
---|
[3655] | 390 | \brief Checks if it is a Directory |
---|
| 391 | \param directoryName the Directory to check for |
---|
| 392 | \returns true if it is a directory/symlink false otherwise |
---|
| 393 | */ |
---|
| 394 | bool ResourceManager::isDir(const char* directoryName) |
---|
| 395 | { |
---|
| 396 | struct stat status; |
---|
| 397 | stat(directoryName, &status); |
---|
| 398 | if (status.st_mode & (S_IFDIR | S_IFLNK)) |
---|
| 399 | return true; |
---|
[3658] | 400 | else |
---|
[3655] | 401 | return false; |
---|
| 402 | } |
---|
| 403 | |
---|
| 404 | /** |
---|
| 405 | \brief Checks if the file is either a Regular file or a Symlink |
---|
| 406 | \param fileName the File to check for |
---|
| 407 | \returns true if it is a regular file/symlink, false otherwise |
---|
| 408 | */ |
---|
| 409 | bool ResourceManager::isFile(const char* fileName) |
---|
| 410 | { |
---|
| 411 | struct stat status; |
---|
| 412 | stat(fileName, &status); |
---|
| 413 | if (status.st_mode & (S_IFREG | S_IFLNK)) |
---|
| 414 | return true; |
---|
| 415 | else |
---|
| 416 | return false; |
---|
| 417 | } |
---|
[3676] | 418 | |
---|
| 419 | /** |
---|
| 420 | \brief outputs debug information about the ResourceManager |
---|
| 421 | */ |
---|
| 422 | void ResourceManager::debug(void) |
---|
| 423 | { |
---|
| 424 | PRINT(0)("=RM===================================\n"); |
---|
| 425 | PRINT(0)("= RESOURCE-MANAGER DEBUG INFORMATION =\n"); |
---|
| 426 | PRINT(0)("======================================\n"); |
---|
| 427 | // if it is not initialized |
---|
| 428 | PRINT(0)(" Reference is: %p\n", ResourceManager::singletonRef); |
---|
| 429 | PRINT(0)(" Data-Directory is: %s\n", this->dataDir); |
---|
| 430 | PRINT(0)(" List of Image-Directories: "); |
---|
| 431 | tIterator<char>* tmpIt = imageDirs->getIterator(); |
---|
| 432 | char* tmpDir = tmpIt->nextElement(); |
---|
| 433 | while(tmpDir) |
---|
| 434 | { |
---|
| 435 | PRINT(0)("%s ",tmpDir); |
---|
| 436 | tmpDir = tmpIt->nextElement(); |
---|
| 437 | } |
---|
| 438 | delete tmpIt; |
---|
| 439 | PRINT(0)("\n"); |
---|
| 440 | |
---|
| 441 | PRINT(0)("List of all stored Resources:\n"); |
---|
| 442 | tIterator<Resource>* iterator = resourceList->getIterator(); |
---|
| 443 | Resource* enumRes = iterator->nextElement(); |
---|
| 444 | while (enumRes) |
---|
| 445 | { |
---|
| 446 | PRINT(0)("-----------------------------------------\n"); |
---|
| 447 | PRINT(0)("Name: %s; References: %d; Type:", enumRes->name, enumRes->count); |
---|
| 448 | switch (enumRes->type) |
---|
| 449 | { |
---|
| 450 | case OBJ: |
---|
| 451 | PRINT(0)("ObjectModel\n"); |
---|
| 452 | break; |
---|
| 453 | case PRIM: |
---|
| 454 | PRINT(0)("PrimitiveModel\n"); |
---|
| 455 | break; |
---|
| 456 | case IMAGE: |
---|
| 457 | PRINT(0)("ImageFile (Texture)\n"); |
---|
| 458 | break; |
---|
| 459 | default: |
---|
| 460 | PRINT(0)("SoundFile\n"); |
---|
| 461 | break; |
---|
| 462 | } |
---|
| 463 | PRINT(0)("gets deleted at "); |
---|
| 464 | switch(enumRes->prio) |
---|
| 465 | { |
---|
| 466 | default: |
---|
| 467 | case RP_NO: |
---|
| 468 | PRINT(0)("first posibility (0)\n"); |
---|
| 469 | break; |
---|
| 470 | case RP_LEVEL: |
---|
| 471 | PRINT(0)("the end of the Level (1)\n"); |
---|
| 472 | break; |
---|
| 473 | case RP_CAMPAIGN: |
---|
| 474 | PRINT(0)("the end of the campaign (2)\n"); |
---|
| 475 | break; |
---|
| 476 | case RP_GAME: |
---|
| 477 | PRINT(0)("when leaving the game (3)\n"); |
---|
| 478 | break; |
---|
| 479 | } |
---|
| 480 | enumRes = iterator->nextElement(); |
---|
| 481 | } |
---|
| 482 | delete iterator; |
---|
| 483 | |
---|
| 484 | |
---|
| 485 | |
---|
| 486 | PRINT(0)("==================================RM==\n"); |
---|
| 487 | } |
---|