Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11178


Ignore:
Timestamp:
Apr 28, 2016, 4:08:07 PM (8 years ago)
Author:
plehmann
Message:

scriptcontroller task system doesnt work. it seems like queue is the wrong data structure

Location:
code/branches/plehmannFS16
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/plehmannFS16/data/gui/scripts/testscript.lua

    r11167 r11178  
    2323if ctrl ~= nil then
    2424
    25 
    26     ctrl:debugOut()
     25    --ctrl:printDebug()
     26  --ctrl:debugOut(1000)
     27  --ctrl:stringOut(10000, "hello")
    2728  --ctrl:eventScheduler("mal", xl,yl,zl, xl,yl,zl, 10)
    2829  -- ctrl:eventScheduler("ral", xl, yl, zl, 3, 3000, 0, math.pi)
  • code/branches/plehmannFS16/data/levels/scriptController.oxw

    r11152 r11178  
    3939    <Billboard position="2500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
    4040    <DistanceTrigger position="2500,0,0" distance="200" target="Pawn"
    41       beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
     41      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl" stayActive="true"
    4242    />
    4343
  • code/branches/plehmannFS16/src/orxonox/controllers/CMakeLists.txt

    r11172 r11178  
    55  ArtificialController.cc
    66  AIController.cc
    7  
    87  WaypointController.cc
    98  WaypointPatrolController.cc
     
    2221  Task.cc
    2322  DebugTask.cc
     23  stringOutTask.cc
    2424)
  • code/branches/plehmannFS16/src/orxonox/controllers/DebugTask.cc

    r11172 r11178  
    4646    void DebugTask::tick(float dt)
    4747    {
    48         SUPER(DebugTask, tick, dt);
    4948        orxout() << "*" << endl;
    5049    }
  • code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc

    r11172 r11178  
    4545
    4646#include "DebugTask.h"
     47#include "stringOutTask.h"
    4748#include "Task.h"
    4849#include "infos/PlayerInfo.h"
     
    7071
    7172        this->context_ = context;
    72 
    73         task_ = new DebugTask(context);
    74 
    75         //taskQueue_->push(new DebugTask);
    76 
    7773    }
    7874
     
    119115        if( !(this->entity_) ) return;
    120116
    121         taskQueue_->first()->tick();
     117
     118/*
     119        if(taskQueue_.front()->getStartTime() <= scTime_)
     120        {
     121          activeTasks_.push_back(taskQueue_.front());
     122          taskQueue_.pop();
     123        }
     124
     125        for(Task* task : activeTasks_)
     126        {
     127          task->tick(dt);
     128        }*/
     129
     130        if(taskQueue_.front() != nullptr)
     131        {
     132          orxout() << taskQueue_.front() << endl;
     133          //taskQueue_.front()->tick(dt);
     134        }
    122135    }
    123136
     
    125138    void NewScriptController::createAndAddTask(Task newTask)
    126139    {
    127       taskQueue_->push(newTask);
     140      //taskQueue_->push(newTask);
    128141    }
    129142
    130143    void NewScriptController::debugOut(float startTime)
    131144    {
    132       DebugTask* task = new DebugTask(context);
    133       task->initialize(10000);
    134       taskQueue_->push(task);
     145      DebugTask* task = new DebugTask(context_);
     146      task->initialize(startTime);
     147      taskQueue_.push(task);
     148    }
     149
     150    void NewScriptController::stringOut(float startTime, std::string output)
     151    {
     152      stringOutTask* task = new stringOutTask(context_);
     153      task->initialize(startTime, output);
     154      taskQueue_.push(task);
    135155    }
    136156
  • code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.h

    r11172 r11178  
    3131
    3232#include "DebugTask.h"
     33#include "stringOutTask.h"
    3334#include "Task.h"
    3435#include "OrxonoxPrereqs.h"                 /* die ganzen tolua, kopiert aus Dock.h*/
     
    5758            // LUA interface
    5859
    59             void debugOut(float startTime);// tolua_export
     60            void debugOut(float startTime);// tolua_export
     61
     62            void stringOut(float startTime, std::string output);// tolua_export
    6063
    6164            static NewScriptController* getNewScriptController();// tolua_export
    6265
    6366            int getID() { return ctrlid_; }// tolua_export
     67
     68            void printDebug() {orxout() << "fffff" << endl;} // tolua_export
    6469
    6570
     
    8085
    8186            // List of events to walk through
    82             std::queue<Task*>* taskQueue_;
     87            std::queue<Task*> taskQueue_;
    8388
    8489
    8590            //List of Tasks currently active
    86             std::vector<Task*>* activeTasks_;
     91            std::vector<Task*> activeTasks_;
    8792
    8893            // Time since the creation of this ScriptController object
    8994            float scTime_; 
    9095
    91             DebugTask* task_;
    9296
    93             context* context_;
     97            // context of the Controller to create the tasks
     98            Context* context_;
    9499
    95100
  • code/branches/plehmannFS16/src/orxonox/controllers/Task.h

    r11172 r11178  
    3232#include "infos/PlayerInfo.h"
    3333#include "tools/interfaces/Tickable.h"
     34#include "core/class/OrxonoxClass.h"
    3435
    3536namespace orxonox
    3637{
    37     class _OrxonoxExport Task : public Tickable
    38     {
     38    class _OrxonoxExport Task : public OrxonoxClass {
     39   
    3940        public:
    4041            Task(Context* context);
     
    4445            void initialize(float startTime);
    4546
    46             virtual void tick(float dt) override;
     47            virtual void tick(float dt);
    4748
    4849            void setIsRunning(bool shouldBeRunning)
Note: See TracChangeset for help on using the changeset viewer.