Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11187


Ignore:
Timestamp:
May 12, 2016, 4:08:32 PM (8 years ago)
Author:
plehmann
Message:

added a MoveToTask TODO implement the update function

Location:
code/branches/plehmannFS16/src/orxonox/controllers
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc

    r11183 r11187  
    135135          orxout() << this->scTime_ << endl;
    136136
    137           if(this->taskList_.front()->getStartTime() < this->scTime_)
     137          if(this->taskList_.front().getStartTime() < this->scTime_)
    138138          {
    139139             activeTasks_.push_back(this->taskList_.front());
     
    146146        }
    147147       
    148         for (std::vector<Task*>::iterator it = activeTasks_.begin(); it != activeTasks_.end(); it++)
    149         {
    150           if( !((*it)->update(dt)) )
    151           {
    152             delete (*it); // delete the task that was created with new
     148        for (std::vector<Task>::iterator it = activeTasks_.begin(); it != activeTasks_.end(); it++)
     149        {
     150          if( !(it->update(dt)) )
     151          {
    153152            activeTasks_.erase(it);
    154153            it--; // set back the iterator so we continue with the next element and not with the one after that
     
    168167    void NewScriptController::debugOut(float startTime)
    169168    {
    170       DebugTask* task = new DebugTask(context_);
    171       task->initialize(startTime);
     169      DebugTask task = DebugTask(context_);
     170      task.initialize(startTime);
    172171
    173172      if(taskList_.empty())
     
    178177      else
    179178      {
    180         for (std::list<Task*>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime
     179        for (std::list<Task>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime
    181180        {
    182181          orxout() << taskList_.empty() << endl;
    183182
    184           if(task->getStartTime() < (*it)->getStartTime() )
     183          if(task.getStartTime() < it->getStartTime() )
    185184          {
    186185            taskList_.insert(it, task);
     
    192191    void NewScriptController::stringOut(float startTime, std::string output)
    193192    {
    194       stringOutTask* task = new stringOutTask(context_);
    195       task->initialize(startTime, output);
     193      stringOutTask task = stringOutTask(context_);
     194      task.initialize(startTime, output);
    196195
    197196      if(taskList_.empty())
     
    202201      else
    203202      {
    204         for (std::list<Task*>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime
     203        for (std::list<Task>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime
    205204        {
    206205          orxout() << taskList_.empty() << endl;
    207206
    208           if(task->getStartTime() < (*it)->getStartTime() )
     207          if(task.getStartTime() < it->getStartTime() )
    209208          {
    210209            taskList_.insert(it, task);
  • code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h

    r11183 r11187  
    8585
    8686            // List of events to walk through sorted by starting times
    87             std::list<Task*> taskList_;
     87            std::list<Task> taskList_;
    8888
    8989
    9090            //List of Tasks currently active
    91             std::vector<Task*> activeTasks_;
     91            std::vector<Task> activeTasks_;
    9292
    9393            // Time since the creation of this ScriptController object
Note: See TracChangeset for help on using the changeset viewer.