- Timestamp:
- May 19, 2016, 5:34:38 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc
r11187 r11190 130 130 }*/ 131 131 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(); 132 if(!this->taskList_.empty()) 133 { 134 orxout() << scTime_ << endl; 135 136 orxout() << taskList_.size() << endl; 137 138 139 if(this->taskList_.front()->getStartTime() < this->scTime_) 140 { 141 activeTasks_.push_back(this->taskList_.front()); 142 this->taskList_.pop_front(); 141 143 } 142 144 } 143 145 else 144 146 { 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 activeTasks_.erase(it); 153 it--; // set back the iterator so we continue with the next element and not with the one after that 154 } 155 } 147 orxout() << "no tasks in taskList_" << endl; 148 } 149 150 std::vector<Task*>::iterator it = activeTasks_.begin(); 151 while (it != activeTasks_.end() ) 152 { 153 if( !((*it)->update(dt)) ) 154 { 155 (*(*it)).destroyLater(); 156 it = activeTasks_.erase(it); 157 } 158 else 159 { 160 it++; 161 } 162 163 } 164 156 165 157 166 … … 159 168 } 160 169 161 162 void NewScriptController::createAndAddTask(Task newTask)163 {164 //taskQueue_->push(newTask);165 }166 167 170 void NewScriptController::debugOut(float startTime) 168 171 { 169 DebugTask task = DebugTask(context_); 170 task.initialize(startTime); 172 173 DebugTask* task = new DebugTask(context_); 174 175 task->initialize(startTime); 176 177 bool inserted = false; 171 178 172 179 if(taskList_.empty()) 173 180 { 174 181 taskList_.push_front(task); 182 inserted = true; 175 183 } 176 184 177 185 else 178 186 { 179 for (std::list<Task >::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime180 { 181 orxout() << taskList_.empty()<< endl;182 183 if(task .getStartTime() < it->getStartTime() )187 for (std::list<Task*>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime 188 { 189 orxout() << "debugOutTask" << endl; 190 191 if(task->getStartTime() < (*it)->getStartTime() ) 184 192 { 185 193 taskList_.insert(it, task); 186 } 187 } 188 } 194 inserted = true; 195 break; 196 } 197 } 198 } 199 200 if (!inserted) 201 { 202 taskList_.push_back(task); 203 } 204 189 205 } 190 206 191 207 void NewScriptController::stringOut(float startTime, std::string output) 192 208 { 193 stringOutTask task = stringOutTask(context_); 194 task.initialize(startTime, output); 209 210 stringOutTask* task = new stringOutTask(context_); 211 212 task->initialize(startTime, output); 213 214 bool inserted = false; 195 215 196 216 if(taskList_.empty()) 197 217 { 198 218 taskList_.push_front(task); 219 inserted = true; 199 220 } 200 221 201 222 else 202 223 { 203 for (std::list<Task >::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime204 { 205 orxout() << taskList_.empty()<< endl;206 207 if(task .getStartTime() < it->getStartTime() )224 for (std::list<Task*>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime 225 { 226 orxout() << "stringOutTask" << endl; 227 228 if(task->getStartTime() < (*it)->getStartTime() ) 208 229 { 209 230 taskList_.insert(it, task); 210 } 211 } 212 } 231 inserted = true; 232 break; 233 } 234 } 235 } 236 237 if (!inserted) 238 { 239 taskList_.push_back(task); 240 } 241 213 242 } 214 243
Note: See TracChangeset
for help on using the changeset viewer.