Changeset 5226 in orxonox.OLD for trunk/src/util/loading
- Timestamp:
- Sep 23, 2005, 10:25:52 PM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/load_param.cc
r5218 r5226 213 213 * A list, that holds all the classes that are loadable (classes not objects!!) 214 214 */ 215 tList<LoadClassDescription>* LoadClassDescription::classList = new tList<LoadClassDescription>;215 tList<LoadClassDescription>* LoadClassDescription::classList = NULL; 216 216 217 217 /** … … 228 228 strcpy(this->className, className); 229 229 230 classList->add(this); 230 if (LoadClassDescription::classList == NULL) 231 LoadClassDescription::classList = new tList<LoadClassDescription>; 232 233 LoadClassDescription::classList->add(this); 231 234 232 235 this->paramList = new tList<LoadParamDescription>; … … 238 241 LoadClassDescription::~LoadClassDescription() 239 242 { 240 delete []this->className;241 242 243 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 243 244 LoadParamDescription* enumParamDesc = iterator->firstElement(); … … 248 249 } 249 250 delete iterator; 250 } 251 252 delete[] this->className; 253 } 254 255 void LoadClassDescription::deleteAllDescriptions() 256 { 257 if (LoadClassDescription::classList != NULL) 258 { 259 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 260 LoadClassDescription* delElem = iterator->firstElement(); 261 while (delElem != NULL) 262 { 263 delete delElem; 264 delElem = iterator->nextElement(); 265 } 266 delete iterator; 267 delete LoadClassDescription::classList; 268 } 269 LoadClassDescription::classList = NULL; 270 } 271 251 272 252 273 /** … … 259 280 LoadClassDescription* LoadClassDescription::addClass(const char* className) 260 281 { 261 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 262 LoadClassDescription* enumClassDesc = iterator->firstElement(); 263 while (enumClassDesc) 264 { 265 if (!strcmp(enumClassDesc->className, className)) 266 { 267 delete iterator; 268 return enumClassDesc; 269 } 270 enumClassDesc = iterator->nextElement(); 271 } 272 delete iterator; 273 282 if (LoadClassDescription::classList != NULL) 283 { 284 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 285 LoadClassDescription* enumClassDesc = iterator->firstElement(); 286 while (enumClassDesc) 287 { 288 if (!strcmp(enumClassDesc->className, className)) 289 { 290 delete iterator; 291 return enumClassDesc; 292 } 293 enumClassDesc = iterator->nextElement(); 294 } 295 delete iterator; 296 } 274 297 return new LoadClassDescription(className); 275 298 } … … 307 330 PRINT(3)("===============================================================\n"); 308 331 PRINT(3)(" Listing all the Loadable Options (loaded since Game started).\n\n"); 309 tIterator<LoadClassDescription>* classIT = LoadClassDescription::classList->getIterator(); 310 LoadClassDescription* enumClassDesc = classIT->firstElement(); 311 while (enumClassDesc) 312 { 313 PRINT(3)("<%s>\n", enumClassDesc->className); 314 tIterator<LoadParamDescription>* paramIT = enumClassDesc->paramList->getIterator(); 315 LoadParamDescription* enumParamDesc = paramIT->firstElement(); 316 while (enumParamDesc) 317 { 318 enumParamDesc->print(); 319 enumParamDesc = paramIT->nextElement(); 320 } 321 delete paramIT; 322 323 PRINT(3)("</%s>\n\n", enumClassDesc->className); 324 enumClassDesc = classIT->nextElement(); 325 } 326 delete classIT; 332 if (LoadClassDescription::classList != NULL) 333 { 334 tIterator<LoadClassDescription>* classIT = LoadClassDescription::classList->getIterator(); 335 LoadClassDescription* enumClassDesc = classIT->firstElement(); 336 while (enumClassDesc) 337 { 338 PRINT(3)("<%s>\n", enumClassDesc->className); 339 tIterator<LoadParamDescription>* paramIT = enumClassDesc->paramList->getIterator(); 340 LoadParamDescription* enumParamDesc = paramIT->firstElement(); 341 while (enumParamDesc) 342 { 343 enumParamDesc->print(); 344 enumParamDesc = paramIT->nextElement(); 345 } 346 delete paramIT; 347 348 PRINT(3)("</%s>\n\n", enumClassDesc->className); 349 enumClassDesc = classIT->nextElement(); 350 } 351 delete classIT; 352 } 353 else 354 PRINT(3)("no Classes defined so far\n"); 327 355 PRINT(3)("===============================================================\n"); 328 356 } -
trunk/src/util/loading/load_param.h
r5141 r5226 254 254 LoadParamDescription* addParam(const char* paramName); 255 255 256 static void deleteAllDescriptions(); 257 256 258 static void printAll(const char* fileName = NULL); 257 259 static tList<const char>* searchClassWithShort(const char* classNameBegin);
Note: See TracChangeset
for help on using the changeset viewer.