summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/task.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/task.c b/src/task.c
new file mode 100644
index 000000000..9458275a4
--- /dev/null
+++ b/src/task.c
@@ -0,0 +1,27 @@
+void RemoveTask(u8 taskId)
+{
+ if (gTasks[taskId].isActive)
+ {
+ gTasks[taskId].isActive = FALSE;
+
+ if (gTasks[taskId].prev == HEAD_SENTINEL)
+ {
+ if (gTasks[taskId].next != TAIL_SENTINEL)
+ {
+ gTasks[gTasks[taskId].next].prev = HEAD_SENTINEL;
+ }
+ }
+ else
+ {
+ if (gTasks[taskId].next == TAIL_SENTINEL)
+ {
+ gTasks[gTasks[taskId].prev].next = TAIL_SENTINEL;
+ }
+ else
+ {
+ gTasks[gTasks[taskId].prev].next = gTasks[taskId].next;
+ gTasks[gTasks[taskId].next].prev = gTasks[taskId].prev;
+ }
+ }
+ }
+}