Rename ...New/...Free to ...Create/...Destroy
This commit is contained in:
@@ -15,14 +15,14 @@ EntityMap entityMapCreate(const EntityMapDesc *desc) {
|
||||
size_t numBytes = sizeof(EntityMapCell) * map.width * map.height * map.cellDepth;
|
||||
map.cells = bzAlloc(numBytes);
|
||||
bzMemSet(map.cells, 0, numBytes);
|
||||
map.entities = bzArrayNew(EntityMapEntry, 512);
|
||||
map.entities = bzArrayCreate(EntityMapEntry, 512);
|
||||
|
||||
return map;
|
||||
}
|
||||
void entityMapDestroy(EntityMap *entityMap) {
|
||||
bzFree(entityMap->cells);
|
||||
entityMap->cells = NULL;
|
||||
bzArrayFree(entityMap->entities);
|
||||
bzArrayDestroy(entityMap->entities);
|
||||
entityMap->entities = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ void render(float dt, void *userData) {
|
||||
|
||||
static PathNode *heap = NULL;
|
||||
if (!heap)
|
||||
heap = bzHeapNew(PathNode, game->map.width * game->map.height);
|
||||
heap = bzHeapCreate(PathNode, game->map.width * game->map.height);
|
||||
game->path.waypoints = game->waypoints;
|
||||
game->path.maxWaypoints = 128;
|
||||
findPath(&(PathfindingDesc) {
|
||||
|
||||
@@ -26,7 +26,7 @@ bool findPath(const PathfindingDesc *desc) {
|
||||
bzMemSet(visited, 0, sizeof(visited));
|
||||
|
||||
PathNode *heap = desc->heap;
|
||||
if (!heap) heap = bzHeapNew(PathNode, map->width * map->height);
|
||||
if (!heap) heap = bzHeapCreate(PathNode, map->width * map->height);
|
||||
else bzHeapClear(heap);
|
||||
|
||||
i32 toTargetCost = dst(desc->start, desc->target);
|
||||
@@ -115,7 +115,7 @@ bool findPath(const PathfindingDesc *desc) {
|
||||
}
|
||||
|
||||
if (!desc->heap) {
|
||||
bzHeapFree(heap);
|
||||
bzHeapDestroy(heap);
|
||||
heap = NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user