mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
Merge pull request #1689 from GriffinRichards/task-ub
Remove UBFIX related to task destruction
This commit is contained in:
commit
c2a08cc84d
@ -135,10 +135,12 @@ 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.
|
||||
#endif
|
||||
DestroyAnimVisualTask(taskId);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -181,10 +183,12 @@ 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.
|
||||
#endif
|
||||
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