fp: Use new insert API for containers

This commit is contained in:
doyle 2023-09-18 21:46:42 +10:00
parent f60099e7a3
commit 3e31d0ef69
3 changed files with 4 additions and 11 deletions

2
External/tely vendored

@ -1 +1 @@
Subproject commit b45db1a82cf5fb7f32d298c71b7dc0ac806a6f5f
Subproject commit 0b5b08bb635d1aad6832a69d30e2c45f7a59af8b

View File

@ -87,7 +87,7 @@ void TELY_DLL_Init(void *user_data)
}
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);
// 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)
continue;
char const *src = DQN_CAST(char *)(frontier.data + index);
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++;
Dqn_FArray_Insert(&frontier, index, next_tile);
inserted = true;
break;
}

View File

@ -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))
return result;
result = Dqn_VArray_Make(&game->entities, 1, Dqn_ZeroMem_Yes);
result = Dqn_VArray_Make(&game->entities, Dqn_ZeroMem_Yes);
if (!result)
return result;
result->handle.id = (game->entities.size - 1) & FP_GAME_ENTITY_HANDLE_INDEX_MASK;