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