From 3e6f4995179095945740ae0aabb2b7bc0df5d000 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Thu, 22 Jun 2023 15:08:15 +0100 Subject: [PATCH] TearDownBattle function --- test/test_runner_battle.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index ca81f4a72d..6c8972bae0 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -841,6 +841,14 @@ void TestRunner_Battle_AfterLastTurn(void) STATE->runFinally = FALSE; } +static void TearDownBattle(void) +{ + FreeMonSpritesGfx(); + FreeBattleSpritesData(); + FreeBattleResources(); + FreeAllWindowBuffers(); +} + static void CB2_BattleTest_NextParameter(void) { if (++STATE->runParameter >= STATE->parameters) @@ -856,10 +864,7 @@ static void CB2_BattleTest_NextParameter(void) static void CB2_BattleTest_NextTrial(void) { - FreeMonSpritesGfx(); - FreeBattleSpritesData(); - FreeBattleResources(); - FreeAllWindowBuffers(); + TearDownBattle(); SetMainCallback2(CB2_BattleTest_NextParameter); @@ -903,12 +908,7 @@ static void BattleTest_TearDown(void *data) // Free resources that aren't cleaned up when the battle was // aborted unexpectedly. if (STATE->tearDownBattle) - { - FreeMonSpritesGfx(); - FreeBattleSpritesData(); - FreeBattleResources(); - FreeAllWindowBuffers(); - } + TearDownBattle(); FREE_AND_SET_NULL(STATE->results); FREE_AND_SET_NULL(STATE); }