Remove define

This commit is contained in:
N 2021-01-16 21:05:35 -05:00
parent 6b5ce647df
commit a950167d89

View File

@ -136,10 +136,9 @@ void TaskDummy(u8 taskId)
{
}
#define TASK_SPACE NUM_TASKS - 2 // So we can reserve space for the last array element
void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc)
{
u8 taskNum = TASK_SPACE; // Should be const
u8 taskNum = NUM_TASKS - 2; // Should be const
gTasks[taskId].data[taskNum] = (s16)((u32)followupFunc);
gTasks[taskId].data[taskNum + 1] = (s16)((u32)followupFunc >> 16);
@ -148,7 +147,7 @@ void SetTaskFuncWithFollowupFunc(u8 taskId, TaskFunc func, TaskFunc followupFunc
void SwitchTaskToFollowupFunc(u8 taskId)
{
u8 taskNum = TASK_SPACE; // Should be const
u8 taskNum = NUM_TASKS - 2; // Should be const
gTasks[taskId].func = (TaskFunc)((u16)(gTasks[taskId].data[taskNum]) | (gTasks[taskId].data[taskNum + 1] << 16));
}
@ -189,7 +188,7 @@ u8 GetTaskCount(void)
void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value)
{
if (dataElem <= TASK_SPACE)
if (dataElem < NUM_TASKS - 1)
{
gTasks[taskId].data[dataElem] = value;
gTasks[taskId].data[dataElem + 1] = value >> 16;
@ -198,7 +197,7 @@ void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value)
u32 GetWordTaskArg(u8 taskId, u8 dataElem)
{
if (dataElem <= TASK_SPACE)
if (dataElem < NUM_TASKS - 1)
return (u16)gTasks[taskId].data[dataElem] | (gTasks[taskId].data[dataElem + 1] << 16);
else
return 0;