2024-09-28 23:13:42 +00:00
|
|
|
#ifndef ENTITY_REGISTRY_H
|
|
|
|
#define ENTITY_REGISTRY_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2024-10-11 04:07:43 +00:00
|
|
|
#include <jansson.h>
|
|
|
|
|
2024-10-03 00:42:30 +00:00
|
|
|
#include "error.h"
|
2024-09-28 23:13:42 +00:00
|
|
|
|
|
|
|
struct entity_registrant_t {
|
2024-09-29 07:33:16 +00:00
|
|
|
char const *name;
|
2024-09-28 23:13:42 +00:00
|
|
|
char tile;
|
|
|
|
};
|
|
|
|
|
2024-10-13 20:04:35 +00:00
|
|
|
|
2024-09-28 23:13:42 +00:00
|
|
|
enum error_t entity_registrant_init(
|
|
|
|
struct entity_registrant_t *,
|
2024-09-29 07:33:16 +00:00
|
|
|
char const *, char
|
2024-09-28 23:13:42 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
void entity_registrant_free(struct entity_registrant_t *);
|
|
|
|
|
|
|
|
|
|
|
|
struct entity_registry_t {
|
|
|
|
struct entity_registrant_t *entities;
|
|
|
|
size_t size;
|
|
|
|
};
|
|
|
|
|
2024-10-05 06:35:07 +00:00
|
|
|
|
2024-10-13 20:04:35 +00:00
|
|
|
void entity_registry_init(struct entity_registry_t *);
|
2024-09-28 23:13:42 +00:00
|
|
|
void entity_registry_free(struct entity_registry_t *);
|
|
|
|
|
2024-10-11 04:07:43 +00:00
|
|
|
enum error_t entity_registry_serialise(
|
|
|
|
struct entity_registry_t const *,
|
|
|
|
struct json_t **
|
|
|
|
);
|
|
|
|
|
|
|
|
enum error_t entity_registry_deserialise(
|
|
|
|
struct entity_registry_t *,
|
|
|
|
struct json_t *
|
|
|
|
);
|
|
|
|
|
2024-10-13 20:04:35 +00:00
|
|
|
enum error_t entity_registry_resize(struct entity_registry_t *, size_t);
|
|
|
|
|
|
|
|
void entity_registry_set(
|
|
|
|
struct entity_registry_t *,
|
|
|
|
struct entity_registrant_t const *,
|
|
|
|
size_t
|
|
|
|
);
|
|
|
|
|
|
|
|
enum error_t entity_registry_try_set(
|
|
|
|
struct entity_registry_t *,
|
|
|
|
struct entity_registrant_t const *,
|
|
|
|
size_t
|
|
|
|
);
|
|
|
|
|
2024-09-28 23:13:42 +00:00
|
|
|
enum error_t entity_registry_append(
|
|
|
|
struct entity_registry_t *,
|
2024-09-29 07:33:16 +00:00
|
|
|
struct entity_registrant_t const *
|
2024-09-28 23:13:42 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|