123456789101112131415161718192021222324252627 |
- //
- // Created by 李建 on 2023/12/6.
- //
- #include "object.h"
- #include <string.h>
- #define MAX_OBJECTS 16
- static sparrow_object sparrow_object_list[MAX_OBJECTS];
- static int object_index = 0;
- void register_sparrow_object(sparrow_object obj) {
- if (object_index > MAX_OBJECTS - 1) return;
- sparrow_object_list[object_index++] = obj;
- }
- sparrow_object * find_sparrow_object(char * name) {
- for(int i = 0; i < object_index; i++)
- {
- if( strcmp(sparrow_object_list[i].name, name) == 0)
- {
- return &sparrow_object_list[i];
- }
- }
-
- return NULL;
- }
|