[Orxonox-commit 6531] r11172 - in code/branches/plehmannFS16/src/orxonox: . controllers
plehmann at orxonox.net
plehmann at orxonox.net
Thu Apr 21 16:02:06 CEST 2016
Author: plehmann
Date: 2016-04-21 16:02:06 +0200 (Thu, 21 Apr 2016)
New Revision: 11172
Modified:
code/branches/plehmannFS16/src/orxonox/CMakeLists.txt
code/branches/plehmannFS16/src/orxonox/OrxonoxPrereqs.h
code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt
code/branches/plehmannFS16/src/orxonox/controllers/ControllerDirector.cc
code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc
code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.h
code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc
code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h
code/branches/plehmannFS16/src/orxonox/controllers/ScriptController.cc
code/branches/plehmannFS16/src/orxonox/controllers/Task.cc
code/branches/plehmannFS16/src/orxonox/controllers/Task.h
Log:
updated some files so NewScriptController lua binds are created. added DebugTask to cmake.
Modified: code/branches/plehmannFS16/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/plehmannFS16/src/orxonox/CMakeLists.txt 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/CMakeLists.txt 2016-04-21 14:02:06 UTC (rev 11172)
@@ -63,7 +63,7 @@
controllers/HumanController.h
infos/PlayerInfo.h
sound/SoundManager.h
- controllers/ScriptController.h
+ controllers/NewScriptController.h
PCH_FILE
OrxonoxPrecompiledHeaders.h
LINK_LIBRARIES
Modified: code/branches/plehmannFS16/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/plehmannFS16/src/orxonox/OrxonoxPrereqs.h 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/OrxonoxPrereqs.h 2016-04-21 14:02:06 UTC (rev 11172)
@@ -97,6 +97,7 @@
class DroneController;
class HumanController;
class ScriptController;
+ class NewScriptController;
class WaypointController;
class WaypointPatrolController;
Modified: code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt 2016-04-21 14:02:06 UTC (rev 11172)
@@ -20,4 +20,5 @@
MasterController.cc
NewScriptController.cc
Task.cc
+ DebugTask.cc
)
Modified: code/branches/plehmannFS16/src/orxonox/controllers/ControllerDirector.cc
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/ControllerDirector.cc 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/ControllerDirector.cc 2016-04-21 14:02:06 UTC (rev 11172)
@@ -104,6 +104,8 @@
/* Increase the controller ID so we have a different one for
* the next time it is triggered */
ctrlid += 1;
+
+ orxout()<<"swag"<< endl;
}
bool ControllerDirector::preparationToTakeControl(BaseObject * trigger)
@@ -120,7 +122,11 @@
this->player_ = this->pTrigger_->getTriggeringPlayer();
// Check if there actually was a player returned.
- if( this->player_ == nullptr) return false;
+ if( this->player_ == nullptr) {
+ orxout()<<"swag control"<< endl;
+
+ return false;
+ }
}
else
{
Modified: code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc 2016-04-21 14:02:06 UTC (rev 11172)
@@ -38,14 +38,14 @@
RegisterClass(DebugTask);
- DebugTask::DebugTask(Context* context) : isRunning_(false)
+ DebugTask::DebugTask(Context* context): Task(context)
{
RegisterObject(DebugTask);
}
- DebugTask::Tick(float dt)
+ void DebugTask::tick(float dt)
{
-
+ SUPER(DebugTask, tick, dt);
orxout() << "*" << endl;
}
Modified: code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.h
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.h 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.h 2016-04-21 14:02:06 UTC (rev 11172)
@@ -32,17 +32,18 @@
#include "infos/PlayerInfo.h"
#include "controllers/ArtificialController.h"
#include "tools/interfaces/Tickable.h"
+#include "Task.h"
namespace orxonox
{
- class _OrxonoxExport Task : public Task
+ class _OrxonoxExport DebugTask : public Task
{
public:
DebugTask(Context* context);
- virtual ~Task();
+ virtual ~DebugTask(){}
- //this function needs to be called otherwise the task is never carriedout
- initialize()
+ void initialize(float startTime)
+ {this->startTime_ = startTime;}
virtual void tick(float dt) override;
Modified: code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc 2016-04-21 14:02:06 UTC (rev 11172)
@@ -43,12 +43,12 @@
#include "NewScriptController.h"
+#include "DebugTask.h"
#include "Task.h"
#include "infos/PlayerInfo.h"
#include "core/CoreIncludes.h"
#include "worldentities/ControllableEntity.h"
#include "core/LuaState.h"
-#include "core/LuaState.h"
#include "util/Math.h"
namespace orxonox
@@ -68,8 +68,12 @@
// - times
this->scTime_ = 0.0f;
- //taskList_->push(new DebugTask);
+ this->context_ = context;
+ task_ = new DebugTask(context);
+
+ //taskQueue_->push(new DebugTask);
+
}
@@ -110,46 +114,27 @@
// Call the tick function of the classes we derive from
SUPER(NewScriptController, tick, dt);
-/*
+
// If this controller has no entity entry, do nothing
if( !(this->entity_) ) return;
- // See if time has come for the next event to be run
- if(this->taskList_->size() > 0 && this->taskList_->front().getStartTime() <= scTime_)
- { // Execute the next event on the list
- activeTasks_->push_back(taskList_->front());
- taskList_->pop();
- }
-
- // Update the local timers in this object
- scTime_ += dt;
-
- // tick active tasks and delete completed tasks
- for(std::vector<Task>::iterator it = activeTasks_->begin(); it != activeTasks_->end(); it++)
- {
- it->tick(dt);
- if ( !(it->getIsRunning()) )
- {
- activeTasks_->erase(it);
- it--;
- }
-
- }
-*/
+ taskQueue_->first()->tick();
}
void NewScriptController::createAndAddTask(Task newTask)
{
- taskList_->push(newTask);
+ taskQueue_->push(newTask);
}
- void NewScriptController::debugOut()
+ void NewScriptController::debugOut(float startTime)
{
- orxout() << "NewScriptController: Taking control" << endl;
+ DebugTask* task = new DebugTask(context);
+ task->initialize(10000);
+ taskQueue_->push(task);
}
- NewScriptController* NewScriptController::getNewScriptController()
+ NewScriptController* NewScriptController::getNewScriptController()
{
/* Output a message that confirms this function was called */
orxout() << "Great success!" << std::endl;
Modified: code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h 2016-04-21 14:02:06 UTC (rev 11172)
@@ -29,6 +29,7 @@
#ifndef _NewScriptController_H__
#define _NewScriptController_H__
+#include "DebugTask.h"
#include "Task.h"
#include "OrxonoxPrereqs.h" /* die ganzen tolua, kopiert aus Dock.h*/
#include "ArtificialController.h"
@@ -54,15 +55,13 @@
virtual void tick(float dt) override;
// LUA interface
- // tolua_begin
- void debugOut();
+ void debugOut(float startTime);// tolua_export
- static NewScriptController* getNewScriptController();
+ static NewScriptController* getNewScriptController();// tolua_export
- int getID() { return ctrlid_; }
+ int getID() { return ctrlid_; }// tolua_export
- //tolua_end
void createAndAddTask(Task newTask);
@@ -80,16 +79,20 @@
int ctrlid_;
// List of events to walk through
- std::queue<Task>* taskList_;
+ std::queue<Task*>* taskQueue_;
//List of Tasks currently active
- std::vector<Task>* activeTasks_;
+ std::vector<Task*>* activeTasks_;
// Time since the creation of this ScriptController object
float scTime_;
+ DebugTask* task_;
+ context* context_;
+
+
};// tolua_export
} // tolua_export
Modified: code/branches/plehmannFS16/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/ScriptController.cc 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/ScriptController.cc 2016-04-21 14:02:06 UTC (rev 11172)
@@ -46,7 +46,6 @@
#include "core/CoreIncludes.h"
#include "worldentities/ControllableEntity.h"
#include "core/LuaState.h"
-#include "core/LuaState.h"
#include "util/Math.h"
namespace orxonox
Modified: code/branches/plehmannFS16/src/orxonox/controllers/Task.cc
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/Task.cc 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/Task.cc 2016-04-21 14:02:06 UTC (rev 11172)
@@ -30,7 +30,6 @@
#include "Task.h"
#include "infos/PlayerInfo.h"
-//#include "controllers/ArtificialController.h"
#include "tools/interfaces/Tickable.h"
namespace orxonox
@@ -43,19 +42,15 @@
RegisterObject(Task);
startTime_ = -1;
}
- Task::~Task()
- {
- }
-/*
- Task::initialize(float startTime)
+ void Task::initialize(float startTime)
{
startTime_ = startTime;
}
-*/
+
void Task::tick(float dt)
{
-
+ SUPER(Task, tick, dt);
}
}
\ No newline at end of file
Modified: code/branches/plehmannFS16/src/orxonox/controllers/Task.h
===================================================================
--- code/branches/plehmannFS16/src/orxonox/controllers/Task.h 2016-04-21 13:37:28 UTC (rev 11171)
+++ code/branches/plehmannFS16/src/orxonox/controllers/Task.h 2016-04-21 14:02:06 UTC (rev 11172)
@@ -30,7 +30,6 @@
#define _Task_H__
#include "infos/PlayerInfo.h"
-//#include "controllers/ArtificialController.h"
#include "tools/interfaces/Tickable.h"
namespace orxonox
@@ -39,10 +38,10 @@
{
public:
Task(Context* context);
- virtual ~Task();
+ virtual ~Task(){}
//this function needs to be called otherwise the task is never carriedout
- //initialize();
+ void initialize(float startTime);
virtual void tick(float dt) override;
@@ -55,7 +54,7 @@
float getStartTime()
{return startTime_;}
- private:
+ //private:
bool isRunning_;
More information about the Orxonox-commit
mailing list