Changeset 11183 for code/branches/plehmannFS16/src/orxonox/controllers
- Timestamp:
- May 12, 2016, 3:28:30 PM (9 years ago)
- Location:
- code/branches/plehmannFS16/src/orxonox/controllers
- Files:
-
- 8 added
- 6 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt
r11178 r11183 19 19 MasterController.cc 20 20 NewScriptController.cc 21 Task.cc22 DebugTask.cc23 stringOutTask.cc24 21 ) 22 ADD_SUBDIRECTORY(scriptTasks) -
code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc
r11178 r11183 44 44 #include "NewScriptController.h" 45 45 46 #include " DebugTask.h"47 #include "s tringOutTask.h"48 #include " Task.h"46 #include "scriptTasks/DebugTask.h" 47 #include "scriptTasks/stringOutTask.h" 48 #include "scriptTasks/Task.h" 49 49 #include "infos/PlayerInfo.h" 50 50 #include "core/CoreIncludes.h" … … 71 71 72 72 this->context_ = context; 73 74 73 75 } 74 76 … … 87 89 88 90 this->ctrlid_ = ctrlid; 89 if ( ctrlid_ == 0)90 { 91 ctrlid_ = 1;91 if (this->ctrlid_ == 0) 92 { 93 this->ctrlid_ = 1; 92 94 } 93 95 … … 128 130 }*/ 129 131 130 if(taskQueue_.front() != nullptr) 131 { 132 orxout() << taskQueue_.front() << endl; 133 //taskQueue_.front()->tick(dt); 134 } 132 if(this->taskList_.size() != 0) 133 { 134 135 orxout() << this->scTime_ << endl; 136 137 if(this->taskList_.front()->getStartTime() < this->scTime_) 138 { 139 activeTasks_.push_back(this->taskList_.front()); 140 this->taskList_.pop_front(); 141 } 142 } 143 else 144 { 145 //orxout() << "no tasks in taskList_" << endl; 146 } 147 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 153 activeTasks_.erase(it); 154 it--; // set back the iterator so we continue with the next element and not with the one after that 155 } 156 } 157 158 159 scTime_ += dt; 135 160 } 136 161 … … 145 170 DebugTask* task = new DebugTask(context_); 146 171 task->initialize(startTime); 147 taskQueue_.push(task); 172 173 if(taskList_.empty()) 174 { 175 taskList_.push_front(task); 176 } 177 178 else 179 { 180 for (std::list<Task*>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime 181 { 182 orxout() << taskList_.empty() << endl; 183 184 if(task->getStartTime() < (*it)->getStartTime() ) 185 { 186 taskList_.insert(it, task); 187 } 188 } 189 } 148 190 } 149 191 … … 152 194 stringOutTask* task = new stringOutTask(context_); 153 195 task->initialize(startTime, output); 154 taskQueue_.push(task); 196 197 if(taskList_.empty()) 198 { 199 taskList_.push_front(task); 200 } 201 202 else 203 { 204 for (std::list<Task*>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime 205 { 206 orxout() << taskList_.empty() << endl; 207 208 if(task->getStartTime() < (*it)->getStartTime() ) 209 { 210 taskList_.insert(it, task); 211 } 212 } 213 } 155 214 } 156 215 -
code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h
r11178 r11183 30 30 #define _NewScriptController_H__ 31 31 32 #include " DebugTask.h"33 #include "s tringOutTask.h"34 #include " Task.h"32 #include "scriptTasks/DebugTask.h" 33 #include "scriptTasks/stringOutTask.h" 34 #include "scriptTasks/Task.h" 35 35 #include "OrxonoxPrereqs.h" /* die ganzen tolua, kopiert aus Dock.h*/ 36 36 #include "ArtificialController.h" … … 84 84 int ctrlid_; 85 85 86 // List of events to walk through 87 std:: queue<Task*> taskQueue_;86 // List of events to walk through sorted by starting times 87 std::list<Task*> taskList_; 88 88 89 89
Note: See TracChangeset
for help on using the changeset viewer.