fp: Use new insert API for containers
This commit is contained in:
parent
f60099e7a3
commit
3e31d0ef69
2
External/tely
vendored
2
External/tely
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b45db1a82cf5fb7f32d298c71b7dc0ac806a6f5f
|
Subproject commit 0b5b08bb635d1aad6832a69d30e2c45f7a59af8b
|
@ -87,7 +87,7 @@ void TELY_DLL_Init(void *user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
game->entities = Dqn_VArray_Init<FP_GameEntity>(&platform->arena, 1024 * 8);
|
game->entities = Dqn_VArray_Init<FP_GameEntity>(&platform->arena, 1024 * 8);
|
||||||
game->root_entity = Dqn_VArray_Make(&game->entities, 1, Dqn_ZeroMem_No);
|
game->root_entity = Dqn_VArray_Make(&game->entities, Dqn_ZeroMem_No);
|
||||||
Dqn_FArray_Add(&game->parent_entity_stack, game->root_entity->handle);
|
Dqn_FArray_Add(&game->parent_entity_stack, game->root_entity->handle);
|
||||||
|
|
||||||
// NOTE: Unit test DFS pre-order and post-order walk
|
// NOTE: Unit test DFS pre-order and post-order walk
|
||||||
@ -284,14 +284,7 @@ Dqn_Slice<Dqn_V2I> AStarPathFind(Dqn_Arena *arena, TELY_Platform *platform, Dqn_
|
|||||||
if (next_cost_result.value->heuristic >= frontier_heuristic)
|
if (next_cost_result.value->heuristic >= frontier_heuristic)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char const *src = DQN_CAST(char *)(frontier.data + index);
|
Dqn_FArray_Insert(&frontier, index, next_tile);
|
||||||
char const *dest = DQN_CAST(char *)(frontier.data + (index + 1));
|
|
||||||
char const *end = DQN_CAST(char *)(frontier.data + frontier.size);
|
|
||||||
Dqn_usize bytes_to_move = end - src;
|
|
||||||
DQN_MEMMOVE(DQN_CAST(void *)dest, src, bytes_to_move);
|
|
||||||
|
|
||||||
frontier.data[index] = next_tile;
|
|
||||||
frontier.size++;
|
|
||||||
inserted = true;
|
inserted = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ static FP_GameEntity *FP_Game_MakeEntityPointerFV(FP_Game *game, DQN_FMT_STRING_
|
|||||||
if (game->entities.size >= (FP_GAME_ENTITY_HANDLE_INDEX_MAX + 1))
|
if (game->entities.size >= (FP_GAME_ENTITY_HANDLE_INDEX_MAX + 1))
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = Dqn_VArray_Make(&game->entities, 1, Dqn_ZeroMem_Yes);
|
result = Dqn_VArray_Make(&game->entities, Dqn_ZeroMem_Yes);
|
||||||
if (!result)
|
if (!result)
|
||||||
return result;
|
return result;
|
||||||
result->handle.id = (game->entities.size - 1) & FP_GAME_ENTITY_HANDLE_INDEX_MASK;
|
result->handle.id = (game->entities.size - 1) & FP_GAME_ENTITY_HANDLE_INDEX_MASK;
|
||||||
|
Loading…
Reference in New Issue
Block a user