Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5329 in orxonox.OLD for trunk/src/lib/shell/shell_command.cc


Ignore:
Timestamp:
Oct 8, 2005, 11:07:21 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: executing static commands work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_command.cc

    r5328 r5329  
    422422  if (ShellCommandClass::commandClassList == NULL)
    423423    return false;
    424 
    425424
    426425  long classID = CL_NULL;                 //< the classID retrieved from the Class.
     
    482481    }
    483482
    484     if (classID != CL_NULL && inputSplits.getCount() >= 2 && objectList != NULL)
    485     {
    486       // Checking for a Match in the Objects of classID (else take the first)
    487       tIterator<BaseObject>* itBO = objectList->getIterator();
    488       BaseObject* enumBO = itBO->firstElement();
    489       while(enumBO)
     483    if (commandClass != NULL && inputSplits.getCount() >= 2)
     484    {
     485      if (objectList != NULL)
    490486      {
    491         if (enumBO->getName() != NULL && !strcasecmp(enumBO->getName(), inputSplits.getString(1)))
     487        // Checking for a Match in the Objects of classID (else take the first)
     488        tIterator<BaseObject>* itBO = objectList->getIterator();
     489        BaseObject* enumBO = itBO->firstElement();
     490        while(enumBO)
    492491        {
    493           objectPointer = enumBO;
    494           fktPos++;
    495           break;
    496         }
    497         enumBO = itBO->nextElement();
     492          if (enumBO->getName() != NULL && !strcasecmp(enumBO->getName(), inputSplits.getString(1)))
     493          {
     494            objectPointer = enumBO;
     495            fktPos = 2;
     496            break;
     497          }
     498          enumBO = itBO->nextElement();
     499         }
     500         delete itBO;
     501
     502      //
     503        if (objectPointer == NULL)
     504          objectPointer = objectList->firstElement();
    498505      }
    499       delete itBO;
    500 
    501       //
    502       if (objectPointer == NULL)
    503         objectPointer = objectList->firstElement();
    504 
     506      printf("test\n");
    505507      // match a function.
    506       if (commandClass != NULL && objectPointer != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.getCount() >= 3)))
     508      if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.getCount() >= 3)))
    507509      {
    508510        tIterator<ShellCommandBase>* itCMD = commandClass->commandList->getIterator();
     
    512514          if (!strcmp(enumCMD->getName(), inputSplits.getString(fktPos)))
    513515          {
     516            if (objectPointer == NULL && enumCMD->functorType == ShellCommand_Objective)
     517            {
     518              delete itCMD;
     519              return false;
     520            }
    514521            if (inputSplits.getCount() > fktPos+1)
    515522              enumCMD->executeCommand(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
     
    622629
    623630  return this;
    624 }
    625 
    626 
    627 /**
    628  * see ShellCommandBase::debug()
    629  */
    630 void ShellCommandBase::debugDyn()
    631 {
    632   this->debug();
    633631}
    634632
Note: See TracChangeset for help on using the changeset viewer.