mainly just make spacing look nicer lol

This commit is contained in:
snit 2024-10-05 01:35:07 -05:00
parent 96ce1aa0fe
commit 2db264c027
7 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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];

View File

@ -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 *);

View File

@ -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"

View File

@ -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

View File

@ -1,13 +1,14 @@
// daemon.c
#include "daemon.h"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <syslog.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "daemon.h"
enum error_t daemonise(void) {
pid_t pid = fork();
if (pid < 0) return ERR_FORK; // return if error

View File

@ -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;