2024-09-28 23:13:42 +00:00
|
|
|
#ifndef WORLD_H
|
|
|
|
#define WORLD_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2024-10-10 05:58:13 +00:00
|
|
|
#include <jansson.h>
|
|
|
|
|
2024-09-28 23:13:42 +00:00
|
|
|
#include "error.h"
|
|
|
|
#include "entity/registry.h"
|
|
|
|
#include "entity/entity.h"
|
|
|
|
|
|
|
|
#define MAX_ENTITIES 256
|
|
|
|
|
|
|
|
struct world_t {
|
|
|
|
struct entity_t entities[MAX_ENTITIES];
|
|
|
|
struct entity_registry_t registered_entities;
|
|
|
|
|
|
|
|
size_t height;
|
|
|
|
size_t width;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum error_t world_init(struct world_t *, size_t, size_t);
|
|
|
|
void world_free(struct world_t *);
|
|
|
|
|
2024-10-10 22:31:07 +00:00
|
|
|
enum error_t world_serialise_str(struct world_t *, char const **);
|
2024-10-13 20:04:35 +00:00
|
|
|
enum error_t world_deserialise_str(struct world_t *, char const *);
|
|
|
|
// Operates on strings; serialise allocates so make sure to free
|
|
|
|
|
2024-10-10 22:31:07 +00:00
|
|
|
enum error_t world_serialise_buf(struct world_t *, char *, size_t);
|
2024-10-13 20:04:35 +00:00
|
|
|
// Operates on buffers; need not be zero-terminated
|
2024-10-10 05:58:13 +00:00
|
|
|
|
2024-09-29 07:33:16 +00:00
|
|
|
enum error_t world_register_entity(struct world_t *, char const *, char);
|
2024-09-28 23:13:42 +00:00
|
|
|
enum error_t world_place_entity(struct world_t *, size_t, size_t, size_t);
|
|
|
|
|
|
|
|
#endif
|