diff --git a/TODO.gmi b/TODO.gmi index 5ad4002..353566c 100644 --- a/TODO.gmi +++ b/TODO.gmi @@ -20,3 +20,5 @@ A list of things I'd like to accomplish * Add a lua modding API * Load mods * Handle mod dependencies +* Remove rendering from serverside +* Client-side resource files for each mod diff --git a/client/src/render/render.c b/client/src/render/render.c index 70a8692..7fc2181 100644 --- a/client/src/render/render.c +++ b/client/src/render/render.c @@ -4,6 +4,7 @@ #include "render.h" + void render_world(struct world_t const *world) { for (size_t i = 0; i < MAX_ENTITIES; i++) { struct entity_t const *const entity = &world->entities[i]; diff --git a/common/include/entity/registry.h b/common/include/entity/registry.h index 5d9d4f8..55972bb 100644 --- a/common/include/entity/registry.h +++ b/common/include/entity/registry.h @@ -23,6 +23,7 @@ struct entity_registry_t { size_t size; }; + enum error_t entity_registry_init(struct entity_registry_t *); void entity_registry_free(struct entity_registry_t *); diff --git a/common/src/error.c b/common/src/error.c index 893bc4a..9ab5dc4 100644 --- a/common/src/error.c +++ b/common/src/error.c @@ -11,6 +11,7 @@ char const *const ERROR_STRS[] = { "SETSID", }; + _Static_assert( __ERR_COUNT == (sizeof(ERROR_STRS) / sizeof(ERROR_STRS[0])), "len(ERROR_STRS) must match __ERR_COUNT" diff --git a/common/src/world.c b/common/src/world.c index 5bea6f8..a4ba799 100644 --- a/common/src/world.c +++ b/common/src/world.c @@ -32,10 +32,12 @@ enum error_t world_init(struct world_t *self, size_t height, size_t width) { return ERR_OK; } + void world_free(struct world_t *self) { entity_registry_free(&self->registered_entities); } + enum error_t world_register_entity( struct world_t *self, char const *name, char tile @@ -53,6 +55,7 @@ enum error_t world_register_entity( return ERR_OK; } + static size_t world_find_empty_entity(struct world_t const *self) { for (size_t i = 0; i < MAX_ENTITIES; i++) if (self->entities[i].id == 0) return i; @@ -60,6 +63,7 @@ static size_t world_find_empty_entity(struct world_t const *self) { return MAX_ENTITIES; } + enum error_t world_place_entity( struct world_t *self, size_t id, size_t x, size_t y diff --git a/server/src/daemon.c b/server/src/daemon.c index 356d745..7681f32 100644 --- a/server/src/daemon.c +++ b/server/src/daemon.c @@ -1,13 +1,14 @@ // daemon.c -#include "daemon.h" -#include #include #include +#include #include #include #include +#include "daemon.h" + enum error_t daemonise(void) { pid_t pid = fork(); if (pid < 0) return ERR_FORK; // return if error diff --git a/server/src/main.c b/server/src/main.c index 8f35a68..befd304 100644 --- a/server/src/main.c +++ b/server/src/main.c @@ -15,6 +15,7 @@ struct options_t { bool daemonise; }; + static enum error_t parse_arguments( struct options_t *options, int argc, char **argv @@ -38,6 +39,7 @@ static enum error_t parse_arguments( return ERR_OK; } + int main(int argc, char **argv) { enum error_t err = ERR_OK;