mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Remove UBFIX related to task destruction
This commit is contained in:
parent
78b0c20738
commit
7a6b417b8e
@ -135,9 +135,11 @@ void SoundTask_PlayCryHighPitch(u8 taskId)
|
||||
{
|
||||
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
||||
species = gContestResources->moveAnim->species;
|
||||
#ifndef UBFIX
|
||||
// Destroying the task twice (here and at end of function)
|
||||
// results in an incorrect value for gAnimVisualTaskCount
|
||||
#ifndef BUGFIX
|
||||
else
|
||||
DestroyAnimVisualTask(taskId); // UB: task gets destroyed twice.
|
||||
DestroyAnimVisualTask(taskId);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -181,9 +183,11 @@ void SoundTask_PlayDoubleCry(u8 taskId)
|
||||
{
|
||||
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
|
||||
species = gContestResources->moveAnim->species;
|
||||
#ifndef UBFIX
|
||||
// Destroying the task twice (here and at end of function)
|
||||
// results in an incorrect value for gAnimVisualTaskCount
|
||||
#ifndef BUGFIX
|
||||
else
|
||||
DestroyAnimVisualTask(taskId); // UB: task gets destroyed twice.
|
||||
DestroyAnimVisualTask(taskId);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -4220,17 +4220,12 @@ static void Task_OpenMonPic(u8 taskId)
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
#ifndef UBFIX
|
||||
DestroyTask(taskId);
|
||||
#endif
|
||||
// UB: Should not use the task after it has been deleted.
|
||||
// Accessing data of destroyed task. Task data isn't reset until a new task needs that task id.
|
||||
if (gTasks[taskId].tIsSwapScreen == TRUE)
|
||||
Swap_CreateMonSprite();
|
||||
else
|
||||
Select_CreateMonSprite();
|
||||
#ifdef UBFIX
|
||||
DestroyTask(taskId);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
task->tState++;
|
||||
|
@ -4762,10 +4762,8 @@ static bool8 FrontierSquaresScroll_End(struct Task *task)
|
||||
BlendPalettes(PALETTES_ALL, 16, RGB_BLACK);
|
||||
|
||||
DestroyTask(FindTaskIdByFunc(task->func));
|
||||
task->tState++; // Changing value of a destroyed task
|
||||
|
||||
#ifndef UBFIX
|
||||
task->tState++; // UB: changing value of a destroyed task
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user