mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Removed free macro
This commit is contained in:
parent
e412ec30a0
commit
8a68596b64
@ -2,11 +2,10 @@
|
||||
#define GUARD_ALLOC_H
|
||||
|
||||
#define HEAP_SIZE 0x1C000
|
||||
#define free Free
|
||||
|
||||
#define FREE_AND_SET_NULL(ptr) \
|
||||
{ \
|
||||
free(ptr); \
|
||||
Free(ptr); \
|
||||
ptr = NULL; \
|
||||
}
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ static u8 GetNextRoomType(void)
|
||||
}
|
||||
|
||||
nextRoomType = roomCandidates[Random() % numRoomCandidates];
|
||||
free(roomCandidates);
|
||||
Free(roomCandidates);
|
||||
if (nextRoomType == PIKE_ROOM_STATUS)
|
||||
TryInflictRandomStatus();
|
||||
|
||||
@ -1363,7 +1363,7 @@ static void SetHintedRoom(void)
|
||||
}
|
||||
|
||||
gSaveBlock2Ptr->frontier.pikeHintedRoomType = roomCandidates[Random() % count];
|
||||
free(roomCandidates);
|
||||
Free(roomCandidates);
|
||||
if (gSaveBlock2Ptr->frontier.pikeHintedRoomType == PIKE_ROOM_STATUS && !AtLeastOneHealthyMon())
|
||||
gSaveBlock2Ptr->frontier.pikeHintedRoomType = PIKE_ROOM_NPC;
|
||||
if (gSaveBlock2Ptr->frontier.pikeHintedRoomType == PIKE_ROOM_DOUBLE_BATTLE && !AtLeastTwoAliveMons())
|
||||
|
@ -1568,7 +1568,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
|
||||
}
|
||||
}
|
||||
RunOnLoadMapScript();
|
||||
free(floorLayoutOffsets);
|
||||
Free(floorLayoutOffsets);
|
||||
}
|
||||
|
||||
void LoadBattlePyramidObjectEventTemplates(void)
|
||||
@ -1697,7 +1697,7 @@ static void SetPyramidObjectPositionsUniformly(u8 objType)
|
||||
} while (!(bits & 4) && TrySetPyramidObjectEventPositionInSquare(objType, floorLayoutOffsets, squareId, objectStartIndex + i));
|
||||
bits &= 1;
|
||||
}
|
||||
free(floorLayoutOffsets);
|
||||
Free(floorLayoutOffsets);
|
||||
}
|
||||
|
||||
static bool8 SetPyramidObjectPositionsInAndNearSquare(u8 objType, u8 squareId)
|
||||
@ -1760,7 +1760,7 @@ static bool8 SetPyramidObjectPositionsInAndNearSquare(u8 objType, u8 squareId)
|
||||
r7 &= 1;
|
||||
}
|
||||
#ifdef BUGFIX
|
||||
free(floorLayoutOffsets);
|
||||
Free(floorLayoutOffsets);
|
||||
#endif
|
||||
|
||||
return (numObjects / 2) > numPlacedObjects;
|
||||
@ -1814,7 +1814,7 @@ static bool8 SetPyramidObjectPositionsNearSquare(u8 objType, u8 squareId)
|
||||
break;
|
||||
}
|
||||
#ifdef BUGFIX
|
||||
free(floorLayoutOffsets);
|
||||
Free(floorLayoutOffsets);
|
||||
#endif
|
||||
|
||||
return (numObjects / 2) > numPlacedObjects;
|
||||
|
@ -1000,7 +1000,7 @@ static void HandleDecorationItemsMenuInput(u8 taskId)
|
||||
DestroyListMenuTask(tMenuTaskId, &sDecorationsScrollOffset, &sDecorationsCursorPos);
|
||||
RemoveDecorationWindow(WINDOW_DECORATION_CATEGORIES);
|
||||
RemoveDecorationItemsOtherWindows();
|
||||
free(sDecorationItemsMenu);
|
||||
Free(sDecorationItemsMenu);
|
||||
sSecretBasePC_SelectedDecorationActions[tDecorationMenuCommand][0](taskId);
|
||||
break;
|
||||
}
|
||||
@ -1161,7 +1161,7 @@ static void DecorationItemsMenuAction_Cancel(u8 taskId)
|
||||
RemoveDecorationItemsScrollIndicators();
|
||||
RemoveDecorationItemsOtherWindows();
|
||||
DestroyListMenuTask(tMenuTaskId, NULL, NULL);
|
||||
free(sDecorationItemsMenu);
|
||||
Free(sDecorationItemsMenu);
|
||||
ReinitDecorationCategoriesWindow(taskId);
|
||||
}
|
||||
|
||||
@ -2066,7 +2066,7 @@ static u8 AddDecorationIconObjectFromIconTable(u16 tilesTag, u16 paletteTag, u8
|
||||
template->paletteTag = paletteTag;
|
||||
spriteId = CreateSprite(template, 0, 0, 0);
|
||||
FreeItemIconTemporaryBuffers();
|
||||
free(template);
|
||||
Free(template);
|
||||
return spriteId;
|
||||
}
|
||||
|
||||
@ -2105,7 +2105,7 @@ static u8 AddDecorationIconObjectFromObjectEvent(u16 tilesTag, u16 paletteTag, u
|
||||
template->tileTag = tilesTag;
|
||||
template->paletteTag = paletteTag;
|
||||
spriteId = CreateSprite(template, 0, 0, 0);
|
||||
free(template);
|
||||
Free(template);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1543,7 +1543,7 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *),
|
||||
LoadObjectEventPalette(spriteTemplate->paletteTag);
|
||||
|
||||
spriteId = CreateSprite(spriteTemplate, x, y, subpriority);
|
||||
free(spriteTemplate);
|
||||
Free(spriteTemplate);
|
||||
|
||||
if (spriteId != MAX_SPRITES && subspriteTables != NULL)
|
||||
{
|
||||
|
@ -2298,7 +2298,7 @@ static void Fill1PRecords(struct RankingHall1P *dst, s32 hallFacilityId, s32 lvl
|
||||
record1P[highestId].winStreak = 0;
|
||||
}
|
||||
|
||||
free(playerHallRecords);
|
||||
Free(playerHallRecords);
|
||||
}
|
||||
|
||||
static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode)
|
||||
@ -2332,7 +2332,7 @@ static void Fill2PRecords(struct RankingHall2P *dst, s32 lvlMode)
|
||||
record2P[highestId].winStreak = 0;
|
||||
}
|
||||
|
||||
free(playerHallRecords);
|
||||
Free(playerHallRecords);
|
||||
}
|
||||
|
||||
static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode)
|
||||
@ -2436,7 +2436,7 @@ void SaveGameFrontier(void)
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
gPlayerParty[i] = monsParty[i];
|
||||
|
||||
free(monsParty);
|
||||
Free(monsParty);
|
||||
}
|
||||
|
||||
// Frontier Brain functions.
|
||||
|
@ -955,7 +955,7 @@ void SaveLinkTrainerNames(void)
|
||||
|
||||
// Finalize the new list, and clean up.
|
||||
memcpy(gSaveBlock1Ptr->trainerNameRecords, newRecords, sizeof(gSaveBlock1Ptr->trainerNameRecords));
|
||||
free(newRecords);
|
||||
Free(newRecords);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,8 +358,8 @@ static void Task_RecordMixing_Main(u8 taskId)
|
||||
case 5: // Wait for the task created by CreateTask_ReestablishCableClubLink
|
||||
if (!gTasks[tLinkTaskId].isActive)
|
||||
{
|
||||
free(sReceivedRecords);
|
||||
free(sSentRecord);
|
||||
Free(sReceivedRecords);
|
||||
Free(sSentRecord);
|
||||
SetLinkWaitingForScript();
|
||||
if (gWirelessCommType != 0)
|
||||
CreateTask(Task_ReturnToFieldRecordMixing, 10);
|
||||
@ -705,7 +705,7 @@ static void ReceiveLilycoveLadyData(LilycoveLady *records, size_t recordSize, u8
|
||||
if (lilycoveLady != NULL)
|
||||
{
|
||||
QuizLadyClearQuestionForRecordMix(lilycoveLady);
|
||||
free(lilycoveLady);
|
||||
Free(lilycoveLady);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,8 +475,8 @@ bool32 MoveRecordedBattleToSaveData(void)
|
||||
break;
|
||||
}
|
||||
|
||||
free(battleSave);
|
||||
free(savSection);
|
||||
Free(battleSave);
|
||||
Free(savSection);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ static void HandleRegistryMenuInput(u8 taskId)
|
||||
ClearWindowTilemap(tMainWindowId);
|
||||
RemoveWindow(tMainWindowId);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
free(sRegistryMenu);
|
||||
Free(sRegistryMenu);
|
||||
GoToSecretBasePCRegisterMenu(taskId);
|
||||
break;
|
||||
default:
|
||||
|
6
src/tv.c
6
src/tv.c
@ -3488,7 +3488,7 @@ void ReceiveTvShowsData(void *src, u32 size, u8 playersLinkId)
|
||||
CompactTVShowArray(gSaveBlock1Ptr->tvShows);
|
||||
DeactivateShowsWithUnseenSpecies();
|
||||
DeactivateGameCompleteShowsIfNotUnlocked();
|
||||
free(rmBuffer2);
|
||||
Free(rmBuffer2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3861,7 +3861,7 @@ void ReceivePokeNewsData(void *src, u32 size, u8 playersLinkId)
|
||||
}
|
||||
ClearInvalidPokeNews();
|
||||
ClearPokeNewsIfGameNotComplete();
|
||||
free(rmBuffer2);
|
||||
Free(rmBuffer2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4023,7 +4023,7 @@ static void TranslateShowNames(TVShow *show, u32 language)
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(shows);
|
||||
Free(shows);
|
||||
}
|
||||
|
||||
void SanitizeTVShowsForRuby(TVShow *shows)
|
||||
|
@ -3365,12 +3365,12 @@ static void Task_InitUnionRoom(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
free(data->spawnPlayer);
|
||||
free(data->playerList);
|
||||
free(data->incomingParentList);
|
||||
free(data->incomingChildList);
|
||||
Free(data->spawnPlayer);
|
||||
Free(data->playerList);
|
||||
Free(data->incomingParentList);
|
||||
Free(data->incomingChildList);
|
||||
DestroyTask(data->searchTaskId);
|
||||
free(sWirelessLinkMain.uRoom);
|
||||
Free(sWirelessLinkMain.uRoom);
|
||||
LinkRfu_Shutdown();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user