Changeset 5111 in orxonox.OLD for trunk/src/util
- Timestamp:
- Aug 23, 2005, 11:13:56 PM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/animation/animation3d.cc
r5110 r5111 58 58 // delete all the KeyFrames 59 59 tIterator<KeyFrame3D>* itKF = keyFrameList->getIterator(); 60 KeyFrame3D* enumKF = itKF-> firstElement();60 KeyFrame3D* enumKF = itKF->nextElement(); 61 61 while (enumKF) 62 62 { -
trunk/src/util/animation/animation_player.cc
r5110 r5111 86 86 // deleting the Animation List AND all the elements of the List 87 87 tIterator<Animation>* animIt = this->animationList->getIterator(); 88 Animation* anim = animIt-> firstElement();88 Animation* anim = animIt->nextElement(); 89 89 while( anim != NULL) 90 90 { … … 109 109 // iterate through all the animations and tick them. 110 110 tIterator<Animation>* animIt = this->animationList->getIterator(); 111 Animation* anim = animIt-> firstElement();111 Animation* anim = animIt->nextElement(); 112 112 while( anim != NULL) 113 113 { … … 147 147 { 148 148 tIterator<Animation>* animIt = this->animationList->getIterator(); 149 Animation* anim = animIt-> firstElement();149 Animation* anim = animIt->nextElement(); 150 150 while( anim != NULL) 151 151 { … … 176 176 // Per ANIMATION DEBUG 177 177 tIterator<Animation>* animIt = this->animationList->getIterator(); 178 Animation* anim = animIt-> firstElement();178 Animation* anim = animIt->nextElement(); 179 179 while( anim != NULL) 180 180 { -
trunk/src/util/animation/t_animation.h
r5110 r5111 108 108 // delete all the KeyFrames 109 109 tIterator<KeyFrameF>* itKF = keyFrameList->getIterator(); 110 KeyFrameF* enumKF = itKF-> firstElement();110 KeyFrameF* enumKF = itKF->nextElement(); 111 111 while (enumKF) 112 112 { -
trunk/src/util/garbage_collector.cc
r5110 r5111 156 156 // 157 157 // tIterator<WorldEntity>* iterator = list->getIterator(); 158 // WorldEntity* entity = iterator-> firstElement();158 // WorldEntity* entity = iterator->nextElement(); 159 159 // while( entity != NULL) 160 160 // { -
trunk/src/util/loading/load_param.cc
r5110 r5111 17 17 18 18 #include "list.h" 19 #include "array.h" 19 20 #include "base_object.h" 20 21 … … 295 296 296 297 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 297 LoadParamDescription* enumParamDesc = iterator-> firstElement();298 LoadParamDescription* enumParamDesc = iterator->nextElement(); 298 299 while (enumParamDesc) 299 300 { … … 314 315 { 315 316 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 316 LoadClassDescription* enumClassDesc = iterator-> firstElement();317 LoadClassDescription* enumClassDesc = iterator->nextElement(); 317 318 while (enumClassDesc) 318 319 { … … 336 337 { 337 338 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 338 LoadParamDescription* enumParamDesc = iterator-> firstElement();339 LoadParamDescription* enumParamDesc = iterator->nextElement(); 339 340 while (enumParamDesc) 340 341 { … … 362 363 PRINT(3)(" Listing all the Loadable Options (loaded since Game started).\n\n"); 363 364 tIterator<LoadClassDescription>* classIT = LoadClassDescription::classList->getIterator(); 364 LoadClassDescription* enumClassDesc = classIT-> firstElement();365 LoadClassDescription* enumClassDesc = classIT->nextElement(); 365 366 while (enumClassDesc) 366 367 { 367 368 PRINT(3)("<%s>\n", enumClassDesc->className); 368 369 tIterator<LoadParamDescription>* paramIT = enumClassDesc->paramList->getIterator(); 369 LoadParamDescription* enumParamDesc = paramIT-> firstElement();370 LoadParamDescription* enumParamDesc = paramIT->nextElement(); 370 371 while (enumParamDesc) 371 372 { … … 385 386 * searches for classes, which beginn with classNameBegin 386 387 * @param classNameBegin the beginning string of a Class 387 * @return a NEW char-array with ClassNames. The LISTshould be deleted afterwards,388 * @return a NEW char-array with ClassNames. The ARRAY should be deleted afterwards, 388 389 * !! The strings MUST NOT be deleted !! 389 390 */ 390 tList<const char>* LoadClassDescription::searchClassWithShort(const char* classNameBegin)391 Array<char*>* LoadClassDescription::searchClassWithShort(const char* classNameBegin) 391 392 { 392 393 unsigned int searchLength = strlen(classNameBegin); 393 tList<const char>* retVal = new tList<const char>;394 Array<char*>* retVal = new Array<char*>; 394 395 395 396 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 396 LoadClassDescription* enumClassDesc = iterator-> firstElement();397 LoadClassDescription* enumClassDesc = iterator->nextElement(); 397 398 while (enumClassDesc) 398 399 { … … 400 401 !strncasecmp(enumClassDesc->className, classNameBegin, searchLength)) 401 402 { 402 retVal->add (enumClassDesc->className);403 retVal->addEntry(enumClassDesc->className); 403 404 } 404 405 enumClassDesc = iterator->nextElement(); … … 406 407 delete iterator; 407 408 409 retVal->finalizeArray(); 408 410 return retVal; 409 411 } … … 412 414 // { 413 415 // tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 414 // LoadClassDescription* enumClassDesc = iterator-> firstElement();416 // LoadClassDescription* enumClassDesc = iterator->nextElement(); 415 417 // while (enumClassDesc) 416 418 // { -
trunk/src/util/loading/load_param.h
r5102 r5111 31 31 // Forward Declaration // 32 32 template<class T> class tList; 33 template<class T> class Array; 33 34 34 35 //! macro that makes it even more easy to load a Parameter … … 311 312 312 313 static void printAll(const char* fileName = NULL); 313 static tList<const char>* searchClassWithShort(const char* classNameBegin);314 static Array<char*>* searchClassWithShort(const char* classNameBegin); 314 315 // static const LoadParamDescription* getClass(const char* className); 315 316 -
trunk/src/util/resource_manager.cc
r5110 r5111 74 74 // deleting the Directorie Lists 75 75 tIterator<char>* tmpIt = imageDirs->getIterator(); 76 char* tmpDir = tmpIt-> firstElement();76 char* tmpDir = tmpIt->nextElement(); 77 77 while(tmpDir) 78 78 { … … 99 99 this->dataDir = new char[strlen(realDir)+1]; 100 100 strcpy(this->dataDir, realDir); 101 delete []realDir;101 delete realDir; 102 102 return true; 103 103 } 104 104 else 105 105 { 106 PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", realDir, this->dataDir);107 delete []realDir;106 PRINTF(1)("%s is not a Directory, and can not be the Data Directory, leaving as %s \n", dataDir, this->dataDir); 107 delete realDir; 108 108 return false; 109 109 } … … 144 144 // check if the Directory has been added before 145 145 tIterator<char>* tmpImageDirs = imageDirs->getIterator(); 146 char* tmpDir = tmpImageDirs-> firstElement();146 char* tmpDir = tmpImageDirs->nextElement(); 147 147 while(tmpDir) 148 148 { … … 363 363 { 364 364 tIterator<char>* iterator = imageDirs->getIterator(); 365 tmpDir = iterator->firstElement(); 365 tmpDir = iterator->nextElement(); 366 //tmpDir = imageDirs->enumerate(); 366 367 while(tmpDir) 367 368 { … … 491 492 { 492 493 tIterator<Resource>* iterator = resourceList->getIterator(); 493 Resource* enumRes = iterator-> firstElement();494 Resource* enumRes = iterator->nextElement(); 494 495 while (enumRes) 495 496 { … … 520 521 // Resource* enumRes = resourceList->enumerate(); 521 522 tIterator<Resource>* iterator = resourceList->getIterator(); 522 Resource* enumRes = iterator-> firstElement();523 Resource* enumRes = iterator->nextElement(); 523 524 while (enumRes) 524 525 { … … 602 603 // Resource* enumRes = resourceList->enumerate(); 603 604 tIterator<Resource>* iterator = resourceList->getIterator(); 604 Resource* enumRes = iterator-> firstElement();605 Resource* enumRes = iterator->nextElement(); 605 606 while (enumRes) 606 607 { … … 630 631 631 632 // checking for the termination of the string given. If there is a "/" at the end cut it away 632 if (directoryName[strlen(directoryName)-1] == '/' || 633 directoryName[strlen(directoryName)-1] == '\\') 633 if (directoryName[strlen(directoryName)-1] == '/') 634 634 { 635 635 tmpDirName = new char[strlen(directoryName)+1]; … … 651 651 )) 652 652 { 653 delete []tmpDirName;653 delete tmpDirName; 654 654 return true; 655 655 } … … 798 798 PRINT(0)(" List of Image-Directories: "); 799 799 tIterator<char>* tmpIt = imageDirs->getIterator(); 800 char* tmpDir = tmpIt-> firstElement();800 char* tmpDir = tmpIt->nextElement(); 801 801 while(tmpDir) 802 802 { … … 809 809 PRINT(0)("List of all stored Resources:\n"); 810 810 tIterator<Resource>* iterator = resourceList->getIterator(); 811 Resource* enumRes = iterator-> firstElement();811 Resource* enumRes = iterator->nextElement(); 812 812 while (enumRes) 813 813 { -
trunk/src/util/shell.cc
r5110 r5111 20 20 #include "text_engine.h" 21 21 #include "list.h" 22 #include "array.h" 22 23 #include "graphics_engine.h" 23 24 #include "event_handler.h" 24 25 25 26 #include "load_param.h" 26 #include "class_list.h"27 28 #include "key_names.h"29 27 #include "debug.h" 30 28 #include <stdarg.h> … … 42 40 this->setName("Shell"); 43 41 44 this->shellHeight = 400;45 this->bActive = false;46 42 this->buffer = new tList<char>; 47 43 48 this->textSize = 15; 49 this->lineSpacing = 5; 44 this->textSize = 10; 50 45 51 46 //this->bufferSize = 0; 52 47 this->bufferText = NULL; 53 48 this->setBufferSize(100); 54 this->bufferDisplaySize = 10;55 49 this->setBufferDisplaySize(10); 56 this->setAbsCoor2D(3, -400);50 this->setAbsCoor2D(3, GraphicsEngine::getInstance()->getResolutionY()); 57 51 this->delayed = 0; 58 52 this->setRepeatDelay(.3, .05); 59 53 this->pressedKey = SDLK_FIRST; 60 54 61 this->inputLineText = NULL; 55 this->inputLineText = TextEngine::getInstance()->createText("fonts/earth.ttf", 10, TEXT_DYNAMIC, 255, 0, 0); 56 this->inputLineText->setAlignment(TEXT_ALIGN_LEFT); 57 this->inputLineText->setText(NULL); 62 58 this->inputLine = new char[1]; 63 59 this->inputLine[0] = '\0'; 64 65 this->rebuildText(); 66 this->completionList = NULL; 67 68 // EVENT-Handler subscription of '`' to all States, and all other keyboard commands to ES_SEHLL 60 this->inputLineText->setParent2D(this); 61 62 69 63 EventHandler* evh = EventHandler::getInstance(); 70 64 evh->subscribe(this, ES_ALL, SDLK_BACKQUOTE); … … 83 77 for (int i = 0; i < this->bufferDisplaySize; i++) 84 78 delete this->bufferText[i]; 85 delete []this->bufferText;79 delete this->bufferText; 86 80 87 81 // delete the inputLine … … 91 85 // delete all the Chars in the Buffers 92 86 tIterator<char>* charIterator = this->buffer->getIterator(); 93 char* charElem = charIterator-> firstElement();87 char* charElem = charIterator->nextElement(); 94 88 while (charElem != NULL) 95 89 { … … 99 93 delete charIterator; 100 94 101 // if (this->completionList != NULL)102 //delete this->completionList;103 104 95 Shell::singletonRef = NULL; 105 96 } 106 107 108 void Shell::activate()109 {110 if (this->bActive == true)111 PRINTF(3)("The shell is already active\n");112 this->bActive = true;113 114 EventHandler::getInstance()->setState(ES_SHELL);115 this->setRelCoorSoft2D(0, 0, 1, 5);116 }117 118 void Shell::deactivate()119 {120 if (this->bActive == false)121 PRINTF(3)("The shell is already inactive\n");122 this->bActive = false;123 124 EventHandler::getInstance()->setState(ES_GAME);125 this->setRelCoorSoft2D(0, -400, 1, 5);126 }127 128 void Shell::setTextSize(unsigned int textSize, unsigned int lineSpacing)129 {130 this->textSize = textSize;131 this->lineSpacing = lineSpacing;132 133 this->rebuildText();134 }135 136 void Shell::rebuildText()137 {138 if (this->inputLineText == NULL)139 delete this->inputLineText;140 this->inputLineText = TextEngine::getInstance()->createText("fonts/Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);141 this->inputLineText->setAlignment(TEXT_ALIGN_LEFT);142 this->inputLineText->setText(NULL);143 this->inputLineText->setParent2D(this);144 this->inputLineText->setRelCoor2D(5, (this->textSize + this->lineSpacing)*this->bufferDisplaySize);145 146 this->setBufferDisplaySize(this->bufferDisplaySize);147 }148 149 150 97 151 98 /** … … 159 106 for (unsigned int i = 0; i < this->bufferDisplaySize; i++) 160 107 delete this->bufferText[i]; 161 delete []this->bufferText;108 delete this->bufferText; 162 109 } 163 110 … … 165 112 for (unsigned int i = 0; i < bufferDisplaySize; i++) 166 113 { 167 this->bufferText[i] = TextEngine::getInstance()->createText("fonts/ Aniron_Bold.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0);114 this->bufferText[i] = TextEngine::getInstance()->createText("fonts/earth.ttf", this->textSize, TEXT_DYNAMIC, 255, 0, 0); 168 115 this->bufferText[i]->setAlignment(TEXT_ALIGN_LEFT); 169 this->bufferText[i]->setRelCoor2D(5, (this->textSize + this->lineSpacing)*(bufferDisplaySize - i -1));116 this->bufferText[i]->setRelCoor2D(5, 12+12*i); 170 117 this->bufferText[i]->setText(NULL); 171 118 this->bufferText[i]->setParent2D(this); 172 119 } 120 121 173 122 this->bufferDisplaySize = bufferDisplaySize; 174 175 this->shellHeight = (this->textSize + this->lineSpacing) * (bufferDisplaySize+1);176 123 } 177 124 … … 191 138 // delete all the Chars in the Buffers 192 139 tIterator<char>* charIterator = this->buffer->getIterator(); 193 char* charElem = charIterator-> firstElement();140 char* charElem = charIterator->nextElement(); 194 141 195 142 while (charElem != NULL) … … 206 153 * @param line the Line as in the first argument in printf 207 154 * @param args the arguments as a va_list 155 * 156 * @todo optimize 208 157 */ 209 158 bool Shell::addBufferLineStatic(const char* line, ...) … … 225 174 return true; 226 175 } 176 int curr = 0; 227 177 228 178 /** … … 249 199 } 250 200 251 if ( this->bActive &&likely(bufferText != NULL))201 if (likely(bufferText != NULL)) 252 202 { 253 Text* lastText = this->bufferText[this->bufferDisplaySize-1]; 254 Vector firstCoord = this->bufferText[0]->getRelCoorSoft2D(); 255 256 Text* swapText; 257 Text* moveText = this->bufferText[0]; 258 this->bufferText[0]->setRelCoorSoft2D(this->bufferText[1]->getRelCoorSoft2D(), 5); 259 for (unsigned int i = 1; i < this->bufferDisplaySize; i++) 203 Text* moveText = this->bufferText[this->bufferDisplaySize-1]; 204 for (int i = this->bufferDisplaySize-1; i > 0; i--) 260 205 { 261 if ( i < this->bufferDisplaySize-1) 262 this->bufferText[i]->setRelCoorSoft2D(this->bufferText[i+1]->getRelCoorSoft2D(),5); 263 swapText = this->bufferText[i]; 264 this->bufferText[i] = moveText; 265 moveText = swapText; 206 this->bufferText[i] = this->bufferText[i-1]; 266 207 } 267 lastText->setRelCoor2D(firstCoord); 268 this->bufferText[0] = lastText; 269 270 this->bufferText[0]->setText(newLine); 208 this->bufferText[0] = moveText; 271 209 } 210 this->bufferText[0]->setText(newLine); 211 // this->bufferText-> 212 // this->inputLineText->setText(newLine); 272 213 } 273 214 … … 289 230 { 290 231 tIterator<char>* charIterator = this->buffer->getIterator(); 291 char* charElem = charIterator-> firstElement();232 char* charElem = charIterator->nextElement(); 292 233 293 234 int i = 1; … … 305 246 } 306 247 248 307 249 /** 308 250 * deletes the InputLine … … 316 258 this->inputLine = new char[1]; 317 259 *this->inputLine = '\0'; 260 318 261 } 319 262 … … 373 316 bool Shell::executeCommand() 374 317 { 318 375 319 this->addBufferLineStatic("Execute Command: %s\n", this->inputLine); 376 320 delete this->inputLine; … … 393 337 } 394 338 339 340 #include "key_names.h" 395 341 /** 396 342 * listens for some event … … 406 352 if (EventHandler::getInstance()->getState() == ES_GAME) 407 353 { 408 this->activate(); 354 EventHandler::getInstance()->setState(ES_SHELL); 355 this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()-150, 1, 5); 409 356 } 410 357 411 358 else 412 359 { 413 this->deactivate(); 360 EventHandler::getInstance()->setState(ES_GAME); 361 this->setRelCoorSoft2D(0, GraphicsEngine::getInstance()->getResolutionY()+10, 1, 5); 414 362 } 415 363 } … … 434 382 { 435 383 if (this->pressedKey == event.type) 436 {437 384 this->pressedKey = SDLK_FIRST; 438 this->delayed = 0.0; 439 } 385 this->delayed = 0.0; 440 386 } 441 387 } … … 480 426 481 427 // glTexCoord2f(this->texCoord.maxU, this->texCoord.minV); 482 glVertex2f( GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y );428 glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y ); 483 429 484 430 // glTexCoord2f(this->texCoord.maxU, this->texCoord.maxV); 485 glVertex2f( GraphicsEngine::getInstance()->getResolutionX() - this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);431 glVertex2f(this->getAbsCoor2D().x + 800, this->getAbsCoor2D().y + 150); 486 432 487 433 // glTexCoord2f(this->texCoord.minU, this->texCoord.maxV); 488 glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + this->shellHeight);434 glVertex2f(this->getAbsCoor2D().x, this->getAbsCoor2D().y + 150); 489 435 490 436 glEnd(); … … 505 451 strcpy(completionLine, this->inputLine); 506 452 507 char* commandBegin = strrchr(completionLine, ' ');453 char* commandBegin = strrchr(completionLine, ' '); 508 454 if (commandBegin == NULL) 509 455 commandBegin = completionLine; … … 516 462 } 517 463 518 char* objectStart; 519 if (objectStart = strstr(commandBegin, "::")) 520 { 521 char* classIdentity = new char[objectStart - commandBegin +1]; 522 strncpy(classIdentity, commandBegin, objectStart - commandBegin); 523 classIdentity[objectStart - commandBegin] = '\0'; 524 this->objectComplete(objectStart+2, ClassList::StringToID(classIdentity)); 525 delete[] classIdentity; 526 } 527 else 528 this->classComplete(commandBegin); 529 530 delete[] completionLine; 531 } 532 533 /** 534 * autocompletes a className 535 * @param classBegin the Beginning of a String to autoComplete 536 * @return true on success, false otherwise 537 */ 538 bool Shell::classComplete(const char* classBegin) 539 { 540 if (unlikely(classBegin == NULL)) 541 return false; 542 const tList<const char>* clList = ClassList::getClassList(); 543 if (clList != NULL) 544 { 545 const tList<const char>* classList = this->createCompleteList(clList, classBegin); 546 if (classList != NULL) 547 this->generalComplete(classList, classBegin, "%s::", "::"); 548 else 549 return false; 550 } 551 else 552 return false; 553 return true; 554 } 555 556 /** 557 * autocompletes an ObjectName 558 * @param objectBegin the beginning string of a Object 559 * @param classID the ID of the Class to search for. 560 * @return true on success, false otherwise 561 */ 562 bool Shell::objectComplete(const char* objectBegin, long classID) 563 { 564 printf("%s\n", objectBegin); 565 566 if (unlikely(objectBegin == NULL)) 567 return false; 568 tList<BaseObject>* boList = ClassList::getList(classID); 569 if (boList != NULL) 570 { 571 printf("\n", boList->firstElement()->getName()); 572 const tList<const char>* objectList = this->createCompleteList(boList, objectBegin); 573 if (objectList != NULL) 574 this->generalComplete(objectList, objectBegin, "%s"); 575 else 576 return false; 577 } 578 else 579 return false; 580 return true; 581 } 582 583 bool Shell::functionComplete(const char* functionBegin) 584 { 585 } 586 587 /** 588 * completes the inputline on grounds of an inputList 589 * @param stringList the List to parse through 590 * @param begin the String to search in the inputList, and to extend with it. 591 * @param displayAs how to display the found value to the user, printf-style, !!with only one %s!! ex.: "::%s::" 592 * @param addBack what should be added at the end of the completion 593 * @param addFront what should be added to the front of one finished completion 594 * @return true if ok, false otherwise 595 */ 596 bool Shell::generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs, const char* addBack, const char* addFront) 597 { 598 if (stringList->getSize() == 0) 599 return false; 600 601 const char* addString = stringList->firstElement(); 602 unsigned int addLength = 0; 603 unsigned int inputLenght = strlen(begin); 604 605 if (addString != NULL) 606 addLength = strlen(addString); 607 tIterator<const char>* charIterator = stringList->getIterator(); 608 const char* charElem = charIterator->firstElement(); 609 while (charElem != NULL) 610 { 611 PRINTF(0)(displayAs, charElem); 612 for (unsigned int i = inputLenght; i < addLength; i++) 613 if (addString[i] != charElem[i]) 614 { 615 addLength = i; 616 break; 617 } 618 charElem = charIterator->nextElement(); 619 } 620 delete charIterator; 621 622 if (addLength >= inputLenght) 623 { 624 char* adder = new char[addLength+1]; 625 strncpy(adder, addString, addLength); 626 adder[addLength] = '\0'; 627 this->removeCharacters(inputLenght); 628 this->addCharacters(adder); 629 if (addBack != NULL && stringList->getSize() == 1) 630 this->addCharacters("::"); 631 delete[] adder; 632 } 633 return true; 634 } 635 636 637 638 /** 639 * searches for classes, which beginn with classNameBegin 640 * @param inputList the List to parse through 641 * @param classNameBegin the beginning string 642 * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards, 643 * !! The strings MUST NOT be deleted !! 644 */ 645 const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin) 646 { 647 if (inputList == NULL || classNameBegin == NULL) 648 return NULL; 649 unsigned int searchLength = strlen(classNameBegin); 650 if (this->completionList != NULL) 651 delete this->completionList; 652 this->completionList = new tList<const char>; 653 654 // tList<const char>* classList = ClassList::getClassList(); 655 656 tIterator<const char>* iterator = inputList->getIterator(); 657 const char* enumString = iterator->firstElement(); 658 while (enumString != NULL) 659 { 660 if (strlen(enumString)>searchLength+1 && 661 !strncasecmp(enumString, classNameBegin, searchLength)) 662 { 663 this->completionList->add(enumString); 664 } 665 enumString = iterator->nextElement(); 666 } 667 delete iterator; 668 669 return this->completionList; 670 } 671 672 /** 673 * searches for classes, which beginn with classNameBegin 674 * @param inputList the List to parse through 675 * @param classNameBegin the beginning string 676 * @return a NEW char-array with ClassNames. The LIST should be deleted afterwards, 677 * !! The strings MUST NOT be deleted !! 678 */ 679 const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin) 680 { 681 if (inputList == NULL || classNameBegin == NULL) 682 return NULL; 683 unsigned int searchLength = strlen(classNameBegin); 684 if (this->completionList != NULL) 685 delete this->completionList; 686 this->completionList = new tList<const char>; 687 688 tIterator<BaseObject>* iterator = inputList->getIterator(); 689 BaseObject* enumBO = iterator->firstElement(); 690 while (enumBO != NULL) 691 { 692 if (enumBO->getName() != NULL && 693 strlen(enumBO->getName())>searchLength+1 && 694 !strncasecmp(enumBO->getName(), classNameBegin, searchLength)) 695 { 696 this->completionList->add(enumBO->getName()); 697 } 698 enumBO = iterator->nextElement(); 699 } 700 delete iterator; 701 702 return this->completionList; 464 printf("%s\n",commandBegin); 465 Array<char*>* classArray = LoadClassDescription::searchClassWithShort(commandBegin); 466 if (classArray->getCount() == 0) 467 { 468 delete[] completionLine; 469 delete classArray; 470 //PRINTF(0)("no completion found for %s\n", commandBegin); 471 return false; 472 } 473 474 for (unsigned int i = 0; i < classArray->getCount(); i++) 475 { 476 PRINTF(0)("%s\n", classArray->getEntry(i)); 477 } 478 if (classArray->getCount() == 1) 479 { 480 this->removeCharacters(strlen(commandBegin)); 481 this->addCharacters(classArray->getEntry(0)); 482 this->addCharacter(' '); 483 } 484 485 delete[] completionLine; 486 delete classArray; 703 487 } 704 488 … … 710 494 if (this->pressedKey != SDLK_FIRST) 711 495 printf("%s::%f %f\n", SDLKToKeyname(this->pressedKey), this->delayed, this->repeatDelay); 712 } 496 497 } -
trunk/src/util/shell.h
r5107 r5111 36 36 37 37 38 void activate(); 39 void deactivate(); 38 void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; }; 40 39 41 void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1); 42 void rebuildText(); 40 void setBufferDisplaySize(unsigned int bufferDisplaySize); 43 41 44 42 // BUFFER // 45 void setBufferSize(unsigned int bufferSize) { this->bufferSize = bufferSize; };46 void setBufferDisplaySize(unsigned int bufferDisplaySize);47 43 void flushBuffers(); 48 44 static bool addBufferLineStatic(const char* line, ...); … … 71 67 private: 72 68 bool autoComplete(); 73 bool classComplete(const char* classBegin);74 bool objectComplete(const char* objectBegin, long classID);75 bool functionComplete(const char* functionBegin);76 77 bool generalComplete(const tList<const char>* stringList, const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);78 79 const tList<const char>* Shell::createCompleteList(const tList<const char>* inputList, const char* classNameBegin);80 const tList<const char>* Shell::createCompleteList(const tList<BaseObject>* inputList, const char* classNameBegin);81 69 82 70 … … 100 88 unsigned int textSize; //!< The size of the text. 101 89 unsigned int lineSpacing; //!< The Spacing between lines. 102 unsigned int shellHeight; //!< The hight of the Shell in Pixels103 bool bActive; //!< if the shell is active;104 90 105 91 char bufferArray[10000]; //!< a BUFFER for fast writing 106 107 // completion108 tList<const char>* completionList; //!< A list of completions, that are io.109 92 }; 110 93 -
trunk/src/util/track/track_manager.cc
r5110 r5111 79 79 { 80 80 tIterator<TrackElement>* iterator = this->children->getIterator(); 81 TrackElement* enumElem = iterator-> firstElement();81 TrackElement* enumElem = iterator->nextElement(); 82 82 while (enumElem) 83 83 { … … 104 104 { 105 105 tIterator<TrackElement>* iterator = this->children->getIterator(); 106 TrackElement* enumElem = iterator-> firstElement();106 TrackElement* enumElem = iterator->nextElement(); 107 107 TrackElement* tmpElem; 108 108 while (enumElem) … … 133 133 { 134 134 tIterator<TrackElement>* iterator = this->children->getIterator(); 135 TrackElement* enumElem = iterator-> firstElement();135 TrackElement* enumElem = iterator->nextElement(); 136 136 TrackElement* tmpElem; 137 137 while (enumElem) … … 179 179 { 180 180 tIterator<TrackElement>* iterator = this->children->getIterator(); 181 TrackElement* enumElem = iterator-> firstElement();181 TrackElement* enumElem = iterator->nextElement(); 182 182 while (enumElem) 183 183 { … … 206 206 207 207 tIterator<TrackElement>* iterator = this->children->getIterator(); 208 TrackElement* enumElem = iterator-> firstElement();208 TrackElement* enumElem = iterator->nextElement(); 209 209 for (int i = 0; i < childCount; i++) 210 210 enumElem = iterator->nextElement(); … … 234 234 //TrackElement* enumElem = this->children->enumerate(); 235 235 tIterator<TrackElement>* iterator = this->children->getIterator(); 236 TrackElement* enumElem = iterator-> firstElement();236 TrackElement* enumElem = iterator->nextElement(); 237 237 while (enumElem) 238 238 { … … 331 331 //TrackElement* enumElem = this->children->enumerate(); 332 332 tIterator<TrackElement>* iterator = this->children->getIterator(); 333 TrackElement* enumElem = iterator-> firstElement();333 TrackElement* enumElem = iterator->nextElement(); 334 334 while (enumElem) 335 335 { … … 975 975 //TrackElement* enumElem = firstJoint->children->enumerate(); 976 976 tIterator<TrackElement>* iterator = firstJoint->children->getIterator(); 977 TrackElement* enumElem = iterator-> firstElement();977 TrackElement* enumElem = iterator->nextElement(); 978 978 while (enumElem) 979 979 { … … 1001 1001 { 1002 1002 tIterator<TrackElement>* iterator = tmpElem->children->getIterator(); 1003 TrackElement* enumElem = iterator-> firstElement();1003 TrackElement* enumElem = iterator->nextElement(); 1004 1004 //TrackElement* enumElem = tmpElem->children->enumerate(); 1005 1005 while (enumElem)
Note: See TracChangeset
for help on using the changeset viewer.