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

Function createTask

TheForceEngine/TFE_Jedi/Task/task.cpp:158–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156 }
157
158 Task* createTask(const char* name, TaskFunc func, JBool framebreak, TaskFunc localRunFunc)
159 {
160 if (!s_tasks)
161 {
162 createRootTask();
163 }
164
165 Task* newTask = (Task*)allocFromChunkedArray(s_tasks);
166 assert(newTask);
167
168 s_taskCount++;
169 // Insert the task after 's_taskIter'
170 strcpy(newTask->name, name);
171 newTask->next = s_taskIter->next;
172 // This was missing?
173 if (s_taskIter->next)
174 {
175 s_taskIter->next->prev = newTask;
176 }
177 newTask->prev = s_taskIter;
178 s_taskIter->next = newTask;
179
180 newTask->subtaskNext = nullptr;
181 newTask->subtaskParent = nullptr;
182 newTask->retTask = nullptr;
183 newTask->userData = nullptr;
184 newTask->framebreak = framebreak;
185
186 newTask->context = { 0 };
187 newTask->context.callstack[0] = func;
188 newTask->localRunFunc = localRunFunc;
189 newTask->context.level = TASK_INIT_LEVEL;
190 newTask->nextTick = s_curTick;
191
192 return newTask;
193 }
194
195 void task_serializeState(Stream* stream, Task* task, void* userData, LocalMemorySerCallback localMemCallback, bool resetIP)
196 {

Callers 9

obj_setUpdateFunction · 0.85
updateLogic_serializeFunction · 0.85
mission_startTaskFuncFunction · 0.85
obj_setSpriteAnimFunction · 0.85
animLogic_serializeFunction · 0.85
startNextModeFunction · 0.85
startMissionFromSaveFunction · 0.85
player_createControllerFunction · 0.85

Calls 2

createRootTaskFunction · 0.85
allocFromChunkedArrayFunction · 0.85

Tested by

no test coverage detected