mainly just make spacing look nicer lol
This commit is contained in:
parent
96ce1aa0fe
commit
2db264c027
2
TODO.gmi
2
TODO.gmi
@ -20,3 +20,5 @@ A list of things I'd like to accomplish
|
|||||||
* Add a lua modding API
|
* Add a lua modding API
|
||||||
* Load mods
|
* Load mods
|
||||||
* Handle mod dependencies
|
* Handle mod dependencies
|
||||||
|
* Remove rendering from serverside
|
||||||
|
* Client-side resource files for each mod
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
||||||
|
|
||||||
void render_world(struct world_t const *world) {
|
void render_world(struct world_t const *world) {
|
||||||
for (size_t i = 0; i < MAX_ENTITIES; i++) {
|
for (size_t i = 0; i < MAX_ENTITIES; i++) {
|
||||||
struct entity_t const *const entity = &world->entities[i];
|
struct entity_t const *const entity = &world->entities[i];
|
||||||
|
@ -23,6 +23,7 @@ struct entity_registry_t {
|
|||||||
size_t size;
|
size_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum error_t entity_registry_init(struct entity_registry_t *);
|
enum error_t entity_registry_init(struct entity_registry_t *);
|
||||||
void entity_registry_free(struct entity_registry_t *);
|
void entity_registry_free(struct entity_registry_t *);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ char const *const ERROR_STRS[] = {
|
|||||||
"SETSID",
|
"SETSID",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
_Static_assert(
|
_Static_assert(
|
||||||
__ERR_COUNT == (sizeof(ERROR_STRS) / sizeof(ERROR_STRS[0])),
|
__ERR_COUNT == (sizeof(ERROR_STRS) / sizeof(ERROR_STRS[0])),
|
||||||
"len(ERROR_STRS) must match __ERR_COUNT"
|
"len(ERROR_STRS) must match __ERR_COUNT"
|
||||||
|
@ -32,10 +32,12 @@ enum error_t world_init(struct world_t *self, size_t height, size_t width) {
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void world_free(struct world_t *self) {
|
void world_free(struct world_t *self) {
|
||||||
entity_registry_free(&self->registered_entities);
|
entity_registry_free(&self->registered_entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum error_t world_register_entity(
|
enum error_t world_register_entity(
|
||||||
struct world_t *self,
|
struct world_t *self,
|
||||||
char const *name, char tile
|
char const *name, char tile
|
||||||
@ -53,6 +55,7 @@ enum error_t world_register_entity(
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static size_t world_find_empty_entity(struct world_t const *self) {
|
static size_t world_find_empty_entity(struct world_t const *self) {
|
||||||
for (size_t i = 0; i < MAX_ENTITIES; i++)
|
for (size_t i = 0; i < MAX_ENTITIES; i++)
|
||||||
if (self->entities[i].id == 0) return 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;
|
return MAX_ENTITIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum error_t world_place_entity(
|
enum error_t world_place_entity(
|
||||||
struct world_t *self,
|
struct world_t *self,
|
||||||
size_t id, size_t x, size_t y
|
size_t id, size_t x, size_t y
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// daemon.c
|
// daemon.c
|
||||||
|
|
||||||
#include "daemon.h"
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "daemon.h"
|
||||||
|
|
||||||
enum error_t daemonise(void) {
|
enum error_t daemonise(void) {
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid < 0) return ERR_FORK; // return if error
|
if (pid < 0) return ERR_FORK; // return if error
|
||||||
|
@ -15,6 +15,7 @@ struct options_t {
|
|||||||
bool daemonise;
|
bool daemonise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static enum error_t parse_arguments(
|
static enum error_t parse_arguments(
|
||||||
struct options_t *options,
|
struct options_t *options,
|
||||||
int argc, char **argv
|
int argc, char **argv
|
||||||
@ -38,6 +39,7 @@ static enum error_t parse_arguments(
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
enum error_t err = ERR_OK;
|
enum error_t err = ERR_OK;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user