MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / createSubTask

Function createSubTask

TheForceEngine/TFE_Jedi/Task/task.cpp:119–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117 }
118
119 Task* createSubTask(const char* name, TaskFunc func, TaskFunc localRunFunc)
120 {
121 if (!s_tasks)
122 {
123 createRootTask();
124 }
125
126 Task* newTask = (Task*)allocFromChunkedArray(s_tasks);
127 assert(newTask);
128
129 s_taskCount++;
130 strcpy(newTask->name, name);
131
132 // Insert newTask at the head of the subtask list in the current "mainline" task.
133 newTask->next = s_curTask->subtaskNext;
134 newTask->prev = nullptr;
135 if (s_curTask->subtaskNext)
136 {
137 s_curTask->subtaskNext->prev = newTask;
138 }
139 s_curTask->subtaskNext = newTask;
140
141 // The subtask parent is the current task.
142 newTask->subtaskParent = s_curTask;
143 // This task has no subtasks.
144 newTask->subtaskNext = nullptr;
145 newTask->retTask = nullptr;
146 newTask->userData = nullptr;
147 newTask->framebreak = JFALSE;
148
149 newTask->nextTick = 0;
150
151 newTask->context = { 0 };
152 newTask->context.callstack[0] = func;
153 newTask->localRunFunc = localRunFunc;
154 newTask->context.level = TASK_INIT_LEVEL;
155 return newTask;
156 }
157
158 Task* createTask(const char* name, TaskFunc func, JBool framebreak, TaskFunc localRunFunc)
159 {

Callers 15

inf_createElevatorTaskFunction · 0.85
inf_createTeleportTaskFunction · 0.85
inf_createTriggerTaskFunction · 0.85
level_addAmbientSoundFunction · 0.85
level_serializeFunction · 0.85
hitEffect_createTaskFunction · 0.85
obj_createGeneratorFunction · 0.85
generatorLogic_serializeFunction · 0.85
projectile_createTaskFunction · 0.85
enableMaskFunction · 0.85
agent_createLevelEndTaskFunction · 0.85

Calls 2

createRootTaskFunction · 0.85
allocFromChunkedArrayFunction · 0.85

Tested by

no test coverage detected