Skip to content

Commit ba0115f

Browse files
[client_lib|wiki] Removed core_get_obj_filter_first() - very unnecessary; closes #146
1 parent c9bd20d commit ba0115f

File tree

4 files changed

+1
-65
lines changed

4 files changed

+1
-65
lines changed

client_lib/inc/core_lib.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,6 @@ t_obj *core_get_obj_from_pos(t_pos pos);
252252
/// @return Null-terminated array of selected objects or NULL if no condition is provided or no objects match the condition.
253253
t_obj **core_get_objs_filter(bool (*condition)(const t_obj *));
254254

255-
/// @brief Get the first object matching a custom condition.
256-
/// @param condition Selection function pointer returning if the inputted object should be selected
257-
/// @return The first object that matches the condition or NULL if no such object exists or no condition is provided.
258-
t_obj *core_get_obj_filter_first(bool (*condition)(const t_obj *));
259-
260255
/// @brief Get the nearest object to a given position matching a custom condition.
261256
/// @param pos Position to search from
262257
/// @param condition Selection function pointer returning if the inputted object should be selected

client_lib/src/con_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int core_startGame(const char *team_name, int argc, char **argv, void (*tick_cal
112112
}
113113
core_internal_parse_state(msg);
114114
free(msg);
115-
my_core = core_get_obj_filter_first(core_static_isMyCore);
115+
my_core = core_get_obj_filter_nearest((t_pos){0, 0}, core_static_isMyCore);
116116

117117
// execute user code
118118
tick_callback(game.elapsed_ticks);

client_lib/src/public/get.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ t_obj **core_get_objs_filter(bool (*condition)(const t_obj *))
5858
return result;
5959
}
6060

61-
t_obj *core_get_obj_filter_first(bool (*condition)(const t_obj *))
62-
{
63-
t_obj **objects = core_get_objs_filter(condition);
64-
if (!objects || !objects[0]) return NULL;
65-
t_obj *first = objects[0];
66-
free(objects);
67-
return first;
68-
}
69-
7061
t_obj *core_get_obj_filter_nearest(t_pos pos, bool (*condition)(const t_obj *))
7162
{
7263
t_obj **objects = core_get_objs_filter(condition);

wiki/reference/getters/core_get_obj_filter_first.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)