Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11172


Ignore:
Timestamp:
Apr 21, 2016, 4:02:06 PM (8 years ago)
Author:
plehmann
Message:

updated some files so NewScriptController lua binds are created. added DebugTask to cmake.

Location:
code/branches/plehmannFS16/src/orxonox
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/plehmannFS16/src/orxonox/CMakeLists.txt

    r11080 r11172  
    6464    infos/PlayerInfo.h
    6565    sound/SoundManager.h
    66     controllers/ScriptController.h
     66    controllers/NewScriptController.h
    6767  PCH_FILE
    6868    OrxonoxPrecompiledHeaders.h
  • code/branches/plehmannFS16/src/orxonox/OrxonoxPrereqs.h

    r11080 r11172  
    9898    class HumanController;
    9999    class ScriptController;
     100    class NewScriptController;
    100101    class WaypointController;
    101102    class WaypointPatrolController;
  • code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt

    r11167 r11172  
    2121  NewScriptController.cc
    2222  Task.cc
     23  DebugTask.cc
    2324)
  • code/branches/plehmannFS16/src/orxonox/controllers/ControllerDirector.cc

    r11167 r11172  
    105105        * the next time it is triggered */
    106106       ctrlid += 1;
     107
     108        orxout()<<"swag"<< endl;
    107109    }
    108110
     
    121123
    122124            // Check if there actually was a player returned.
    123             if( this->player_ == nullptr) return false;
     125            if( this->player_ == nullptr) {
     126            orxout()<<"swag control"<< endl;
     127
     128              return false;
     129            }
    124130        }
    125131        else
  • code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc

    r11167 r11172  
    3939    RegisterClass(DebugTask);
    4040
    41     DebugTask::DebugTask(Context* context) : isRunning_(false)
     41    DebugTask::DebugTask(Context* context): Task(context)
    4242    {
    4343        RegisterObject(DebugTask);
    4444    }
    4545
    46     DebugTask::Tick(float dt)
     46    void DebugTask::tick(float dt)
    4747    {
    48 
     48        SUPER(DebugTask, tick, dt);
    4949        orxout() << "*" << endl;
    5050    }
  • code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.h

    r11167 r11172  
    3333#include "controllers/ArtificialController.h"
    3434#include "tools/interfaces/Tickable.h"
     35#include "Task.h"
    3536
    3637namespace orxonox
    3738{
    38     class _OrxonoxExport Task : public Task
     39    class _OrxonoxExport DebugTask : public Task
    3940    {
    4041        public:
    4142            DebugTask(Context* context);
    42             virtual ~Task();
     43            virtual ~DebugTask(){}
    4344
    44             //this function needs to be called otherwise the task is never carriedout
    45             initialize()
     45            void initialize(float startTime)
     46                {this->startTime_ = startTime;}
    4647
    4748            virtual void tick(float dt) override;
  • code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc

    r11167 r11172  
    4444#include "NewScriptController.h"
    4545
     46#include "DebugTask.h"
    4647#include "Task.h"
    4748#include "infos/PlayerInfo.h"
    4849#include "core/CoreIncludes.h"
    4950#include "worldentities/ControllableEntity.h"
    50 #include "core/LuaState.h"
    5151#include "core/LuaState.h"
    5252#include "util/Math.h"
     
    6969        this->scTime_ = 0.0f;
    7070
    71         //taskList_->push(new DebugTask);
     71        this->context_ = context;
     72
     73        task_ = new DebugTask(context);
     74
     75        //taskQueue_->push(new DebugTask);
    7276
    7377    }
     
    111115        SUPER(NewScriptController, tick, dt);
    112116
    113 /*
     117
    114118        // If this controller has no entity entry, do nothing
    115119        if( !(this->entity_) ) return;
    116120
    117         // See if time has come for the next event to be run
    118         if(this->taskList_->size() > 0 && this->taskList_->front().getStartTime() <= scTime_)
    119         { // Execute the next event on the list
    120           activeTasks_->push_back(taskList_->front());
    121           taskList_->pop();
    122         }
    123 
    124         // Update the local timers in this object
    125         scTime_ += dt;
    126 
    127         // tick active tasks and delete completed tasks
    128         for(std::vector<Task>::iterator it = activeTasks_->begin(); it != activeTasks_->end(); it++)
    129         {
    130           it->tick(dt);
    131           if ( !(it->getIsRunning()) )
    132           {
    133             activeTasks_->erase(it);
    134             it--;
    135           }
    136 
    137         }
    138 */
     121        taskQueue_->first()->tick();
    139122    }
    140123
     
    142125    void NewScriptController::createAndAddTask(Task newTask)
    143126    {
    144       taskList_->push(newTask);
     127      taskQueue_->push(newTask);
    145128    }
    146129
    147     void NewScriptController::debugOut()
     130    void NewScriptController::debugOut(float startTime)
    148131    {
    149       orxout() << "NewScriptController: Taking control" << endl;
     132      DebugTask* task = new DebugTask(context);
     133      task->initialize(10000);
     134      taskQueue_->push(task);
    150135    }
    151136
    152     NewScriptController* NewScriptController::getNewScriptController()
     137    NewScriptController* NewScriptController::getNewScriptController() 
    153138    {
    154139      /* Output a message that confirms this function was called */
  • code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h

    r11167 r11172  
    3030#define _NewScriptController_H__
    3131
     32#include "DebugTask.h"
    3233#include "Task.h"
    3334#include "OrxonoxPrereqs.h"                 /* die ganzen tolua, kopiert aus Dock.h*/
     
    5556
    5657            // LUA interface
    57             // tolua_begin
    5858
    59             void debugOut();
     59            void debugOut(float startTime);// tolua_export
    6060
    61             static NewScriptController* getNewScriptController();
     61            static NewScriptController* getNewScriptController();// tolua_export
    6262
    63             int getID() { return ctrlid_; }
     63            int getID() { return ctrlid_; }// tolua_export
    6464
    65             //tolua_end
    6665
    6766            void createAndAddTask(Task newTask);
     
    8180
    8281            // List of events to walk through
    83             std::queue<Task>* taskList_;
     82            std::queue<Task*>* taskQueue_;
    8483
    8584
    8685            //List of Tasks currently active
    87             std::vector<Task>* activeTasks_;
     86            std::vector<Task*>* activeTasks_;
    8887
    8988            // Time since the creation of this ScriptController object
    9089            float scTime_; 
     90
     91            DebugTask* task_;
     92
     93            context* context_;
    9194
    9295
  • code/branches/plehmannFS16/src/orxonox/controllers/ScriptController.cc

    r11152 r11172  
    4646#include "core/CoreIncludes.h"
    4747#include "worldentities/ControllableEntity.h"
    48 #include "core/LuaState.h"
    4948#include "core/LuaState.h"
    5049#include "util/Math.h"
  • code/branches/plehmannFS16/src/orxonox/controllers/Task.cc

    r11167 r11172  
    3131
    3232#include "infos/PlayerInfo.h"
    33 //#include "controllers/ArtificialController.h"
    3433#include "tools/interfaces/Tickable.h"
    3534
     
    4443        startTime_ = -1;
    4544    }
    46     Task::~Task()
    47     {
    4845
    49     }
    50 /*
    51     Task::initialize(float startTime)
     46    void Task::initialize(float startTime)
    5247    {
    5348        startTime_ = startTime;
    5449    }
    55 */
     50
    5651    void Task::tick(float dt)
    5752    {
    58 
     53        SUPER(Task, tick, dt);
    5954    }
    6055
  • code/branches/plehmannFS16/src/orxonox/controllers/Task.h

    r11167 r11172  
    3131
    3232#include "infos/PlayerInfo.h"
    33 //#include "controllers/ArtificialController.h"
    3433#include "tools/interfaces/Tickable.h"
    3534
     
    4039        public:
    4140            Task(Context* context);
    42             virtual ~Task();
     41            virtual ~Task(){}
    4342
    4443            //this function needs to be called otherwise the task is never carriedout
    45             //initialize();
     44            void initialize(float startTime);
    4645
    4746            virtual void tick(float dt) override;
     
    5655                {return startTime_;}
    5756
    58         private:
     57       //private:
    5958
    6059                bool isRunning_;
Note: See TracChangeset for help on using the changeset viewer.