Skip to content

Commit

Permalink
Fix dummy plugin naked new -> unique_ptr for task.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlyr committed Apr 6, 2023
1 parent ea5ee70 commit aa9abd2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Dummy/src/DummySystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

#include <Core/Tasks/Task.hpp>
#include <Core/Tasks/TaskQueue.hpp>
#include <Engine/Scene/Entity.hpp>
#include <Engine/FrameInfo.hpp>
#include <Engine/RadiumEngine.hpp>
#include <Engine/Rendering/RenderTechnique.hpp>
#include <Engine/Scene/Entity.hpp>

#include "DummyComponent.hpp"
#include "DummyTask.hpp"

namespace DummyPlugin {

DummySystem::DummySystem() : Ra::Engine::Scene::System() {
m_data = new DummyData;
m_data = new DummyData;
m_data->foo = 42;
m_data->bar = 1337;
}
Expand All @@ -22,25 +22,26 @@ DummySystem::~DummySystem() {
delete m_data;
}

void DummySystem::handleAssetLoading( Ra::Engine::Scene::Entity *entity, const Ra::Core::Asset::FileData *data ) {
void DummySystem::handleAssetLoading( Ra::Engine::Scene::Entity* entity,
const Ra::Core::Asset::FileData* data ) {
std::string componentName = "DummyComponent_" + entity->getName();
DummyComponent* component = new DummyComponent( componentName, entity );
registerComponent( entity, component );
}

void DummySystem::generateTasks( Ra::Core::TaskQueue* taskQueue,
const Ra::Engine::FrameInfo& /*frameInfo*/ ) {
DummyTask* task1 = new DummyTask;
DummyOtherTask* task2 = new DummyOtherTask;
auto task1 = std::make_unique<DummyTask>();
auto task2 = std::make_unique<DummyOtherTask>();

DummyParams p;
p.data = m_data;

task1->init( &p );
task2->init( &p );

auto task2Id = taskQueue->registerTask( task2 );
auto task1Id = taskQueue->registerTask( task1 );
auto task2Id = taskQueue->registerTask( std::move( task2 ) );
auto task1Id = taskQueue->registerTask( std::move( task1 ) );

taskQueue->addDependency( task1Id, task2Id );
}
Expand Down

0 comments on commit aa9abd2

Please sign in to comment.