diff --git a/OpenJPOG/Source/main.cpp b/OpenJPOG/Source/main.cpp index d8b3174..19e76cb 100644 --- a/OpenJPOG/Source/main.cpp +++ b/OpenJPOG/Source/main.cpp @@ -7,8 +7,7 @@ TBOOL AApplication::OnCreate(TINT argc, TPCHAR* const argv) m_pInputTask = (ADummyTask*)g_oTheApp.GetKernel()->GetScheduler()->CreateTask(TGetClass(ADummyTask), TNULL); m_pInputTask->Create(); m_pInputTask->Activate(TTRUE); - TPCHAR str = (TPCHAR)"InputTask"; - m_pInputTask->SetName(str); + m_pInputTask->SetName((TPCHAR)"InputTask"); return TApplication::OnCreate(argc, argv); } diff --git a/Toshi/Include/TKernel/TDList.h b/Toshi/Include/TKernel/TDList.h index 146966a..18a4ff1 100644 --- a/Toshi/Include/TKernel/TDList.h +++ b/Toshi/Include/TKernel/TDList.h @@ -151,7 +151,7 @@ class TOSHI_EXPORT TGenericDList }; template -class TOSHI_EXPORT TDList : public TGenericDList +class TDList : public TGenericDList { public: diff --git a/Toshi/Include/TKernel/TManagedPointer.h b/Toshi/Include/TKernel/TManagedPointer.h index 556e880..b3cef8d 100644 --- a/Toshi/Include/TKernel/TManagedPointer.h +++ b/Toshi/Include/TKernel/TManagedPointer.h @@ -4,7 +4,7 @@ TOSHI_NAMESPACE_BEGIN template -class TOSHI_EXPORT TManagedPointer +class TManagedPointer { public: TManagedPointer() : m_pObject(TNULL) diff --git a/Toshi/Include/TKernel/TTask.h b/Toshi/Include/TKernel/TTask.h index 4c64b4c..6cf2c4b 100644 --- a/Toshi/Include/TKernel/TTask.h +++ b/Toshi/Include/TKernel/TTask.h @@ -27,13 +27,13 @@ class TOSHI_EXPORT TTask : public TObject, public TNodeTree::TNode virtual TBOOL Create(); virtual TBOOL CreateFailed(); - virtual TBOOL OnCreate(); - virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime); - virtual void OnDestroy(); - virtual TBOOL OnChildDying(TTask* child); - virtual void OnChildDied(TClass* a_pClass, TTask* a_pDeletedTask); - virtual void OnActivate(); - virtual void OnDeactivate(); + virtual TBOOL OnCreate() { return TTRUE; } + virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime) { return TTRUE; } + virtual void OnDestroy() {} + virtual TBOOL OnChildDying(TTask* child) { return TTRUE; } + virtual void OnChildDied(TClass* a_pClass, TTask* a_pDeletedTask) {} + virtual void OnActivate() {} + virtual void OnDeactivate() {} void Activate(TBOOL a_bActivate); diff --git a/Toshi/Source/TKernel/TTask.cpp b/Toshi/Source/TKernel/TTask.cpp index e5843d9..983d93d 100644 --- a/Toshi/Source/TKernel/TTask.cpp +++ b/Toshi/Source/TKernel/TTask.cpp @@ -16,9 +16,8 @@ TBOOL TTask::Create() return TFALSE; } - //auto oldState = m_State; - //m_State |= State_Created; - //Activate(TTRUE); + m_iState |= State_Created; + Activate(TTRUE); } return TTRUE; @@ -26,40 +25,28 @@ TBOOL TTask::Create() TBOOL TTask::CreateFailed() { - return TBOOL(); -} - -TBOOL TTask::OnCreate() -{ - return TBOOL(); -} - -TBOOL TTask::OnUpdate(TFLOAT a_fDeltaTime) -{ - return TBOOL(); -} - -void TTask::OnDestroy() -{ -} - -TBOOL TTask::OnChildDying(TTask* child) -{ - return TBOOL(); -} + TASSERT(IsCreated() == TFALSE); -void TTask::OnChildDied(TClass* a_pClass, TTask* a_pDeletedTask) -{ -} - -void TTask::OnActivate() -{ -} + if (!IsCreated()) { + m_Tree->Remove(this, TFALSE); + Delete(); + } -void TTask::OnDeactivate() -{ + return TFALSE; } void TTask::Activate(TBOOL a_bActivate) { + TUINT8 oldState = m_iState; + TUINT8 newFlags = a_bActivate ? State_Active : 0; + m_iState = (m_iState & ~State_Active) | newFlags; + + if (oldState != m_iState) { + if (a_bActivate) { + OnActivate(); + } + else { + OnDeactivate(); + } + } }